X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=Makefile;h=c099771b5436a1a81771a935d40802bfab1a3c44;hb=beb4a86d87d31c5de21661ab9f4c7bbc7c3b54fd;hp=aee4b759a6d4f50e93db971d8a67a3df95853497;hpb=c41e4d944252a03eb80c9f3a1b8939562c4f5453;p=rrq%2Foverlay-boot.git diff --git a/Makefile b/Makefile index aee4b75..c099771 100644 --- a/Makefile +++ b/Makefile @@ -1,49 +1,71 @@ -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 $@ -reaper: asm/reaper - cp -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 $< $@ +# 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 -INSTALLTARGETS = $(addprefix $(SBINDIR)/,$(SBINFILES)) -INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES)) -INSTALLTARGETS += $(addprefix $(MAN1DIR)/,$(MAN1FILES)) +.INTERMEDIATE: reaper $(MAN8FILES) + +# Make target: enumerates that which should be installed INSTALLTARGETS += $(addprefix $(MAN8DIR)/,$(MAN8FILES)) INSTALLTARGETS += $(addprefix $(VARLIBDIR)/,$(VARLIBFILES)) +INSTALLTARGETS += $(addprefix $(INITDIR)/,$(INITFILES)) +INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES)) 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