posaune
[projects.git] / tools / make / rules
1 #!/usr/bin/make -f
2
3 # Generic rules for mBuild build process
4
5 # defile default operations
6 NOP = @echo "No operation for target $@"
7 DEB = fakeroot dpkg-deb --build debian/tmp
8 INSERT_BUILD = /usr/share/mbuild/insert_build.sh
9
10 include debian/rules.pre
11
12 default:
13         echo "no default rule available"
14
15 # Löschen aller kompilierten, erzeugten und nicht benötigten Dateien im Bauverzeichnis
16 clean:
17         -rm -rf debian/tmp
18
19 # Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis
20 build: debian/$(paket).build sync
21         debian/$(paket).build
22         # Build succeeded
23
24 pack: $(PACK)
25         # packing succeeded
26
27 # Bauen der kompilierten architekturabhängigen Programme aus den Quellen im Bauverzeichnis
28 build-arch:
29
30 # Bauen der architekturunabhängigen formatierten Dokumente aus den Quellen im Bauverzeichnis
31 build-indep:
32
33 # Installieren der Dateien in einen Verzeichnisbaum unterhalb des Verzeichnisses debian für jedes Binärpaket. Falls sie festgelegt wurden, hängen binary*-Ziele effektiv von diesem Ziel ab (optional)
34 install: 
35
36 # Erstellen aller Binärpakete (effektiv ist dies die Kombination der binary-arch- und binary-indep-Ziele)
37 binary: binary-arch binary-indep 
38
39 # Erstellen Architektur-abhängiger (Architecture: any) Binärpakete im übergeordneten Verzeichnis
40 binary-arch: $(BINARY_ARCH)
41
42 # Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis
43 binary-indep: $(BINARY_INDEP)
44
45 #copy ../$(paket)_$(version)-$(build)_all.deb
46
47 version: ~/build/$(TARGET)
48         $(INSERT_BUILD) ~/build/$(TARGET) $(build)
49         cp ~/build/*$(build)* ../
50
51 ../build:
52         mkdir ../build
53
54 sync:
55         bash -c 'for dirs in $$(ls); do rsync -av $$dirs ../build; done'
56
57 copy: debian/$(paket).cp
58         debian/$(paket).cp debian/tmp
59
60 ../$(paket)_$(version)-$(build)_$(arch).deb:debian/tmp/DEBIAN/control $(add_inst_tgt)
61         $(DEB)
62         mv debian/tmp.deb ../$(paket)_$(version)-$(build)_$(arch).deb
63
64 debian/tmp/DEBIAN/control: debian/control debian/changelog
65         dpkg-gencontrol
66
67 debian/control: debian/$(paket).control
68         sed "s/_DEB_HOST_ARCH/${DEB_HOST_ARCH}/" debian/$(paket).control >> debian/control
69
70 debian/changelog: debian/$(paket).changelog debian/rules.pre
71         sed "s/%BUILD%/$(build)/" debian/$(paket).changelog > debian/changelog
72 #       echo "${pwd} (${build}) unstable; urgency=medium" > debian/changelog
73 #       echo "  * generated by mbuild" >> debian/changelog
74 #       echo " -- Michael Wagner <info@wagnertech.de>  Sun, 11 Feb 2018 20:03:04 +0100" >> debian/changelog
75 #       mb_create_changelog
76
77 debian/tmp/DEBIAN/preinst: debian/$(paket).preinst
78         cp debian/$(paket).preinst debian/tmp/DEBIAN/preinst
79
80 debian/tmp/DEBIAN/postinst: debian/$(paket).postinst
81         cp debian/$(paket).postinst debian/tmp/DEBIAN/postinst
82
83 debian/tmp/DEBIAN/prerm: debian/$(paket).prerm
84         cp debian/$(paket).prerm debian/tmp/DEBIAN/prerm
85
86 debian/tmp/DEBIAN/postrm: debian/$(paket).postrm
87         cp debian/$(paket).postrm debian/tmp/DEBIAN/postrm
88
89 # Load project specification
90 -include rules.post
91
92 # if debian/control is missing, try old mbuild way
93 #debian/control:
94 #       if [ -e  debian/$(paket).control ]; then echo "trallala"; fi
95