1 # Maintainer-only makefile segment. This contains things that are relevant
2 # only if you have the full copy of the GNU make sources from the CVS
3 # tree, not a dist copy.
5 # We like mondo-warnings!
8 # Find the glob source files... this might be dangerous, but we're maintainers!
9 globsrc := $(wildcard glob/*.c)
10 globhdr := $(wildcard glob/*.h)
12 TEMPLATES = README README.DOS README.W32 README.OS2 \
13 config.ami configh.dos config.h.W32 config.h-vms
14 MTEMPLATES = Makefile.DOS SMakefile
16 all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
18 # General rule for turning a .template into a regular file.
20 $(TEMPLATES) : % : %.template Makefile
22 sed -e 's@%VERSION%@$(VERSION)@g' \
23 -e 's@%PACKAGE%@$(PACKAGE)@g' \
27 # Construct Makefiles by adding on dependencies, etc.
29 $(MTEMPLATES) : % : %.template .dep_segment Makefile
31 sed -e 's@%VERSION%@$(VERSION)@g' \
32 -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
33 -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
34 -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
35 -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
36 -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
38 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
42 NMakefile: NMakefile.template .dep_segment Makefile
45 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
46 sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
49 # Construct build.sh.in
51 build.sh.in: build.template Makefile
53 sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \
54 -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc))@g' \
59 # Use automake to build a dependency list file, for "foreign" makefiles like
62 # Automake used to have a --generate-deps flag, but it's gone now, so we have
65 DEP_FILES := $(wildcard $(DEPDIR)/*.Po)
66 .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
68 (for f in $(DEPDIR)/*.Po; do \
71 sed -e '/^[^:]*\.[ch] *:/d' \
72 -e 's, /usr/[^ ]*,,g' \
73 -e 's, $(srcdir)/, ,g' \
79 # Get rid of everything "else".
81 maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
83 CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
84 build.sh.in .deps .dep_segment ABOUT-NLS \
87 # This rule tries to clean the tree right down to how it looks when you do a
88 # virgin CVS checkout.
90 # This is potentially dangerous since it removes _ANY FILE_ that is not in
91 # CVS. Including files you might mean to add to CVS but haven't yet...
92 # I only use this in subdirectories where it's unlikely we have any new
94 cvsclean = perl -e '$$k{CVS} = 1; open(E,"< CVS/Entries") || die "CVS/Entries: $$!\n"; while (defined ($$_ = <E>)) { m%^/([^/]*)% or next; $$k{$$1} = 1; } close(E) || die "CVS/Entries: $$!\n"; opendir(D, ".") || die ".: $$!\n"; while (defined ($$_ = readdir(D))) { -f $$_ && ! exists $$k{$$_} && unlink($$_); } closedir(D) || die ".: $$!\n";'
97 cvs-clean: maintainer-clean
98 -rm -rf *~ $(CVS-CLEAN-FILES)
99 -cd config && $(cvsclean)
100 -cd po && $(cvsclean)
101 -cd doc && $(cvsclean)
102 -cd glob && $(cvsclean)
105 # ----------------------------------------------------------------------
107 # The sections below were stolen from the Makefile.maint used by fileutils,
108 # sh-utils, textutils, CPPI, Bison, and Autoconf.
111 ## ---------------- ##
112 ## Updating files. ##
113 ## ---------------- ##
115 WGET = wget --passive-ftp -nv
116 ftp-gnu = ftp://ftp.gnu.org/gnu
118 move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
119 echo $(target) is unchanged; rm -f $(target).t; \
121 mv $(target).t $(target); \
124 # ------------------- #
125 # Updating PO files. #
126 # ------------------- #
128 # PO archive mirrors --- Be careful; some might not be fully populated!
129 # ftp://ftp.unex.es/pub/gnu-i18n/po/maint/
130 # http://translation.sf.net/maint/
131 # ftp://tiger.informatik.hu-berlin.de/pub/po/maint/
133 po_repo = http://www.iro.umontreal.ca/translation/maint/$(PACKAGE)
134 .PHONY: do-po-update po-update
136 tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
139 (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
141 cd po && $(MAKE) update-po
145 if test -d "po"; then \
146 $(MAKE) do-po-update; \
149 # -------------------------- #
150 # Updating GNU build files. #
151 # -------------------------- #
153 # The following pseudo table associates a local directory and a URL
154 # with each of the files that belongs to some other package and is
155 # regularly updated from the specified URL.
157 savannah-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
158 target = $(patsubst get-%,%,$@)
160 config-url = $(savannah-url)/config/config/$(patsubst get-config/%,%,$@)
161 get-config/config.guess get-config/config.sub:
162 @echo $(WGET) $(config-url) -O $(target) \
163 && $(WGET) $(config-url) -O $(target).t \
166 gnulib-url = $(savannah-url)/gnulib/gnulib/build-aux/$(patsubst get-config/%,%,$@)
167 get-config/texinfo.tex:
168 @echo $(WGET) $(gnulib-url) -O $(target) \
169 && $(WGET) $(gnulib-url) -O $(target).t \
172 gnustandards-url = $(savannah-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)
173 get-doc/make-stds.texi get-doc/fdl.texi:
174 @echo $(WGET) $(gnustandards-url) -O $(target) \
175 && $(WGET) $(gnustandards-url) -O $(target).t \
179 cvs-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
182 # --------------------- #
183 # Updating everything. #
184 # --------------------- #
187 update: po-update cvs-update
190 ## --------------- ##
192 ## --------------- ##
194 # Checks that don't require cvs. Run `changelog-check' last as
195 # previous test may reveal problems requiring new ChangeLog entries.
196 local-check: po-check changelog-check
198 # copyright-check writable-files
201 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
204 echo "$(VERSION) not in ChangeLog" 1>&2; \
208 # Verify that all source files using _() are listed in po/POTFILES.in.
209 # Ignore make.h; it defines _().
211 if test -f po/POTFILES.in; then \
212 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
213 grep -E -l '\b_\(' *.c *.h | grep -v make.h | sort > $@-2; \
214 diff -u $@-1 $@-2 || exit 1; \
218 ## ------------------------- ##
219 ## GNU FTP upload artifacts. ##
220 ## ------------------------- ##
222 # This target creates the upload artifacts.
223 # Sign it with my key.
226 GPGFLAGS = -u 6338B6D4
228 DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES))
229 DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES))
232 distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
234 $(DIST_ARCHIVES_DIRECTIVE): .directive.asc
238 @echo "Signing file '$<':"
239 $(GPG) $(GPGFLAGS) -o $@ -b $<
242 @echo "Creating directive file '$@':"
243 @echo 'directory: make' > .directive
244 $(GPG) $(GPGFLAGS) -o $@ --clearsign .directive
247 # Upload the artifacts
250 gnu-url = ftp-upload.gnu.org /incoming
252 UPLOADS = upload-alpha upload-ftp
254 $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
255 $(FTPPUT) $(gnu-url)/$(@:upload-%=%) $^