spelling
[rrq/overlay-boot.git] / Makefile
1 ETCDIR = $(DESTDIR)/etc
2 INITDIR = $(DESTDIR)/etc/init.d
3 MAN8DIR = $(DESTDIR)/usr/share/man/man8
4 SBINDIR = $(DESTDIR)/usr/sbin
5 VARLIBDIR = $(DESTDIR)/var/lib/overlay-boot
6
7 MAN8FILES = overlay-boot.8 overlay-go.8 overlay-stop.8 overlay-diskfile.8
8 VARLIBFILES = overlay-boot overlay-go overlay-stop functions reaper
9 VARLIBFILES += overlay-init overlay-postmount overlay-premount
10 VARLIBFILES += overlay-diskfile
11 INITFILES = subhosts
12 ETCFILES = subhosts.conf
13
14 # The default is to build asm/reaper
15 REAPER = src/reaper
16 all: $(REAPER)
17
18 # Specific rule: $(REAPER) is ensured by "recursive make"
19 $(REAPER): 
20         $(MAKE) -C $$(dirname $(REAPER)) reaper
21
22 # Specific rule: the reaper program originates from $(REAPER)
23 reaper: $(REAPER)
24         mv $< $@
25
26 # Specific rule: the sysvinit init file
27 $(INITDIR)/subhosts: subhosts.sh | $(INITDIR)/
28         cp $< $@
29
30 # Specific rule: the sysvinit init configuration file
31 $(ETCDIR)/subhosts.conf: subhosts.conf | $(ETCDIR)/
32         cp $< $@
33
34 # Generic rule: any dependee directory needs to be created
35 %/:
36         mkdir -p $@
37
38 # Generic rule: a local .8 file depends on the same .8.adoc file, if any
39 $(MAN8FILES): %: %.adoc
40         a2x -d manpage -f manpage $^
41
42 # Generic rule: an installed MAN8FILE file depends on a local the
43 # same, and that the installation directory exists
44 $(addprefix $(MAN8DIR)/,$(MAN8FILES)): $(MAN8DIR)/%: % | $(MAN8DIR)/
45         cp $< $@
46
47 # Generic rule: an installed VARLIBFILES file depends on a local the
48 # same, and that the installation directory exists
49 $(addprefix $(VARLIBDIR)/,$(VARLIBFILES)): $(VARLIBDIR)/%: % | $(VARLIBDIR)/
50         cp -p $< $@
51
52 # Make target: to clean up this workspace
53 clean:
54         rm -f reaper *.8
55         make -C $$(dirname $(REAPER)) clean
56
57 .INTERMEDIATE: reaper $(MAN8FILES)
58
59 # Make target: enumerates that which should be installed
60 INSTALLTARGETS += $(addprefix $(MAN8DIR)/,$(MAN8FILES))
61 INSTALLTARGETS += $(addprefix $(VARLIBDIR)/,$(VARLIBFILES))
62 INSTALLTARGETS += $(addprefix $(INITDIR)/,$(INITFILES))
63 INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES))
64
65 install: $(INSTALLTARGETS)
66
67 # Make target: make a .deb file in ../
68 BUILDPACKAGE = -us -uc --build=full -Iolle
69 deb:
70         dpkg-buildpackage $(BUILDPACKAGE)
71 #       PREFIX= INCLUDE_PREFIX=/usr