Tweak archive deps.
[glibc.git] / fedora / Makefile
blob25dfb5d077899952e922e0f7bd27facf1018a561
1 # Makefile for maintaining glibc fedora-branch and creating Fedora source RPMs.
3 glibc.spec: # The default target.
5 tag-prefix := fedora-
7 .PHONY: update commit-merge commit patch tag archive finish_archive srpm rpm
9 snapshot-date-fmt := +'%Y-%m-%d %H:%M %Z'
10 snapshot-name-fmt := +'%Y%m%dT%H%M'
12 include branch.mk
15 on-branch = $(filter-out HEAD,$(glibc-base))
17 snapshot-date := $($(glibc-branch)-sync-date)
18 snapshot-name := $(shell date -u -d '$(snapshot-date)' $(snapshot-name-fmt))
20 tar-name := glibc$(subst _,.,$(patsubst glibc-%-branch,-%,\
21 $(filter-out HEAD,$(glibc-base))))
22 select-snapshot = -r '$($(glibc-branch)-sync-tag)'
23 snapshot-id = $($(glibc-branch)-sync-tag)
26 update:
27 now=`date -u $(snapshot-date-fmt)`; \
28 name=`date -u -d "$$now" $(snapshot-name-fmt)`; \
29 new="$(tag-prefix)$(tar-name)-$$name"; \
30 cvs -Q rtag $(if $(on-branch),-r $(glibc-base),-D "$$now") $$new libc;\
31 (echo '# This file is updated automatically by Makefile.'; \
32 echo 'glibc-branch := $(glibc-branch)'; \
33 echo 'glibc-base := $(glibc-base)'; \
34 echo "$(glibc-branch)-sync-date := $$now"; \
35 echo "$(glibc-branch)-sync-tag := $$new"; \
36 ) > branch.mk; \
37 cd ..; (set -x; cvs -q update -d -P \
38 -j'$($(glibc-branch)-sync-tag)' -j"$$new") \
39 2>&1 | tee fedora/update.log
41 commit-merge:
42 cd ..; cvs -Q commit -m"Updated to $(snapshot-id)"
44 glibc.spec: glibc.spec.in ../version.h branch.mk
45 (echo '%define glibcdate $(snapshot-name)'; \
46 sed -n '/VERSION/s/^.*"\([^"]*\)"$$/%define glibcversion \1/p' \
47 ../version.h; \
48 cat $<) > $@.new
49 mv -f $@.new $@
51 ifeq (,$(wildcard glibc.spec))
52 Makefile: glibc.spec ;
53 else
55 spec-nvr := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' \
56 --specfile glibc.spec | sed 1q)
57 spec-tag = $(subst .,_,$(spec-nvr))
59 tag: glibc.spec
60 cd ..; cvs -Q tag -c $(tag-prefix)$(spec-tag)
62 $(tar-name)-$(glibc-branch).patch: makepatch.awk glibc.spec \
63 ../ChangeLog ../*/ChangeLog
64 (cd ..; cvs -q diff -upN \
65 $(select-snapshot) -r $(tag-prefix)$(spec-tag)) | \
66 awk -v OLDVER=$(tar-name)-$(snapshot-name) \
67 -v NEWVER=$(tar-name)-$(snapshot-name)-$(glibc-branch) \
68 -f $< > patch.tmp
69 mv -f patch.tmp $@
71 # makepatch.awk omits these files from the patch; we put them in a tar file.
72 outside-patch = fedora c_stubs rtkaio glibc-compat \
73 localedata/charmaps/GB18030 iconvdata/gb18030.c
75 $(tar-name)-$(glibc-branch)-$(snapshot-name).tar.bz2: Makefile branch.mk \
76 ../ChangeLog \
77 ../*/ChangeLog
78 @rm -rf libc
79 cvs -Q export -r$(tag-prefix)$(spec-tag) \
80 $(addprefix libc/,$(outside-patch))
81 tar cf - -C libc $(outside-patch) | bzip2 -9 > $@.new
82 rm -rf libc
83 mv -f $@.new $@
85 $(tar-name)-$(snapshot-name).tar.bz2: Makefile branch.mk
86 @rm -rf $(tar-name)-$(snapshot-name)
87 cvs -Q export -d $(tar-name)-$(snapshot-name) $(select-snapshot) libc
88 tar cf - $(tar-name)-$(snapshot-name) | bzip2 -9 > $@.new
89 rm -rf $(tar-name)-$(snapshot-name)
90 mv -f $@.new $@
92 archives = $(tar-name)-$(snapshot-name).tar.bz2 \
93 $(tar-name)-$(glibc-branch)-$(snapshot-name).tar.bz2 \
94 $(tar-name)-$(glibc-branch).patch
95 finish_archive: $(archives)
97 archive: glibc.spec
98 $(MAKE) tag finish_archive
100 rpm srpm: $(spec-nvr).src.rpm
101 $(spec-nvr).src.rpm: glibc.spec $(archives)
102 rpmbuild --define "_sourcedir `pwd`" \
103 --define "_specdir `pwd`" \
104 --define "_srcrpmdir `pwd`" \
105 --nodeps -bs $<
107 endif