diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f8c0fc --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# dist +dwm +*.tar* + +# generated files +config.h + +# patch +*.unpatched +*.orig +*.rej diff --git a/Makefile b/Makefile index cb4c969..072385c 100644 --- a/Makefile +++ b/Makefile @@ -20,14 +20,14 @@ options: ${OBJ}: config.h config.mk -config.h: +config.h: patch cp config.def.h $@ -dwm: ${OBJ} patch +dwm: ${OBJ} ${CC} -o $@ ${OBJ} ${LDFLAGS} -clean: - rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz +clean: restore + rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz *.rej $.orig dist: clean mkdir -p dwm-${VERSION} @@ -49,7 +49,14 @@ uninstall: rm -f ${DESTDIR}${PREFIX}/bin/dwm\ ${DESTDIR}${MANPREFIX}/man1/dwm.1 -patch: patches/*.diff +orig: + find . -iname '*.[ch]' -exec sh -c 'cp $$0 $$0.unpatched' {} \; + +restore: + find . -iname '*.unpatched' \ + -exec sh -c 'mv $$0 "$${0%.unpatched}"' {} \; + +patch: orig find ${PATCHESDIR} -iname '*.diff' -exec sh -c 'patch < $$0' {} \; -.PHONY: all options clean dist install uninstall +.PHONY: all options clean dist install uninstall orig patch restore