8c57576987d360f7bb4a46008fed41a11149b9bc
[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 $(oldpack) debian/tmp
8 INSERT_BUILD = /usr/share/mbuild/insert_build.sh
9 RSYNC_OPT = -av --exclude="build" --exclude="debian/tmp" --exclude="Packages" --exclude=".*"
10
11 include debian/rules.pre
12
13 default:
14         echo "no default rule available"
15
16 # Löschen aller kompilierten, erzeugten und nicht benötigten Dateien im Bauverzeichnis
17 clean:
18         -rm -rf debian/tmp
19
20 # Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis
21 build: debian/$(paket).build prebuild
22         cd ../build ; debian/$(paket).build
23         # Build succeeded
24
25 pack: $(PACK)
26         # packing succeeded
27
28 # Bauen der kompilierten architekturabhängigen Programme aus den Quellen im Bauverzeichnis
29 build-arch:
30
31 # Bauen der architekturunabhängigen formatierten Dokumente aus den Quellen im Bauverzeichnis
32 build-indep:
33
34 # 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)
35 install: 
36
37 # Erstellen aller Binärpakete (effektiv ist dies die Kombination der binary-arch- und binary-indep-Ziele)
38 binary: binary-arch binary-indep 
39
40 # Erstellen Architektur-abhängiger (Architecture: any) Binärpakete im übergeordneten Verzeichnis
41 binary-arch: $(BINARY_ARCH)
42
43 # Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis
44 binary-indep: $(BINARY_INDEP)
45
46 #copy ../$(paket)_$(version)-$(build)_all.deb
47
48 version: ~/build/$(TARGET)
49         $(INSERT_BUILD) ~/build/$(TARGET) $(build)
50         cp ~/build/*$(build)* ../
51
52 ../build:
53         mkdir ../build
54
55 sync: ../build
56         rsync $(RSYNC_OPT) ./ ../build/
57
58 ../build/cmake_check:
59         /usr/share/mbuild/cmake_check
60         touch ../build/cmake_check
61
62 prebuild: sync ../build/cmake_check
63         cd ../build ; if [ -x debian/$(paket).prebuild ]; then debian/$(paket).prebuild; fi
64
65 copy: debian/$(paket).cp
66         debian/$(paket).cp debian/tmp
67
68 ../$(paket)_$(version)-$(build)_$(arch).deb:debian/tmp/DEBIAN/control $(add_inst_tgt)
69         $(DEB)
70         mv debian/tmp.deb ../$(paket)_$(version)-$(build)_$(arch).deb
71
72 debian/tmp/DEBIAN/control: debian/control debian/changelog
73         dpkg-gencontrol
74
75 debian/control: debian/$(paket).control
76         sed "s/_DEB_HOST_ARCH/${DEB_HOST_ARCH}/" debian/$(paket).control >> debian/control
77
78 debian/changelog: debian/$(paket).changelog debian/rules.pre
79         sed "s/%BUILD%/$(build)/" debian/$(paket).changelog > debian/changelog
80 #       echo "${pwd} (${build}) unstable; urgency=medium" > debian/changelog
81 #       echo "  * generated by mbuild" >> debian/changelog
82 #       echo " -- Michael Wagner <info@wagnertech.de>  Sun, 11 Feb 2018 20:03:04 +0100" >> debian/changelog
83 #       mb_create_changelog
84
85 debian/tmp/DEBIAN/preinst: debian/$(paket).preinst
86         cp debian/$(paket).preinst debian/tmp/DEBIAN/preinst
87
88 debian/tmp/DEBIAN/postinst: debian/$(paket).postinst
89         cp debian/$(paket).postinst debian/tmp/DEBIAN/postinst
90
91 debian/tmp/DEBIAN/prerm: debian/$(paket).prerm
92         cp debian/$(paket).prerm debian/tmp/DEBIAN/prerm
93
94 debian/tmp/DEBIAN/postrm: debian/$(paket).postrm
95         cp debian/$(paket).postrm debian/tmp/DEBIAN/postrm
96
97 # Load project specification
98 -include rules.post
99
100 # if debian/control is missing, try old mbuild way
101 #debian/control:
102 #       if [ -e  debian/$(paket).control ]; then echo "trallala"; fi
103