D12-Anpassung
[projects.git] / tools / make / makefile
1 # Generic makefile for mBuild build process
2
3 # defile default operations
4
5 NOP = @echo "No operation for target $@"
6 COMPILE = $(NOP)
7 COMPILE_TARGET = compile.stamp
8 COPY = $(NOP)
9 ZIP = zip -r $(project).zip $(project)
10 DEB = fakeroot dpkg-deb --build $(project)
11 INSERT_BUILD = projects/tools/make/insert_build.sh
12
13 #default parameters
14 project = default
15 SOURCES =
16 COPY_PRE =
17
18 # Load project specification
19 include make.pre
20
21 .SUFFIXES: .stamp .zip
22
23
24 #-----------------------------------------------------------------
25 # Hauptziele:
26 #
27 #               : ohne Parameter wird compiliert
28 # - zip         : packt ZIP file
29 # - deb         : packt Debian package
30 #
31 #-----------------------------------------------------------------
32
33 compile: $(COMPILE_TARGET)
34         # compile is ready
35
36 zip: $(project).zip
37         # ZIP file ready
38
39 deb: $(project).deb
40         # Debian package ready
41
42 version: $(COMPILE_TARGET)
43         $(INSERT_BUILD) $(COMPILE_TARGET) $(build)
44
45 #-----------------------------------------------------------------
46 # compile steps
47 #-----------------------------------------------------------------
48 compile.stamp: $(SOURCES)
49         $(COMPILE)
50         @touch compile.stamp
51
52 #-----------------------------------------------------------------
53 # pack steps
54 #-----------------------------------------------------------------
55
56 copy.stamp: $(COPY_PRE)
57         $(COPY) $(project) $(version) ${arch}
58         @touch copy.stamp
59
60 control.stamp: $(project).control
61         mkdir -p $(project)/DEBIAN
62         cp $(project).control $(project)/DEBIAN/control
63         if [ -f $(project).preinst ]; then cp $(project).preinst $(project)/DEBIAN/preinst; fi
64         if [ -f $(project).postinst ]; then cp $(project).postinst $(project)/DEBIAN/postinst; fi
65         if [ -f $(project).prerm ]; then cp $(project).prerm $(project)/DEBIAN/prerm; fi
66         if [ -f $(project).postrm ]; then cp $(project).postrm $(project)/DEBIAN/postrm; fi
67         @touch control.stamp
68
69 $(project).zip: copy.stamp $(project)
70         $(ZIP)
71
72 $(project).deb: copy.stamp control.stamp
73         $(DEB)
74         cp $(project).deb $(project)_$(version)$(_arch).deb
75
76 #-----------------------------------------------------------------
77 # utilities
78 #-----------------------------------------------------------------
79 clean:
80         -rm *.stamp 2>/dev/null
81         if [ -e $(project).zip ]; then rm $(project).zip; fi
82         if [ -e $(project) ]; then rm -rf $(project); fi
83
84 #-----------------------------------------------------------------
85 # Build-Regeln
86 #-----------------------------------------------------------------
87 %.pdf : %.tex $(SOURCES)
88         pdflatex $< && pdflatex $<
89
90