From 5fe3f2b030d1bc928ab9458b881e342fa2b2a6c1 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Mon, 17 Apr 2023 00:46:06 +1000 Subject: [PATCH] Cleanup of build scripting --- Makefile | 25 ++++++++++++++----------- lsplib.mk | 14 ++++++++++++++ manpage.mk | 2 ++ 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 lsplib.mk create mode 100644 manpage.mk diff --git a/Makefile b/Makefile index 1c3e94c..c9f3cef 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,21 @@ +# Building archives and the test0 app + +PACKNL = ${HOME}/src/borta/packnl/packnl LSPSRC = lsp-dbus-test.lsp +ARCHIVES = lsp-misc.a lsp-dbus.a +DOCS = lsp-dbus.a.8 lsp-misc.a.8 -## Library -LSPLIB = lsp-dbus.a +default: test0 docs -LSP_MISC = foop.lsp misc.lsp -LSPLIBSRC += $(addprefix lsp-misc/,${LSP_MISC}) +include manpage.mk +include lsplib.mk -LSP_DBUS = lsp-dbus-connection.lsp lsp-dbus.lsp lsp-dbus-marshal.lsp -LSP_DBUS += lsp-dbus-events.lsp -LSPLIBSRC += $(addprefix lsp-dbus/,${LSP_DBUS}) +.PHONY: docs +docs: ${DOCS} -test0: lsp-dbus-test.lsp ${LSPLIB} - ${HOME}/src/borta/packnl/packnl -w $@ $^ -A ${LSPLIB} +test0: lsp-dbus-test.lsp ${ARCHIVES} + ${PACKNL} -w $@ $< $(addprefix -A ,${ARCHIVES}) -${LSPLIB}: ${LSPLIBSRC} - ar r $@ $^ +clean: + rm -f test0 ${CLEAN} diff --git a/lsplib.mk b/lsplib.mk new file mode 100644 index 0000000..c1871cb --- /dev/null +++ b/lsplib.mk @@ -0,0 +1,14 @@ +# This is a Makefile include file for build ar archives as declared in +# the $(ARCHIVES) variable. Each archive is build by including all +# .lsp files in the same named subdirectory. E.g. lib-misc.a contains +# the files lib-misc/*.lsp + +# The following defines a Makefile block for archive building +define archive +$1: $$(wildcard ${1:.a=}/*.lsp) + ar r $$@ $$^ +CLEAN += $1 +endef + +# The following command generates the archive building blocks +$(foreach F,${ARCHIVES},$(eval $(call archive,$F))) diff --git a/manpage.mk b/manpage.mk new file mode 100644 index 0000000..071f31f --- /dev/null +++ b/manpage.mk @@ -0,0 +1,2 @@ +%.8: %.8.adoc + asciidoctor -b manpage $< -- 2.39.2