6513f24e4b201839291ed5b4d77e7acaf09d6abf
[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
12 #default parameters
13 project = default
14 SOURCES =
15 COPY_PRE =
16
17 # Load project specification
18 include make.pre
19
20 .SUFFIXES: .stamp .zip
21
22
23 #-----------------------------------------------------------------
24 # Hauptziele:
25 #
26 #               : ohne Parameter wird compiliert
27 # - zip         : packt ZIP file
28 # - deb         : packt Debian package
29 #
30 #-----------------------------------------------------------------
31
32 compile: $(COMPILE_TARGET)
33         # compile ist fertig
34
35 zip: $(project).zip
36         # ZIP file ready
37
38 deb: $(project).deb
39         # Debian package ready
40
41 #-----------------------------------------------------------------
42 # compile steps
43 #-----------------------------------------------------------------
44 compile.stamp: $(SOURCES)
45         $(COMPILE)
46         @touch compile.stamp
47
48 #-----------------------------------------------------------------
49 # pack steps
50 #-----------------------------------------------------------------
51
52 copy.stamp: $(COPY_PRE)
53         $(COPY) $(project)
54         @touch copy.stamp
55
56 control.stamp: $(project).control
57         mkdir -p $(project)/DEBIAN
58         cp $(project).control $(project)/DEBIAN/control
59         if [ -f $(project).postinst ]; then cp $(project).postinst $(project)/DEBIAN/postinst; fi
60         @touch control.stamp
61
62 $(project).zip: copy.stamp $(project)
63         $(ZIP)
64
65 $(project).deb: copy.stamp control.stamp
66         $(DEB)
67         cp $(project).deb $(project)_$(version)$(_arch).deb
68
69 #-----------------------------------------------------------------
70 # utilities
71 #-----------------------------------------------------------------
72 clean:
73         -rm *.stamp 2>/dev/null
74         if [ -e $(project).zip ]; then rm $(project).zip; fi
75         if [ -e $(project) ]; then rm -rf $(project); fi
76
77 #-----------------------------------------------------------------
78 # Build-Regeln
79 #-----------------------------------------------------------------
80 %.pdf : %.tex $(SOURCES)
81         pdflatex $<
82