From: Andre Noll Date: Fri, 10 May 2024 22:33:40 +0000 (+0200) Subject: build: Move m4-only definitions to separate file. X-Git-Tag: v1.0.2~3 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=aca2809f441dbc5309a68b2f0494c0891d6a01ba;p=dss.git build: Move m4-only definitions to separate file. We currently pass a number of variables to m4 by specifying command line options of the form -D var=val. This approach makes the output of "make V=1" very verbose due to the three multi-line descriptions. To addresses this issue, introduce defs.m4 which contains one m4 macro definition for each former make variable. The end result should be identical. We tweak the M4 make variable to always read defs.m4 before the first regular input file so that the suite and the web page see the definitions. The third user of the former make variables is the README phony target. To convert this as well, we rename the README file to README.m4 and adjust the rule of the README phony target to run m4 on this file. Switch to saner m4 quoting characters while at it. --- diff --git a/Makefile b/Makefile index 6311395..df56e48 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 PACKAGE := dss -SLOGAN := the dyadic snapshot scheduler -define DESCRIPTION1 := - $(PACKAGE) maintains hardlink-based snapshots of a given directory on a - remote or local host using rsync's link-dest feature. The snapshots - are organized so that any snapshot can directly be deployed as an - (emergency) replacement for the primary system. -endef -define DESCRIPTION2 := - $(PACKAGE) is admin friendly: It is easy to configure and needs little - attention after the initial setup. In particular, no full, incremental - or differential backups need to be configured, and there is no database - to maintain. $(PACKAGE) is also user-friendly: Assuming the snapshot server - allows read-only user access over the network, users can restore - accidentically removed files without admin intervention, using their - favorite file browser to copy files from the snapshot directory back - to the primary system. -endef -define DESCRIPTION3 := - $(PACKAGE) keeps track of the age and the state of existing snapshots and - triggers snapshot creation and removal according to the configuration - settings. It tries to maintain a scheme where many recent snapshots - and few old snapshots exist, for example 16 snapshots newer than a - week, 8 snapshots between one and two weeks old, 4 snapshots between - two and three weeks old, and so on. -endef -AUTHOR := Andre Noll -EMAIL := maan@tuebingen.mpg.de -URL := https://people.tuebingen.mpg.de/maan/$(PACKAGE)/ -CLONE_URL := https://git.tuebingen.mpg.de/$(PACKAGE) -GITWEB_URL := https://git.tuebingen.mpg.de/$(PACKAGE).git -PACKAGE_HOMEPAGE := https://people.tuebingen.mpg.de/maan/$(PACKAGE)/ -HOME_URL := https://people.tuebingen.mpg.de/maan/ -LICENSE := GPL-2.0 -LICENSE_URL := https://www.gnu.org/licenses/ - PREFIX ?= /usr/local INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) @@ -48,21 +13,7 @@ LSG := lopsubgen GROFF := groff -m man -t -Thtml -P -l -P -r -P -I -P image GZIP := gzip -cfn9 GIT := git -M4 := m4 \ - -D "AUTHOR=$(AUTHOR)" \ - -D "PACKAGE=$(PACKAGE)" \ - -D "SLOGAN=$(SLOGAN)" \ - -D "EMAIL=$(EMAIL)" \ - -D "URL=$(URL)" \ - -D "CLONE_URL=$(CLONE_URL)" \ - -D "GITWEB_URL=$(GITWEB_URL)" \ - -D "HOME_URL=$(HOME_URL)" \ - -D "PACKAGE_HOMEPAGE=$(PACKAGE_HOMEPAGE)" \ - -D "LICENSE=$(LICENSE)" \ - -D "LICENSE_URL=$(LICENSE_URL)" \ - -D "DESCRIPTION1=$(DESCRIPTION1)" \ - -D "DESCRIPTION2=$(DESCRIPTION2)" \ - -D "DESCRIPTION3=$(DESCRIPTION3)" +M4 := m4 -D "PACKAGE=$(PACKAGE)" defs.m4 c_source := $(PACKAGE) str file exec sig daemon df tv snap ipc c_generated := $(B)/$(PACKAGE).lsg $(B)/version objs := $(addsuffix .o, $(c_generated) $(addprefix $(B)/, $(c_source))) @@ -117,7 +68,7 @@ $(B)/%.o: %.c .PHONY: all www clean distclean maintainer-clean install README .PRECIOUS: $(B)/%.lsg.c $(B)/%.lsg.h $(B)/%.suite $(B)/%.1 -$(B)/$(PACKAGE).suite: $(PACKAGE).suite.m4 Makefile +$(B)/$(PACKAGE).suite: $(PACKAGE).suite.m4 defs.m4 Makefile $(call SAY, M4 $<) $(M4) $< > $@ $(B)/%.lsg.h: $(B)/%.suite @@ -136,7 +87,7 @@ $(B)/%.1.html: $(B)/%.1 $(call SAY, GROFF $<) cd $(B) $(GROFF) ../$< > ../$@ -$(B)/index.html: index.html.m4 Makefile +$(B)/index.html: index.html.m4 Makefile defs.m4 dss.svg $(call SAY, M4 $@) $(M4) $< > $@ clean: @@ -159,25 +110,7 @@ install install-strip: all $(INSTALL_PROGRAM) $(strip_option) $(PACKAGE) $(bindir) $(INSTALL_DATA) $(PACKAGE).1.gz $(mandir) -define README := -$(PACKAGE) - $(SLOGAN) - -$(DESCRIPTION1) - -$(DESCRIPTION2) - -$(DESCRIPTION3) - -Resources -~~~~~~~~~ -web page: $(PACKAGE_HOMEPAGE) -git clone URL: $(CLONE_URL) -gitweb: $(GITWEB_URL) -author home page: $(HOME_URL) -report bugs to: $(AUTHOR) <$(EMAIL)> -endef - README: - @printf '%s\n' "$(README)" + @$(M4) README.m4 -include Makefile.local diff --git a/README b/README deleted file mode 100644 index 52a1fd7..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -Run "make README". diff --git a/README.m4 b/README.m4 new file mode 100644 index 0000000..2a716f1 --- /dev/null +++ b/README.m4 @@ -0,0 +1,16 @@ +dnl Run "make README" to see this with variables expanded. +PACKAGE() - SLOGAN() + +DESCRIPTION1() + +DESCRIPTION2() + +DESCRIPTION3() + +Resources +~~~~~~~~~ +project web page: PACKAGE_HOMEPAGE() +git clone CLONE_URL() +gitweb: GITWEB_URL() +author home page: HOME_URL() +report bugs to: AUTHOR() diff --git a/defs.m4 b/defs.m4 new file mode 100644 index 0000000..da2ad92 --- /dev/null +++ b/defs.m4 @@ -0,0 +1,39 @@ +divert(-1) +changequote(`«', `»') + +define(«SLOGAN», «the dyadic snapshot scheduler») +define(«AUTHOR», «Andre Noll») +define(«EMAIL», «maan@tuebingen.mpg.de») +define(«URL», «https://people.tuebingen.mpg.de/maan/PACKAGE()/») +define(«CLONE_URL», «https://git.tuebingen.mpg.de/PACKAGE()») +define(«GITWEB_URL», «https://git.tuebingen.mpg.de/PACKAGE().git») +define(«PACKAGE_HOMEPAGE», «https://people.tuebingen.mpg.de/maan/PACKAGE()/») +define(«HOME_URL», «https://people.tuebingen.mpg.de/maan/») +define(«LICENSE», «GPL-2.0») +define(«LICENSE_URL», «https://www.gnu.org/licenses») + +define(«DESCRIPTION1», «dnl +PACKAGE() maintains hardlink-based snapshots of a given directory on +a remote or local host using rsync's link-dest feature. The snapshots +are organized so that any snapshot can directly be deployed as an +(emergency) replacement for the primary system.») + +define(«DESCRIPTION2», «dnl +PACKAGE() is admin friendly: It is easy to configure and needs +little attention after the initial setup. In particular, no full, +incremental or differential backups need to be configured, and there is +no database to maintain. PACKAGE() is also user-friendly: Assuming the +snapshot server allows read-only user access over the network, users +can restore accidentically removed files without admin intervention, +using their favorite file browser to copy files from the snapshot +directory back to the primary system.») + +define(«DESCRIPTION3», «dnl +PACKAGE() keeps track of the age and the state of existing snapshots and +triggers snapshot creation and removal according to the configuration +settings. It tries to maintain a scheme where many recent snapshots +and few old snapshots exist, for example 16 snapshots newer than a +week, 8 snapshots between one and two weeks old, 4 snapshots between +two and three weeks old, and so on.») + +divert(0) diff --git a/dss.suite.m4 b/dss.suite.m4 index 26e7a44..27437f4 100644 --- a/dss.suite.m4 +++ b/dss.suite.m4 @@ -644,7 +644,7 @@ caption = Subcommands .UR URL() .UE .br - Git clone `URL': + Git clone «URL»: .UR CLONE_URL() .UE .br diff --git a/index.html.m4 b/index.html.m4 index 41c0075..52a424c 100644 --- a/index.html.m4 +++ b/index.html.m4 @@ -25,7 +25,7 @@ dnl SPDX-License-Identifier: GPL-2.0 - +
include(`dss.svg') include(«dss.svg»)

SLOGAN()