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 # These are built as a side-effect of the dist rule
17 #all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
19 # General rule for turning a .template into a regular file.
21 $(TEMPLATES) : % : %.template Makefile
23 sed -e 's@%VERSION%@$(VERSION)@g' \
24 -e 's@%PACKAGE%@$(PACKAGE)@g' \
28 # Construct Makefiles by adding on dependencies, etc.
30 $(MTEMPLATES) : % : %.template .dep_segment Makefile
32 sed -e 's@%VERSION%@$(VERSION)@g' \
33 -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
34 -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
35 -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
36 -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
37 -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
39 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
43 NMakefile: NMakefile.template .dep_segment Makefile
46 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
47 sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
50 # Construct build.sh.in
52 build.sh.in: build.template Makefile
54 sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \
55 -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc))@g' \
60 # Use automake to build a dependency list file, for "foreign" makefiles like
63 # Automake used to have a --generate-deps flag, but it's gone now, so we have
66 DEP_FILES := $(wildcard $(DEPDIR)/*.Po)
67 .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
69 (for f in $(DEPDIR)/*.Po; do \
72 sed -e '/^[^:]*\.[ch] *:/d' \
73 -e 's, /usr/[^ ]*,,g' \
74 -e 's, $(srcdir)/, ,g' \
80 # Get rid of everything "else".
82 maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
84 CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
85 build.sh.in .deps .dep_segment ABOUT-NLS \
88 # This rule tries to clean the tree right down to how it looks when you do a
89 # virgin CVS checkout.
91 # This is potentially dangerous since it removes _ANY FILE_ that is not in
92 # CVS. Including files you might mean to add to CVS but haven't yet...
93 # I only use this in subdirectories where it's unlikely we have any new
95 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";'
98 cvs-clean: maintainer-clean
99 -rm -rf *~ $(CVS-CLEAN-FILES)
100 -cd config && $(cvsclean)
101 -cd po && $(cvsclean)
102 -cd doc && $(cvsclean)
103 -cd glob && $(cvsclean)
106 # ----------------------------------------------------------------------
108 # The sections below were stolen from the Makefile.maint used by fileutils,
109 # sh-utils, textutils, CPPI, Bison, and Autoconf.
112 ## ---------------- ##
113 ## Updating files. ##
114 ## ---------------- ##
116 WGET = wget --passive-ftp -nv
117 ftp-gnu = ftp://ftp.gnu.org/gnu
119 move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
120 echo $(target) is unchanged; rm -f $(target).t; \
122 mv $(target).t $(target); \
125 # ------------------- #
126 # Updating PO files. #
127 # ------------------- #
129 # PO archive mirrors --- Be careful; some might not be fully populated!
130 # ftp://ftp.unex.es/pub/gnu-i18n/po/maint/
131 # http://translation.sf.net/maint/
132 # ftp://tiger.informatik.hu-berlin.de/pub/po/maint/
134 po_repo = http://www.iro.umontreal.ca/translation/maint/$(PACKAGE)
135 .PHONY: do-po-update po-update
137 tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
140 (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
142 cd po && $(MAKE) update-po
146 if test -d "po"; then \
147 $(MAKE) do-po-update; \
150 # -------------------------- #
151 # Updating GNU build files. #
152 # -------------------------- #
154 # The following pseudo table associates a local directory and a URL
155 # with each of the files that belongs to some other package and is
156 # regularly updated from the specified URL.
158 savannah-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
159 target = $(patsubst get-%,%,$@)
161 config-url = $(savannah-url)/config/config/$(patsubst get-config/%,%,$@)
162 get-config/config.guess get-config/config.sub:
163 @echo $(WGET) $(config-url) -O $(target) \
164 && $(WGET) $(config-url) -O $(target).t \
167 gnulib-url = $(savannah-url)/gnulib/gnulib/build-aux/$(patsubst get-config/%,%,$@)
168 get-config/texinfo.tex:
169 @echo $(WGET) $(gnulib-url) -O $(target) \
170 && $(WGET) $(gnulib-url) -O $(target).t \
173 gnustandards-url = $(savannah-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)
174 get-doc/make-stds.texi get-doc/fdl.texi:
175 @echo $(WGET) $(gnustandards-url) -O $(target) \
176 && $(WGET) $(gnustandards-url) -O $(target).t \
180 cvs-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
183 # --------------------- #
184 # Updating everything. #
185 # --------------------- #
188 update: po-update cvs-update
191 ## --------------- ##
193 ## --------------- ##
195 # Checks that don't require cvs. Run `changelog-check' last as
196 # previous test may reveal problems requiring new ChangeLog entries.
197 local-check: po-check changelog-check
199 # copyright-check writable-files
202 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
205 echo "$(VERSION) not in ChangeLog" 1>&2; \
209 # Verify that all source files using _() are listed in po/POTFILES.in.
210 # Ignore make.h; it defines _().
212 if test -f po/POTFILES.in; then \
213 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
214 grep -E -l '\b_\(' *.c *.h | grep -v make.h | sort > $@-2; \
215 diff -u $@-1 $@-2 || exit 1; \
219 ## ------------------------- ##
220 ## GNU FTP upload artifacts. ##
221 ## ------------------------- ##
223 # This target creates the upload artifacts.
224 # Sign it with my key.
227 GPGFLAGS = -u 6338B6D4
229 DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES))
230 DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES))
233 distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
235 $(DIST_ARCHIVES_DIRECTIVE): .directive.asc
239 @echo "Signing file '$<':"
240 $(GPG) $(GPGFLAGS) -o $@ -b $<
243 @echo "Creating directive file '$@':"
244 @echo 'directory: make' > .directive
245 $(GPG) $(GPGFLAGS) -o $@ --clearsign .directive
248 # Upload the artifacts
251 gnu-url = ftp-upload.gnu.org /incoming
253 UPLOADS = upload-alpha upload-ftp
255 $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
256 $(FTPPUT) $(gnu-url)/$(@:upload-%=%) $^
259 # Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
260 # 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
261 # This file is part of GNU Make.
263 # GNU Make is free software; you can redistribute it and/or modify it under the
264 # terms of the GNU General Public License as published by the Free Software
265 # Foundation; either version 2, or (at your option) any later version.
267 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
268 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
269 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
271 # You should have received a copy of the GNU General Public License along with
272 # GNU Make; see the file COPYING. If not, write to the Free Software
273 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.