7fadac917987682217a7bac0da09b6be8fa783af
[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 COPY = $(NOP)
8 ZIP = zip -r $(project).zip $(project)
9 DEB = fakeroot dpkg-deb --build $(project)
10
11 #default parameters
12 project = default
13 SOURCES =
14 COPY_PRE =
15 TEX = pdflatex
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.stamp
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
45 compile.stamp: $(SOURCES)
46         $(COMPILE)
47         @touch compile.stamp
48
49 #-----------------------------------------------------------------
50 # pack steps
51 #-----------------------------------------------------------------
52
53 copy.stamp: $(COPY_PRE)
54         $(COPY) $(project)
55         @touch copy.stamp
56
57 control.stamp: $(project).control
58         mkdir -p $(project)/DEBIAN
59         cp $(project).control $(project)/DEBIAN/control
60         if [ -f $(project).postinst ]; then cp $(project).postinst $(project)/DEBIAN/postinst; fi
61         @touch control.stamp
62
63 $(project).zip: copy.stamp $(project)
64         $(ZIP)
65
66 $(project).deb: copy.stamp control.stamp
67         $(DEB)
68         cp $(project).deb $(project)_$(version).deb
69
70 #-----------------------------------------------------------------
71 # utilities
72 #-----------------------------------------------------------------
73 clean:
74         -rm *.stamp 2>/dev/null
75         if [ -e $(project).zip ]; then rm $(project).zip; fi
76         if [ -e $(project) ]; then rm -rf $(project); fi
77
78 #-----------------------------------------------------------------
79 # generische Regeln
80 #-----------------------------------------------------------------
81 %.pdf:%.tex
82         $(TEX) $<
83
84 -include make.post