From 4c094dc57d110d61a81acb85541802bba6dbf1b6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Thu, 4 Sep 2014 04:46:15 +0200 Subject: [PATCH] Makefile: Add support for 'series' and 'install-git' target. --- debian/tools/Makefile.in | 58 +++++++++++++++++++++++++++++++++++----- patches/Makefile | 58 +++++++++++++++++++++++++++++++++++----- 2 files changed, 104 insertions(+), 12 deletions(-) diff --git a/debian/tools/Makefile.in b/debian/tools/Makefile.in index 3f554dce..d8acebd1 100644 --- a/debian/tools/Makefile.in +++ b/debian/tools/Makefile.in @@ -2,10 +2,21 @@ # This file is automatically generated, DO NOT EDIT! # -CURDIR ?= ${{.CURDIR}} -PATCH := $(CURDIR)/../debian/tools/gitapply.sh -APPLY := (cd $(DESTDIR) && $(PATCH)) -APPLY_FILE = @echo "Applying $(1)"; $(APPLY) < $(CURDIR)/$(1) +.NOTPARALLEL: + +CURDIR ?= ${{.CURDIR}} +PATCH := $(CURDIR)/../debian/tools/gitapply.sh +APPLY = (cd "$(DESTDIR)" && $(PATCH)) +APPLY_FILE = @echo "Applying $(1)"; $(APPLY) < "$(CURDIR)/$(1)" + +# +# This Makefile understands the following targets: +# +# install (default): apply patches to directory provided by DESTDIR +# install-git: as above, but use 'git am' to apply the patches +# series: create a 'series' file containing the patch order +# clean: delete autogenerated and temporary files +# PATCHLIST := \ {patchlist} @@ -16,9 +27,44 @@ install: $(PATCHLIST) cd $(DESTDIR) && autoreconf -f cd $(DESTDIR) && ./tools/make_requests +.PHONY: install-git +install-git: PATCH := git am +install-git: install + +series: APPLY_FILE = @echo "$(1)" >> series +series: $(PATCHLIST) + @cat *.ok | sort | $(CURDIR)/../debian/tools/patchlist.sh > patchlist.diff + @echo "patchlist.diff" >> series + @( \ + echo ""; \ + echo "The 'series' file was created in current directory. Please note that"; \ + echo "'patchlist.diff' is autogenerated based on your selection of patches and not"; \ + echo "included in this repository - keep in mind to update it on every release."; \ + echo ""; \ + echo "Moreover, depending on which patches you have selected, you will have to run"; \ + echo "'autoreconf -f' and/or './tools/make_requests' after applying them."; \ + echo ""; \ + binary=0; \ + while IFS= read -r line; do \ + if grep -q "^GIT binary patch" "$$line"; then \ + binary=1; break; \ + fi \ + done < series; \ + if [ "$$binary" -ne 0 ]; then \ + echo "The following files contain binary patches and cannot be applied with the"; \ + echo "regular 'patch' commandline tool:"; \ + echo ""; \ + while IFS= read -r line; do \ + grep -q "^GIT binary patch" "$$line" && echo "$$line"; \ + done < series; \ + echo ""; \ + echo "Please use 'git apply' or '../debian/tools/gitapply.sh' from this repository."; \ + echo ""; \ + fi \ + ) + .PHONY: clean clean: + rm -f series patchlist.diff rm -f *.ok -.NOTPARALLEL: - diff --git a/patches/Makefile b/patches/Makefile index 7573466e..63881075 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -2,10 +2,21 @@ # This file is automatically generated, DO NOT EDIT! # -CURDIR ?= ${.CURDIR} -PATCH := $(CURDIR)/../debian/tools/gitapply.sh -APPLY := (cd $(DESTDIR) && $(PATCH)) -APPLY_FILE = @echo "Applying $(1)"; $(APPLY) < $(CURDIR)/$(1) +.NOTPARALLEL: + +CURDIR ?= ${.CURDIR} +PATCH := $(CURDIR)/../debian/tools/gitapply.sh +APPLY = (cd "$(DESTDIR)" && $(PATCH)) +APPLY_FILE = @echo "Applying $(1)"; $(APPLY) < "$(CURDIR)/$(1)" + +# +# This Makefile understands the following targets: +# +# install (default): apply patches to directory provided by DESTDIR +# install-git: as above, but use 'git am' to apply the patches +# series: create a 'series' file containing the patch order +# clean: delete autogenerated and temporary files +# PATCHLIST := \ Miscellaneous.ok \ @@ -73,12 +84,47 @@ install: $(PATCHLIST) cd $(DESTDIR) && autoreconf -f cd $(DESTDIR) && ./tools/make_requests +.PHONY: install-git +install-git: PATCH := git am +install-git: install + +series: APPLY_FILE = @echo "$(1)" >> series +series: $(PATCHLIST) + @cat *.ok | sort | $(CURDIR)/../debian/tools/patchlist.sh > patchlist.diff + @echo "patchlist.diff" >> series + @( \ + echo ""; \ + echo "The 'series' file was created in current directory. Please note that"; \ + echo "'patchlist.diff' is autogenerated based on your selection of patches and not"; \ + echo "included in this repository - keep in mind to update it on every release."; \ + echo ""; \ + echo "Moreover, depending on which patches you have selected, you will have to run"; \ + echo "'autoreconf -f' and/or './tools/make_requests' after applying them."; \ + echo ""; \ + binary=0; \ + while IFS= read -r line; do \ + if grep -q "^GIT binary patch" "$$line"; then \ + binary=1; break; \ + fi \ + done < series; \ + if [ "$$binary" -ne 0 ]; then \ + echo "The following files contain binary patches and cannot be applied with the"; \ + echo "regular 'patch' commandline tool:"; \ + echo ""; \ + while IFS= read -r line; do \ + grep -q "^GIT binary patch" "$$line" && echo "$$line"; \ + done < series; \ + echo ""; \ + echo "Please use 'git apply' or '../debian/tools/gitapply.sh' from this repository."; \ + echo ""; \ + fi \ + ) + .PHONY: clean clean: + rm -f series patchlist.diff rm -f *.ok -.NOTPARALLEL: - # Patchset Miscellaneous # | # | Included patches: