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