X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=Makefile;h=e6fd7e061f213c14e94ab1eb8a884f3dc198f2a1;hb=3c44db499dfa95b80385eda3bbdbb6a63d28afb8;hp=a8e045c2e755673d1aa28062684c2096db4ef818;hpb=32d58d6a681c6800feb89500f1d3776320c58359;p=dss.git diff --git a/Makefile b/Makefile index a8e045c..e6fd7e0 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,76 @@ +# 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) INSTALL_DATA ?= $(INSTALL) -m 644 MKDIR_P := mkdir -p +VERSION := $(shell ./version-gen.sh $(PACKAGE) version.c) +RM := rm -f +LSG := lopsubgen +GROFF := groff -m man -Thtml -P -l -P -r +GZIP := gzip -cfn9 +units := $(PACKAGE) $(PACKAGE).lsg str file exec sig daemon df tv snap ipc version +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)" +objs := $(addsuffix .o, $(units)) +deps := $(addsuffix .d, $(units)) +all := $(PACKAGE) $(PACKAGE).1.gz -VERSION_STRING = 0.1.7 - -dss_objects := dss.o str.o file.o exec.o sig.o daemon.o df.o tv.o snap.o ipc.o dss.lsg.o -all: dss dss.1 -man: dss.1 +all: $(all) +man: $(PACKAGE).1.gz +$(objs): $(PACKAGE).lsg.h Makefile +-include $(deps) -DSS_CPPFLAGS := -DVERSION_STRING='"$(VERSION_STRING)"' DSS_CPPFLAGS += -Wunused-macros DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef @@ -26,32 +86,47 @@ DSS_CFLAGS += -Wunused-parameter DSS_CFLAGS += -Wbad-function-cast DSS_CFLAGS += -Wshadow -Makefile.deps: $(wildcard *.c *.h) - $(CC) -MM -MG $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) *.c > $@ - --include Makefile.deps - -dss: $(dss_objects) - $(CC) -o $@ $(dss_objects) $(LDFLAGS) -llopsub - -%.o: %.c Makefile - $(CC) -c $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) $< - -%.png: %.dia - dia -e $@ -t png $< - +.ONESHELL: +.SHELLFLAGS := -ec +ifeq ("$(origin V)", "command line") + SAY = +else + SAY = @printf '%s\n' '$(strip $(1))' +endif +version.c: + $(call SAY, VG $@) + ./version-gen.sh $(PACKAGE) version.c > /dev/null +$(PACKAGE): $(objs) + $(call SAY, LD $@) + $(CC) -o $@ $(objs) $(LDFLAGS) -llopsub +%.o: %.c + $(call SAY, CC $<) + $(CC) -c -o $@ $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) \ + -MMD -MF $(*F).d -MT $@ $< +.PHONY: all clean install README +.PRECIOUS: %.lsg.c %.lsg.h %.suite %.1 +$(PACKAGE).suite: $(PACKAGE).suite.m4 Makefile + $(call SAY, M4 $<) + $(M4) $< > $@ %.lsg.h: %.suite - lopsubgen --gen-h=$@ < $< + $(call SAY, LSGH $<) + $(LSG) --gen-h=$@ < $< %.lsg.c: %.suite - lopsubgen --gen-c=$@ < $< + $(call SAY, LSGC $<) + $(LSG) --gen-c=$@ < $< %.1: %.suite - lopsubgen --gen-man=$@ --version-string=$(VERSION_STRING) < $< - + $(call SAY, LSGM $<) + $(LSG) --gen-man=$@ --version-string=$(VERSION) < $< +%.1.gz: %.1 + $(call SAY, GZIP $<) + $(GZIP) < $< > $@ %.1.html: %.1 - groff -m man -Thtml -P -l -P -r $< | sed -e '1,/^/d; /^<\/body>/,$$d' > $@ - + $(call SAY, GROFF $<) + $(GROFF) $< > $@ clean: - rm -f *.o dss dss.1 dss.1.html Makefile.deps *.png *~ index.html dss.lsg.h dss.lsg.c + $(call SAY, CLEAN) + $(RM) *.[od] $(all) *.html $(PACKAGE).1 $(PACKAGE).suite \ + $(PACKAGE).lsg.[ch] version.c ifneq ($(findstring strip, $(MAKECMDGOALS)),) strip_option := -s @@ -60,16 +135,32 @@ bindir := $(DESTDIR)$(PREFIX)/bin mandir := $(DESTDIR)$(PREFIX)/share/man/man1 install install-strip: all $(MKDIR_P) $(bindir) $(mandir) - $(INSTALL_PROGRAM) $(strip_option) dss $(bindir) - $(INSTALL_DATA) dss.1 $(mandir) + $(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)" + +index.html: index.html.m4 Makefile + $(call SAY, M4 $@) + $(M4) $< > $@ -index.html: dss.1.html index.html.in INSTALL README NEWS - sed -e '/@README@/,$$d' index.html.in > $@ - markdown README >> $@ - sed -e '1,/@README@/d' -e '/@NEWS@/,$$d' index.html.in >> $@ - markdown NEWS >> $@ - sed -e '1,/@NEWS@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@ - markdown INSTALL >> $@ - sed -e '1,/@INSTALL@/d' -e '/@MAN_PAGE@/,$$d' index.html.in >> $@ - cat dss.1.html >> $@ - sed -e '1,/@MAN_PAGE@/d' index.html.in >> $@ +-include Makefile.local