From a4fc27633977957f8d4fa7b52ab3ea89f9941a34 Mon Sep 17 00:00:00 2001 From: Ivan Polyakov Date: Fri, 7 Jan 2022 20:03:52 +0300 Subject: [PATCH] patching system --- Makefile | 21 ++++++++++++++++----- config.mk | 5 +++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 4d49649..ffe8f5c 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,8 @@ options: @echo "LDFLAGS = $(STLDFLAGS)" @echo "CC = $(CC)" -config.h: - cp config.def.h config.h +config.h: patch + cp config.def.h $@ .c.o: $(CC) $(STCFLAGS) -c $< @@ -29,8 +29,8 @@ $(OBJ): config.h config.mk st: $(OBJ) $(CC) -o $@ $(OBJ) $(STLDFLAGS) -clean: - rm -f st $(OBJ) st-$(VERSION).tar.gz config.h +clean: restore + rm -f st $(OBJ) st-$(VERSION).tar.gz config.h *.rej *.orig dist: clean mkdir -p st-$(VERSION) @@ -54,4 +54,15 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/st rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 -.PHONY: all options clean dist install uninstall +backup: + find . -iname '*.[ch]' -exec sh -c 'cp $$0 $$0.backup' {} \; + +restore: + find . -iname '*.backup' \ + -exec sh -c 'mv $$0 "$${0%.backup}"' {} \; + +patch: backup + find ${PATCHESDIR} -iname '*.diff' -exec sh -c 'patch < $$0' {} \; + +.PHONY: all options clean dist install uninstall backup patch restore + diff --git a/config.mk b/config.mk index 973e7c2..aa38291 100644 --- a/config.mk +++ b/config.mk @@ -4,8 +4,9 @@ VERSION = 0.8.5 # Customize below to fit your system # paths -PREFIX = /usr/local -MANPREFIX = $(PREFIX)/share/man +PREFIX = /usr/local +MANPREFIX = $(PREFIX)/share/man +PATCHESDIR = patches X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib