initial commit
[glibc.git] / debian / rules.d / quilt.mk
1 # Implements the patch and unpatch targets, called when building packages.
2
3 # -*- Makefile -*-, you silly Emacs!
4 # vim: set ft=make:
5
6 DEBQUILTRC = debian/quiltrc
7 QUILTOPT = --quiltrc $(DEBQUILTRC)
8 QUILT = quilt $(QUILTOPT)
9
10 patch: $(stamp)patch
11 $(stamp)patch:
12 @if test -r debian/patches/series.$(DEB_HOST_ARCH); then \
13 pc=".pc.$(DEB_HOST_ARCH)"; \
14 mkdir -p "$$pc"; \
15 ln -sf ../debian/patches/series.$(DEB_HOST_ARCH) $$pc/series; \
16 QUILT_PC="$$pc" $(QUILT) upgrade || true; \
17 if QUILT_PC="$$pc" $(QUILT) next >/dev/null 2>&1; then \
18 echo "Applying architecture specific patches... "; \
19 QUILT_PC="$$pc" $(QUILT) push -a -v ; \
20 fi ; \
21 fi
22 touch $@
23
24 unpatch:
25 @if test -r debian/patches/series.$(DEB_HOST_ARCH); then \
26 pc=".pc.$(DEB_HOST_ARCH)"; \
27 QUILT_PC="$$pc" $(QUILT) upgrade || true; \
28 if QUILT_PC="$$pc" $(QUILT) applied >/dev/null 2>&1; then \
29 echo "Unapplying architecture specific patches..."; \
30 QUILT_PC="$$pc" $(QUILT) pop -a -v ; \
31 fi ; \
32 rm -rf $$pc ; \
33 fi
34 rm -f $(stamp)patch
35
36 refresh: unpatch
37 @if $(QUILT) applied >/dev/null 2>&1; then \
38 echo "Unapplying Debian patches..." ; \
39 $(QUILT) pop -a -v ; \
40 fi
41 @while $(QUILT) next ; do \
42 $(QUILT) push ; \
43 $(QUILT) refresh ; \
44 done ; \
45 $(QUILT) pop -a