X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=Makefile;h=462aba79c1eb02ab47cb880a679a1e2e8e94f97c;hb=79a45b09f07d14dbf231f1485d13661a59ab0460;hp=55f9e3c66750629ea2d0baaf826c57bdd8a00868;hpb=d174ceb61c3de4cf4bb181b071c8becd9d68f6f0;p=dss.git diff --git a/Makefile b/Makefile index 55f9e3c..462aba7 100644 --- a/Makefile +++ b/Makefile @@ -1,45 +1,182 @@ -dss_objects := cmdline.o dss.o string.o fd.o exec.o signal.o daemon.o df.o time.o -all: dss -man: dss.1 +# SPDX-License-Identifier: GPL-2.0 -DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W -DEBUG_CPPFLAGS += -Wredundant-decls -CPPFLAGS += -Os -CPPFLAGS += -Wall -CPPFLAGS += -Wuninitialized -CPPFLAGS += -Wchar-subscripts -CPPFLAGS += -Wformat-security -CPPFLAGS += -Werror-implicit-function-declaration -CPPFLAGS += -Wmissing-format-attribute -CPPFLAGS += -Wunused-macros -CPPFLAGS += -Wbad-function-cast +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/ -Makefile.deps: $(wildcard *.c *.h) - gcc -MM -MG *.c > $@ +PREFIX ?= /usr/local +INSTALL ?= install +INSTALL_PROGRAM ?= $(INSTALL) +INSTALL_DATA ?= $(INSTALL) -m 644 +MKDIR_P := mkdir -p +B := build +VERSION := $(shell $(MKDIR_P) $(B) && ./version-gen.sh $(PACKAGE) $(B)/version.c) +RM := rm -f +LSG := lopsubgen +GROFF := groff -m man -Thtml -P -l -P -r +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)" +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))) +deps := $(objs:.o=.d) +all := $(PACKAGE) $(PACKAGE).1.gz +www := $(B)/index.html $(B)/$(PACKAGE).1.html --include Makefile.deps +all: $(all) +www: $(www) +man: $(PACKAGE).1.gz +$(objs): $(B)/$(PACKAGE).lsg.h Makefile +-include $(deps) -dss: $(dss_objects) - $(CC) $(CPPFLAGS) $(DEBUG_CPPFLAGS) -o $@ $(dss_objects) +DSS_CPPFLAGS += -Wunused-macros +DSS_CPPFLAGS += -I$(B) -%.o: %.c cmdline.h - $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $< +DSS_CFLAGS := -Wno-sign-compare -g -Wunused -Wundef +DSS_CFLAGS += -Wredundant-decls +DSS_CFLAGS += -Os +DSS_CFLAGS += -Wall +DSS_CFLAGS += -Wuninitialized +DSS_CFLAGS += -Wchar-subscripts +DSS_CFLAGS += -Wformat-security +DSS_CFLAGS += -Werror-implicit-function-declaration +DSS_CFLAGS += -Wmissing-format-attribute +DSS_CFLAGS += -Wunused-parameter +DSS_CFLAGS += -Wbad-function-cast +DSS_CFLAGS += -Wshadow -%.ppm: %.sk - sk2ppm $< > $@ -%.png: %.ppm - convert $< $@ +CC_CMD = $(CC) -c -o $@ $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) \ + -MMD -MF $(B)/$(*F).d -MT $@ $< -cmdline.c cmdline.h: dss.ggo - gengetopt --conf-parser < $< +.ONESHELL: +.SHELLFLAGS := -ec +ifeq ("$(origin V)", "command line") + SAY = +else + SAY = @printf '%s\n' '$(strip $(1))' +endif +$(B)/version.c: + $(call SAY, VG $@) + ./version-gen.sh $(PACKAGE) version.c > /dev/null +$(PACKAGE): $(objs) + $(call SAY, LD $@) + $(CC) -o $@ $(objs) $(LDFLAGS) -llopsub +$(B)/%.o: $(B)/%.c + $(call SAY, CC $<) + $(CC_CMD) +$(B)/%.o: %.c + $(call SAY, CC $<) + $(CC_CMD) -dss.1: dss - help2man -h --detailed-help -N ./$< > $@ +.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 + $(call SAY, M4 $<) + $(M4) $< > $@ +$(B)/%.lsg.h: $(B)/%.suite + $(call SAY, LSGH $<) + $(LSG) --gen-h=$@ < $< +$(B)/%.lsg.c: $(B)/%.suite + $(call SAY, LSGC $<) + $(LSG) --gen-c=$@ < $< +$(B)/%.1: $(B)/%.suite + $(call SAY, LSGM $<) + $(LSG) --gen-man=$@ --version-string=$(VERSION) < $< +%.1.gz: $(B)/%.1 + $(call SAY, GZIP $<) + $(GZIP) < $< > $@ +$(B)/%.1.html: $(B)/%.1 + $(call SAY, GROFF $<) + $(GROFF) $< > $@ +$(B)/index.html: index.html.m4 Makefile + $(call SAY, M4 $@) + $(M4) $< > $@ +clean: + $(call SAY, CLEAN) + $(RM) $(B)/*.o $(B)/*.d $(all) $(www) +distclean: clean + $(call SAY, DISTCLEAN) + $(RM) -r $(B) +maintainer-clean: distclean + $(call SAY, MAINTANER-CLEAN) + $(GIT) clean -dfqxe Makefile.local -%.1.html: %.1 - man2html $< > $@ +ifneq ($(findstring strip, $(MAKECMDGOALS)),) + strip_option := -s +endif +bindir := $(DESTDIR)$(PREFIX)/bin +mandir := $(DESTDIR)$(PREFIX)/share/man/man1 +install install-strip: all + $(MKDIR_P) $(bindir) $(mandir) + $(INSTALL_PROGRAM) $(strip_option) $(PACKAGE) $(bindir) + $(INSTALL_DATA) $(PACKAGE).1.gz $(mandir) -clean: - rm -f *.o dss dss.1 dss.1.html Makefile.deps *.ppm *.png *~ cmdline.c cmdline.h +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)" +-include Makefile.local