File: Makefile

package info (click to toggle)
cashbox 0.3.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 388 kB
  • sloc: python: 1,607; makefile: 79; xml: 57
file content (96 lines) | stat: -rw-r--r-- 3,451 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#        file: Makefile
#   copyright: Bernd Schumacher <bernd@bschu.de> (2024-2025)
#     license: GNU General Public License, version 3
# description: build cashbox package

prefix  := $(if $(prefix),$(prefix),/usr)
LIBS    = $(shell ls *py | grep -v cashbox.py)
UIS     = $(shell ls *blp | sed -e "s/blp$$/ui/")
SHARE   = $(DESTDIR)$(prefix)/share/cashbox
PYTHON  = $(DESTDIR)$(prefix)/share/cashbox/python3/cashbox
BIN     = $(DESTDIR)$(prefix)/bin
APPL    = $(DESTDIR)$(prefix)/share/applications
SVG     = $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps
MIME    = $(DESTDIR)$(prefix)/share/mime/packages
MODIR   = $(DESTDIR)$(prefix)/share/locale
MO      = de
UTF     = "de_DE.UTF-8 us_US.UTF-8"
MO1	= $(shell for i in $(MO); do echo "$${i}/LC_MESSAGES/cashbox.mo"; done)
MO2	= $(shell for i in $(MO1); do echo "po/locale/$${i}"; done)
META    = $(DESTDIR)$(prefix)/share/metainfo
VERSION_BIN = ${shell sed -E -n -e "s/.*application_version.*= \"(\S+)\"$$/\1/p" read_appargs.py}
VERSION_DEB = ${shell head -1 debian/changelog | sed "s/.*(//" | sed "s/).*//"}
VERSION_FLATPAK = ${shell sed -E -n -e "s/^ *<release version=\"(\S+)\".*/\1/p" de.bschu.cashbox.metainfo.xml}
VERSION_REF = $(shell echo $(VERSION_DEB) | sed "s/\./_/g" | sed "s/^/debian_version_/")
VERSION_BADREF = $(shell find . -type f | grep -v Makefile | xargs grep -E -e "salsa\S*/raw" | grep -v -e "ref=$(VERSION_REF)")

all: check_version $(UIS) $(MO2)

dbg:
	@echo "prefix=<$(prefix)> VERSION_BIN=<$(VERSION_BIN)> \
VERSION_DEB=<$(VERSION_DEB)> VERSION_FLATPAK=<$(VERSION_FLATPAK)> \
VERSION_REF=<$(VERSION_REF)> VERSION_BADREF=<$(VERSION_BADREF)>"

check_version:
ifneq ($(VERSION_BIN),$(VERSION_DEB))
	@echo "VERSION_BIN=<$(VERSION_BIN)> != VERSION_DEB=<$(VERSION_DEB)>"
	@exit 1
endif
ifneq ($(VERSION_FLATPAK),$(VERSION_DEB))
	@echo "VERSION_FLATPAK=<$(VERSION_FLATPAK)> != VERSION_DEB=<$(VERSION_DEB)>"
	@exit 1
endif
ifneq ($(VERSION_BADREF),)
	@echo "found references to salsa.../raw without ref=$(VERSION_REF)"
	@echo "$(VERSION_BADREF)"
	@exit 1
endif

clean:
	@rm -rf builddir .flatpak-builder .mypy_cache debian/cashbox

install: dbg install-libs install-bin install-mo

install-libs: $(LIBS) $(UIS)
	@mkdir -p $(PYTHON); \
	for i in $^; do \
	    install -m 0644 $$i $(PYTHON)/; \
	done

install-bin: cashbox.py
	@mkdir -p $(BIN) $(APPL) $(SVG) $(MIME) $(SHARE) $(META)
	@install -m 0755 cashbox.py $(BIN)/cashbox
	@install -m 0644 de.bschu.cashbox.desktop $(APPL)
	@install -m 0644 de.bschu.cashbox.svg $(SVG)
	@install -m 0644 de.bschu.cashbox.xml $(MIME)
	@install -m 0644 cashbox.css $(SHARE)
	@install -m 0644 de.bschu.cashbox.metainfo.xml $(META)

install-mo: $(MO2)
	@for i in $(MO1); do \
	   mkdir -p $$(dirname $(MODIR)/$${i}); \
	   install -m 0644 po/locale/$${i} $(MODIR)/$${i}; \
	done

po/cashbox.pot: cashbox.py $(LIBS) $(UIS)
	@mkdir -p po
	@echo $^ | tr " " "\n" | xgettext --output=po/cashbox.pot -f -

po/de.po: po/cashbox.pot
	@l="$$(basename "$@" .po)"; \
	u="$$(echo " $(UTF) " | tr " " "\n" | grep "^$${l}")"; \
	[ -f $@ ] && msgmerge -o $@.new $@ $< || msginit -i $< -o $@ -l de_DE.UTF-8; \
	[ -f $@.new ] && mv $@.new $@

po/locale/%/LC_MESSAGES/cashbox.mo: po/%.po
	mkdir -p $$(dirname $@)
	msgfmt $< -o $@

p: $(UIS)
	mkdir -p po
	#xgettext --files-from=po/POTFILES --output=po/cashbox.pot
	mkdir -p po/locale/de/LC_MESSAGES
	msgfmt po/de.po -o po/locale/de/LC_MESSAGES/cashbox.mo

%.ui : %.blp
	blueprint-compiler compile $< >$@