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