From b55df2367170f6f30d2d95d518626d7a2ef06333 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Thu, 31 Mar 2022 08:50:25 +1100 Subject: [PATCH] using C reaper with musl-gcc --- Makefile | 61 +++++++++++++++++++++++++++++++------------------- debian/control | 2 +- src/Makefile | 1 + 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 4b77ede..8636bf6 100644 --- a/Makefile +++ b/Makefile @@ -1,50 +1,65 @@ SBINDIR = $(DESTDIR)/usr/sbin -ETCDIR = $(DESTDIR)/etc/rrqnet -MAN1DIR = $(DESTDIR)/usr/share/man/man1 +#ETCDIR = $(DESTDIR)/etc/overlay +#MAN1DIR = $(DESTDIR)/usr/share/man/man1 MAN8DIR = $(DESTDIR)/usr/share/man/man8 VARLIBDIR = $(DESTDIR)/var/lib/overlay-boot -SBINCFILES = +#SBINCFILES = #SBINFILES = overlay-boot overlay-go overlay-stop -ETCFILES = -MAN1FILES = +# The SBINFILES are installed via links; see debian/overlay-boot.links +#ETCFILES = +#MAN1FILES = MAN8FILES = overlay-boot.8 overlay-go.8 overlay-stop.8 -HTMLDOC = $(MAN8FILES:%=%.html) +#HTMLDOC = $(MAN8FILES:%=%.html) VARLIBFILES = overlay-boot overlay-go overlay-stop functions reaper VARLIBFILES += overlay-init overlay-postmount overlay-premount -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 $^ - -$(addprefix $(MAN8DIR)/,$(MAN8FILES)): overlay-boot.8 | $(MAN8DIR)/ - cp $< $@ +# Specific rule: the reaper program originates from $(REAPER) +reaper: $(REAPER) + cp -p $< $@ -$(MAN8DIR)/ $(VARLIBDIR)/: +# 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 + rm -f reaper overlay-boot.8 + make -C $$(dirname $(REAPER)) clean dh_clean -d -INSTALLTARGETS = $(addprefix $(SBINDIR)/,$(SBINFILES)) -INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES)) -INSTALLTARGETS += $(addprefix $(MAN1DIR)/,$(MAN1FILES)) +# Make target: enumerates that which should be installed +#INSTALLTARGETS = $(addprefix $(SBINDIR)/,$(SBINFILES)) +#INSTALLTARGETS += $(addprefix $(ETCDIR)/,$(ETCFILES)) +#INSTALLTARGETS += $(addprefix $(MAN1DIR)/,$(MAN1FILES)) INSTALLTARGETS += $(addprefix $(MAN8DIR)/,$(MAN8FILES)) INSTALLTARGETS += $(addprefix $(VARLIBDIR)/,$(VARLIBFILES)) - 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 diff --git a/debian/control b/debian/control index 20c0c21..ae3ce67 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Ralph Ronnquist Build-Depends: debhelper-compat (= 13), asciidoc, docbook-xml, libxslt1-dev, xsltproc, docbook-xsl, - fasm + musl-tools Standards-Version: 4.6.0 Homepage: https://borta.rrq.id.au/git?p=ralph/overlay-boot.git Vcs-Git: https://borta.rrq.id.au/git?p=ralph/overlay-boot.git diff --git a/src/Makefile b/src/Makefile index 7567e7b..275275e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,6 +8,7 @@ CFLAGS = -Wall -static -O3 -flto reaper: reaper.c $(CC) $(CFLAGS) -o $@ $^ + strip $@ clean: rm -f reaper -- 2.39.2