In very obscure situations we may write the free token back to the pipe.
[make.git] / maintMakefile
blobacdf58ec6556613f3a43592674ea33e7604910ac
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!
6 AM_CFLAGS += -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wbad-function-cast
8 MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE
9 AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
11 # I want this one but I have to wait for the const cleanup!
12 # -Wwrite-strings
14 # Find the glob source files... this might be dangerous, but we're maintainers!
15 globsrc := $(wildcard glob/*.c)
16 globhdr := $(wildcard glob/*.h)
18 TEMPLATES = README README.DOS README.W32 README.OS2 \
19             config.ami configh.dos config.h.W32 config.h-vms
20 MTEMPLATES = Makefile.DOS SMakefile
22 # These are built as a side-effect of the dist rule
23 #all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
25 # General rule for turning a .template into a regular file.
27 $(TEMPLATES) : % : %.template Makefile
28         rm -f $@
29         sed -e 's@%VERSION%@$(VERSION)@g' \
30             -e 's@%PACKAGE%@$(PACKAGE)@g' \
31           $< > $@
32         chmod a-w $@
34 # Construct Makefiles by adding on dependencies, etc.
36 $(MTEMPLATES) : % : %.template .dep_segment Makefile
37         rm -f $@
38         sed -e 's@%VERSION%@$(VERSION)@g' \
39             -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
40             -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
41             -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
42             -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
43             -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
44           $< > $@
45         echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
46           cat $(word 2,$^) >>$@
47         chmod a-w $@
49 NMakefile: NMakefile.template .dep_segment Makefile
50         rm -f $@
51         cp $< $@
52         echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
53           sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
54         chmod a-w $@
56 # Construct build.sh.in
58 build.sh.in: build.template Makefile
59         rm -f $@
60         sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \
61             -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc))@g' \
62           $< > $@
63         chmod a-w+x $@
66 # Use automake to build a dependency list file, for "foreign" makefiles like
67 # Makefile.DOS.
69 # Automake used to have a --generate-deps flag, but it's gone now, so we have
70 # to do it ourselves.
72 DEP_FILES := $(wildcard $(DEPDIR)/*.Po)
73 .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
74         rm -f $@
75         (for f in $(DEPDIR)/*.Po; do \
76            echo ""; \
77            echo "# $$f"; \
78            sed  -e '/^[^:]*\.[ch] *:/d' \
79                 -e 's, /usr/[^ ]*,,g' \
80                 -e 's, $(srcdir)/, ,g' \
81                 -e '/^ *\\$$/d' \
82                 -e '/^ *$$/d' \
83                 < $$f; \
84          done) > $@
86 # Get rid of everything "else".
88 maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
90 CVS-CLEAN-FILES +=      $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
91                         build.sh.in .deps .dep_segment ABOUT-NLS \
92                         ansi2knr.*
94 # This rule tries to clean the tree right down to how it looks when you do a
95 # virgin CVS checkout.
97 # This target is potentially dangerous since it removes _ANY FILE_ that
98 # is not in CVS.  Including files you might mean to add to CVS but
99 # haven't yet...  I only use this in subdirectories where it's unlikely
100 # we have any new files.  Still... be careful!!
102 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";'
104 .PHONY: cvs-clean
105 cvs-clean: maintainer-clean
106         -rm -rf *~ $(CVS-CLEAN-FILES)
107         -cd config && $(cvsclean)
108         -cd po     && $(cvsclean)
109         -cd doc    && $(cvsclean)
110         -cd glob   && $(cvsclean)
113 # ----------------------------------------------------------------------
115 # The sections below were stolen from the Makefile.maint used by fileutils,
116 # sh-utils, textutils, CPPI, Bison, and Autoconf.
119 ## ---------------- ##
120 ## Updating files.  ##
121 ## ---------------- ##
123 WGET = wget --passive-ftp -nv
124 ftp-gnu = ftp://ftp.gnu.org/gnu
126 move_if_change =  if test -r $(target) && cmp -s $(target).t $(target); then \
127                     echo $(target) is unchanged; rm -f $(target).t; \
128                   else \
129                     mv $(target).t $(target); \
130                   fi
132 # ------------------- #
133 # Updating PO files.  #
134 # ------------------- #
136 # PO archive mirrors --- Be careful; some might not be fully populated!
137 #   ftp://ftp.unex.es/pub/gnu-i18n/po/maint/
138 #   http://translation.sf.net/maint/
139 #   ftp://tiger.informatik.hu-berlin.de/pub/po/maint/
141 po_wget_flags = --recursive --level=1 --no-directories --no-parent \
142                 --no-check-certificate
143 po_repo = http://translationproject.org/latest/$(PACKAGE)
144 .PHONY: do-po-update po-update
145 do-po-update:
146         tmppo="/tmp/po-$(PACKAGE)-$(VERSION).$$$$" \
147           && rm -rf "$$tmppo" \
148           && mkdir "$$tmppo" \
149           && (cd "$$tmppo" \
150                 && $(WGET) $(po_wget_flags) -A '*.po' $(po_repo)) \
151           && cp "$$tmppo"/*.po $(top_srcdir)/po && rm -rf "$$tmppo"
152         cd po && $(MAKE) update-po
153         $(MAKE) po-check
155 po-update:
156         [ -d "po" ] && $(MAKE) do-po-update
158 # -------------------------- #
159 # Updating GNU build files.  #
160 # -------------------------- #
162 # The following pseudo table associates a local directory and a URL
163 # with each of the files that belongs to some other package and is
164 # regularly updated from the specified URL.
166 cvs-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
167 git-url = http://git.savannah.gnu.org/cgit
168 target = $(patsubst get-%,%,$@)
170 config-url = $(git-url)/config.git/plain/$(patsubst get-config/%,%,$@)
171 get-config/config.guess get-config/config.sub:
172         @echo $(WGET) $(config-url) -O $(target) \
173           && $(WGET) $(config-url) -O $(target).t \
174           && $(move_if_change)
176 gnulib-url = $(git-url)/gnulib.git/plain/build-aux/$(patsubst get-config/%,%,$@)
177 get-config/texinfo.tex:
178         @echo $(WGET) $(gnulib-url) -O $(target) \
179           && $(WGET) $(gnulib-url) -O $(target).t \
180           && $(move_if_change)
182 gnustandards-url = $(cvs-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)
183 get-doc/make-stds.texi get-doc/fdl.texi:
184         @echo $(WGET) $(gnustandards-url) -O $(target) \
185           && $(WGET) $(gnustandards-url) -O $(target).t \
186           && $(move_if_change)
188 .PHONY: scm-update
189 scm-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
192 # --------------------- #
193 # Updating everything.  #
194 # --------------------- #
196 .PHONY: update
197 update: po-update scm-update
200 ## --------------- ##
201 ## Sanity checks.  ##
202 ## --------------- ##
204 # Checks that don't require cvs.  Run `changelog-check' last as
205 # previous test may reveal problems requiring new ChangeLog entries.
206 local-check: po-check changelog-check
208 # copyright-check writable-files
210 changelog-check:
211         if head $(top_srcdir)/ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
212           :; \
213         else \
214           echo "$(VERSION) not in ChangeLog" 1>&2; \
215           exit 1; \
216         fi
218 # Verify that all source files using _() are listed in po/POTFILES.in.
219 # Ignore make.h; it defines _().
220 po-check:
221         if test -f po/POTFILES.in; then \
222           grep '^[^#]' po/POTFILES.in | sort > $@-1; \
223           $(PERL) -wn -e 'if (/\b_\(/) { $$ARGV eq "make.h" || print "$$ARGV\n" and close ARGV }' *.c *.h | sort > $@-2; \
224           diff -u $@-1 $@-2 || exit 1; \
225           rm -f $@-1 $@-2; \
226         fi
228 ## ------------------------- ##
229 ## GNU FTP upload artifacts. ##
230 ## ------------------------- ##
232 # This target creates the upload artifacts.
233 # Sign it with my key.  If you don't have my key/passphrase then sorry,
234 # you're SOL! :)
236 GPG = gpg
237 GPGFLAGS = -u 6338B6D4
239 DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES))
240 DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES))
242 # A simple rule to test signing, etc.
243 .PHONY: distsign
244 distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
246 %.sig : %
247         @echo "Signing file '$<':"
248         $(GPG) $(GPGFLAGS) -o "$@" -b "$<"
250 %.directive.asc: %
251         @echo "Creating directive file '$@':"
252         @( \
253            echo 'version: 1.1'; \
254            echo 'directory: make'; \
255            echo 'filename: $*'; \
256            echo 'comment: Official upload of GNU make version $(VERSION)'; \
257          ) > "$*.directive"
258         $(GPG) $(GPGFLAGS) -o "$@" --clearsign "$*.directive"
259         @rm -f "$*.directive"
261 # Upload the artifacts
263 FTPPUT = ncftpput
264 gnu-upload-host = ftp-upload.gnu.org
265 gnu-upload-dir  = /incoming
268 UPLOADS = upload-alpha upload-ftp
269 .PHONY: $(UPLOADS)
270 $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
271         $(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^
274 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
275 # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
276 # This file is part of GNU Make.
278 # GNU Make is free software; you can redistribute it and/or modify it under
279 # the terms of the GNU General Public License as published by the Free Software
280 # Foundation; either version 3 of the License, or (at your option) any later
281 # version.
283 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
284 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
285 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
286 # details.
288 # You should have received a copy of the GNU General Public License along with
289 # this program.  If not, see <http://www.gnu.org/licenses/>.