X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=Makefile;h=b12ee7038b1dc179de338f9ac918ff2acaaf6cc4;hb=24b5f1e505939533fc65369fce4bae70fd2a2862;hp=4e2a9cce206c1e52ac5376a41a68f1f523075f2e;hpb=4796e2275dab7a87639758084db9f01221c539a5;p=rrq%2Foverlay-boot.git diff --git a/Makefile b/Makefile index 4e2a9cc..b12ee70 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,70 @@ -SBINDIR = $(DESTDIR)/usr/sbin -ETCDIR = $(DESTDIR)/etc/rrqnet -MAN1DIR = $(DESTDIR)/usr/share/man/man1 +ETCDIR = $(DESTDIR)/etc +INITDIR = $(DESTDIR)/etc/init.d MAN8DIR = $(DESTDIR)/usr/share/man/man8 +SBINDIR = $(DESTDIR)/usr/sbin VARLIBDIR = $(DESTDIR)/var/lib/overlay-boot -SBINCFILES = -#SBINFILES = overlay-boot overlay-go overlay-stop -ETCFILES = -MAN1FILES = -MAN8FILES = overlay-boot.8 overlay-go.8 overlay-stop.8 -HTMLDOC = $(MAN8FILES:%=%.html) +MAN8FILES = overlay-boot.8 overlay-go.8 overlay-stop.8 overlay-diskfile.8 VARLIBFILES = overlay-boot overlay-go overlay-stop functions reaper +VARLIBFILES += overlay-init overlay-postmount overlay-premount +VARLIBFILES += overlay-diskfile +INITFILES = subhosts +ETCFILES = subhosts.conf -all: asm/reaper +# The default is to build asm/reaper +REAPER = src/reaper +all: $(REAPER) -asm/reaper: - $(MAKE) -C asm reaper +# Specific rule: $(REAPER) is ensured by "recursive make" +$(REAPER): + $(MAKE) -C $$(dirname $(REAPER)) reaper -overlay-boot.8: README.adoc - a2x -d manpage -f manpage $^ +# Specific rule: the reaper program originates from $(REAPER) +reaper: $(REAPER) + mv $< $@ -$(addprefix $(MAN8DIR)/,$(MAN8FILES)): overlay-boot.8 | $(MAN8DIR)/ +# Specific rule: the sysvinit init file +$(INITDIR)/subhosts: subhosts.sh | $(INITDIR)/ cp $< $@ -$(MAN8DIR)/ $(VARLIBDIR)/: +# Specific rule: the sysvinit init configuration file +$(ETCDIR)/subhosts.conf: subhosts.conf | $(ETCDIR)/ + cp $< $@ + +# Generic rule: any dependee directory needs to be created +%/: mkdir -p $@ +# Generic rule: a local .8 file depends on the same .8.adoc file, if any +$(MAN8FILES): %: %.adoc + a2x -d manpage -f manpage $^ + +# Generic rule: an installed MAN8FILE file depends on a local the +# same, and that the installation directory exists +$(addprefix $(MAN8DIR)/,$(MAN8FILES)): $(MAN8DIR)/%: % | $(MAN8DIR)/ + cp $< $@ + +# Generic rule: an installed VARLIBFILES file depends on a local the +# same, and that the installation directory exists $(addprefix $(VARLIBDIR)/,$(VARLIBFILES)): $(VARLIBDIR)/%: % | $(VARLIBDIR)/ cp -p $< $@ -$(VARLIBDIR)/reaper: asm/reaper -# cp $< $@ - +# Make target: to clean up this workspace clean: - rm -f reaper overlay-boot.8 asm/reaper - dh_clean -d + rm -f reaper *.8 + make -C $$(dirname $(REAPER)) clean + +.INTERMEDIATE: reaper $(MAN8FILES) -INSTALLTARGETS = $(addprefix $(SBINDIR)/,$(SBINFILES)) -INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES)) -INSTALLTARGETS += $(addprefix $(MAN1DIR)/,$(MAN1FILES)) +# Make target: enumerates that which should be installed INSTALLTARGETS += $(addprefix $(MAN8DIR)/,$(MAN8FILES)) INSTALLTARGETS += $(addprefix $(VARLIBDIR)/,$(VARLIBFILES)) +INSTALLTARGETS += $(addprefix $(INITDIR)/,$(INITFILES)) install: $(INSTALLTARGETS) +# Make target: make a .deb file in ../ BUILDPACKAGE = -us -uc --build=full -Iolle deb: - PREFIX= INCLUDE_PREFIX=/usr dpkg-buildpackage $(BUILDPACKAGE) + dpkg-buildpackage $(BUILDPACKAGE) +# PREFIX= INCLUDE_PREFIX=/usr