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 Git
|
---|
3 | # tree, not a dist copy.
|
---|
4 |
|
---|
5 | BUGLIST := [email protected]
|
---|
6 |
|
---|
7 | # These are related to my personal setup.
|
---|
8 | GPG_FINGERPRINT := 6338B6D4
|
---|
9 |
|
---|
10 | # SRCROOTDIR is just a handy location to keep source files in
|
---|
11 | SRCROOTDIR ?= $(HOME)/src
|
---|
12 |
|
---|
13 | # Where the gnulib project has been locally cloned
|
---|
14 | GNULIBDIR ?= $(SRCROOTDIR)/gnulib
|
---|
15 |
|
---|
16 | # Where to put the CVS checkout of the GNU web repository
|
---|
17 | GNUWEBDIR ?= $(SRCROOTDIR)/gnu-www
|
---|
18 |
|
---|
19 | # Where to put the CVS checkout of the GNU make web repository
|
---|
20 | MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web
|
---|
21 |
|
---|
22 | # We like mondo-warnings!
|
---|
23 | AM_CFLAGS += -Wall -Wwrite-strings -Wextra -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wbad-function-cast
|
---|
24 |
|
---|
25 | MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE
|
---|
26 | AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
|
---|
27 |
|
---|
28 | # I want this one but I have to wait for the const cleanup!
|
---|
29 | # -Wwrite-strings
|
---|
30 |
|
---|
31 | # Find the glob source files... this might be dangerous, but we're maintainers!
|
---|
32 | globsrc := $(wildcard glob/*.c)
|
---|
33 | globhdr := $(wildcard glob/*.h)
|
---|
34 |
|
---|
35 | TEMPLATES = README README.DOS README.W32 README.OS2 \
|
---|
36 | config.ami configh.dos config.h.W32 config.h-vms
|
---|
37 | MTEMPLATES = Makefile.DOS SMakefile
|
---|
38 |
|
---|
39 | # These are built as a side-effect of the dist rule
|
---|
40 | #all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
|
---|
41 |
|
---|
42 | # Create preprocessor output files--GCC specific!
|
---|
43 | %.i : %.c
|
---|
44 | $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) -E -dD -o $@ $<
|
---|
45 |
|
---|
46 | # General rule for turning a .template into a regular file.
|
---|
47 | #
|
---|
48 | $(TEMPLATES) : % : %.template Makefile
|
---|
49 | rm -f $@
|
---|
50 | sed -e 's@%VERSION%@$(VERSION)@g' \
|
---|
51 | -e 's@%PACKAGE%@$(PACKAGE)@g' \
|
---|
52 | $< > $@
|
---|
53 | chmod a-w $@
|
---|
54 |
|
---|
55 | # Construct Makefiles by adding on dependencies, etc.
|
---|
56 | #
|
---|
57 | $(MTEMPLATES) : % : %.template .dep_segment Makefile
|
---|
58 | rm -f $@
|
---|
59 | sed -e 's@%VERSION%@$(VERSION)@g' \
|
---|
60 | -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
|
---|
61 | -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
|
---|
62 | -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
|
---|
63 | -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
|
---|
64 | -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
|
---|
65 | $< > $@
|
---|
66 | echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
|
---|
67 | cat $(word 2,$^) >>$@
|
---|
68 | chmod a-w $@
|
---|
69 |
|
---|
70 | NMakefile: NMakefile.template .dep_segment Makefile
|
---|
71 | rm -f $@
|
---|
72 | cp $< $@
|
---|
73 | echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
|
---|
74 | sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
|
---|
75 | chmod a-w $@
|
---|
76 |
|
---|
77 | # Construct build.sh.in
|
---|
78 | #
|
---|
79 | build.sh.in: build.template Makefile
|
---|
80 | rm -f $@
|
---|
81 | sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \
|
---|
82 | -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc))@g' \
|
---|
83 | $< > $@
|
---|
84 | chmod a-w+x $@
|
---|
85 |
|
---|
86 |
|
---|
87 | # Use automake to build a dependency list file, for "foreign" makefiles like
|
---|
88 | # Makefile.DOS.
|
---|
89 | #
|
---|
90 | # Automake used to have a --generate-deps flag, but it's gone now, so we have
|
---|
91 | # to do it ourselves.
|
---|
92 | #
|
---|
93 | DEP_FILES := $(wildcard $(DEPDIR)/*.Po)
|
---|
94 | .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
|
---|
95 | rm -f $@
|
---|
96 | (for f in $(DEPDIR)/*.Po; do \
|
---|
97 | echo ""; \
|
---|
98 | echo "# $$f"; \
|
---|
99 | sed -e '/^[^:]*\.[ch] *:/d' \
|
---|
100 | -e 's, /usr/[^ ]*,,g' \
|
---|
101 | -e 's, $(srcdir)/, ,g' \
|
---|
102 | -e '/^ *\\$$/d' \
|
---|
103 | -e '/^ *$$/d' \
|
---|
104 | < $$f; \
|
---|
105 | done) > $@
|
---|
106 |
|
---|
107 | # Cleaning
|
---|
108 |
|
---|
109 | GIT := git
|
---|
110 |
|
---|
111 | # git-clean: Clean all "ignored" files. Leave untracked files.
|
---|
112 | # git-very-clean: Clean all files that aren't stored in source control.
|
---|
113 |
|
---|
114 | .PHONY: git-clean git-very-clean
|
---|
115 | git-clean:
|
---|
116 | -$(GIT) clean -fdX
|
---|
117 | git-very-clean: git-clean
|
---|
118 | -$(GIT) clean -fd
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 | ## ---------------------- ##
|
---|
123 | ## Generating ChangeLog. ##
|
---|
124 | ## ---------------------- ##
|
---|
125 |
|
---|
126 | gl2cl-date := 2013-10-10
|
---|
127 | gl2cl := $(GNULIBDIR)/build-aux/gitlog-to-changelog
|
---|
128 |
|
---|
129 | # Rebuild the changelog whenever a new commit is added
|
---|
130 | ChangeLog: .check-git-HEAD
|
---|
131 | if test -f '$(gl2cl)'; then \
|
---|
132 | '$(gl2cl)' --since='$(gl2cl-date)' > '$@'; \
|
---|
133 | else \
|
---|
134 | echo "WARNING: $(gl2cl) is not available. No $@ generated."; \
|
---|
135 | fi
|
---|
136 |
|
---|
137 | .PHONY: .check-git-HEAD
|
---|
138 | .check-git-HEAD:
|
---|
139 | sha="`git rev-parse HEAD`"; \
|
---|
140 | [ -f '$@' ] && [ "`cat '$@' 2>/dev/null`" = "$$sha" ] \
|
---|
141 | || echo "$$sha" > '$@'
|
---|
142 |
|
---|
143 |
|
---|
144 | ## ---------------- ##
|
---|
145 | ## Updating files. ##
|
---|
146 | ## ---------------- ##
|
---|
147 | RSYNC = rsync -Lrtvz
|
---|
148 | WGET = wget --passive-ftp -np -nv
|
---|
149 | ftp-gnu = ftp://ftp.gnu.org/gnu
|
---|
150 |
|
---|
151 | move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
|
---|
152 | echo $(target) is unchanged; rm -f $(target).t; \
|
---|
153 | else \
|
---|
154 | mv -f $(target).t $(target); \
|
---|
155 | fi
|
---|
156 |
|
---|
157 | # ------------------- #
|
---|
158 | # Updating PO files. #
|
---|
159 | # ------------------- #
|
---|
160 |
|
---|
161 | # PO archive mirrors --- Be careful; some might not be fully populated!
|
---|
162 | # ftp://ftp.unex.es/pub/gnu-i18n/po/maint/
|
---|
163 | # http://translation.sf.net/maint/
|
---|
164 | # ftp://tiger.informatik.hu-berlin.de/pub/po/maint/
|
---|
165 |
|
---|
166 | po_wget_flags = --recursive --level=1 --no-directories --no-check-certificate
|
---|
167 | po_repo = http://translationproject.org/latest/$(PACKAGE)
|
---|
168 | po_sync = translationproject.org::tp/latest/$(PACKAGE)/
|
---|
169 |
|
---|
170 | .PHONY: do-po-update po-update
|
---|
171 | do-po-update:
|
---|
172 | tmppo="/tmp/po-$(PACKAGE)-$(VERSION).$$$$" \
|
---|
173 | && rm -rf "$$tmppo" \
|
---|
174 | && mkdir "$$tmppo" \
|
---|
175 | && $(RSYNC) $(po_sync) "$$tmppo" \
|
---|
176 | && cp "$$tmppo"/*.po $(top_srcdir)/po \
|
---|
177 | && rm -rf "$$tmppo"
|
---|
178 | cd po && $(MAKE) update-po
|
---|
179 | $(MAKE) po-check
|
---|
180 |
|
---|
181 | po-update:
|
---|
182 | [ -d "po" ] && $(MAKE) do-po-update
|
---|
183 |
|
---|
184 | # -------------------------- #
|
---|
185 | # Updating GNU build files. #
|
---|
186 | # -------------------------- #
|
---|
187 |
|
---|
188 | # The following pseudo table associates a local directory and a URL
|
---|
189 | # with each of the files that belongs to some other package and is
|
---|
190 | # regularly updated from the specified URL.
|
---|
191 |
|
---|
192 | cvs-url = http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~
|
---|
193 | git-url = http://git.savannah.gnu.org/cgit
|
---|
194 | target = $(patsubst get-%,%,$@)
|
---|
195 |
|
---|
196 | config-url = $(git-url)/config.git/plain/$(patsubst get-config/%,%,$@)
|
---|
197 | get-config/config.guess get-config/config.sub:
|
---|
198 | @echo $(WGET) $(config-url) -O $(target) \
|
---|
199 | && $(WGET) $(config-url) -O $(target).t \
|
---|
200 | && $(move_if_change)
|
---|
201 |
|
---|
202 | gnulib-url = $(git-url)/gnulib.git/plain/build-aux/$(patsubst get-config/%,%,$@)
|
---|
203 | get-config/texinfo.tex:
|
---|
204 | @echo $(WGET) $(gnulib-url) -O $(target) \
|
---|
205 | && $(WGET) $(gnulib-url) -O $(target).t \
|
---|
206 | && $(move_if_change)
|
---|
207 |
|
---|
208 | gnustandards-url = $(cvs-url)/gnustandards/gnustandards/$(patsubst get-doc/%,%,$@)
|
---|
209 | get-doc/make-stds.texi get-doc/fdl.texi:
|
---|
210 | @echo $(WGET) $(gnustandards-url) -O $(target) \
|
---|
211 | && $(WGET) $(gnustandards-url) -O $(target).t \
|
---|
212 | && $(move_if_change)
|
---|
213 |
|
---|
214 | .PHONY: scm-update
|
---|
215 | scm-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub get-doc/make-stds.texi get-doc/fdl.texi
|
---|
216 |
|
---|
217 |
|
---|
218 | # --------------------- #
|
---|
219 | # Updating everything. #
|
---|
220 | # --------------------- #
|
---|
221 |
|
---|
222 | .PHONY: update
|
---|
223 | update: po-update scm-update
|
---|
224 |
|
---|
225 |
|
---|
226 | # ---------------------------------- #
|
---|
227 | # Alternative configuration checks. #
|
---|
228 | # ---------------------------------- #
|
---|
229 |
|
---|
230 | .PHONY: check-alt-config
|
---|
231 | check-alt-config: \
|
---|
232 | checkcfg.--disable-job-server \
|
---|
233 | checkcfg.--disable-load \
|
---|
234 | checkcfg.--without-guile \
|
---|
235 | checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
|
---|
236 | checkcfg.CPPFLAGS^-DNO_ARCHIVES
|
---|
237 |
|
---|
238 | # Trick GNU make so it doesn't run the submake as a recursive make.
|
---|
239 | NR_MAKE = $(MAKE)
|
---|
240 |
|
---|
241 | # Check builds both with build.sh and with make
|
---|
242 | checkcfg.%: distdir
|
---|
243 | @echo "Building $@ (output in checkcfg.$*.log)"
|
---|
244 | @exec >'checkcfg.$*.log' 2>&1; \
|
---|
245 | rm -rf $(distdir)/_build \
|
---|
246 | && mkdir $(distdir)/_build \
|
---|
247 | && cd $(distdir)/_build \
|
---|
248 | && echo "Testing configure with $(subst ^,=,$*)" \
|
---|
249 | && ../configure --srcdir=.. $(subst ^,=,$*) \
|
---|
250 | $(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS) \
|
---|
251 | CFLAGS='$(AM_CFLAGS)' \
|
---|
252 | && ./build.sh \
|
---|
253 | && ./make $(AM_MAKEFLAGS) check \
|
---|
254 | && rm -f *.o make \
|
---|
255 | && $(NR_MAKE) $(AM_MAKEFLAGS) \
|
---|
256 | && ./make $(AM_MAKEFLAGS) check
|
---|
257 |
|
---|
258 |
|
---|
259 | ## --------------- ##
|
---|
260 | ## Sanity checks. ##
|
---|
261 | ## --------------- ##
|
---|
262 |
|
---|
263 | # Before we build a distribution be sure we run our local checks
|
---|
264 | #distdir: local-check
|
---|
265 |
|
---|
266 | .PHONY: local-check po-check changelog-check
|
---|
267 |
|
---|
268 | # Checks that don't require Git. Run 'changelog-check' last as
|
---|
269 | # previous test may reveal problems requiring new ChangeLog entries.
|
---|
270 | local-check: po-check changelog-check
|
---|
271 |
|
---|
272 | # copyright-check writable-files
|
---|
273 |
|
---|
274 | changelog-check:
|
---|
275 | if head $(top_srcdir)/ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
|
---|
276 | :; \
|
---|
277 | else \
|
---|
278 | echo "$(VERSION) not in ChangeLog" 1>&2; \
|
---|
279 | exit 1; \
|
---|
280 | fi
|
---|
281 |
|
---|
282 | # Verify that all source files using _() are listed in po/POTFILES.in.
|
---|
283 | # Ignore makeint.h; it defines _().
|
---|
284 | po-check:
|
---|
285 | if test -f po/POTFILES.in; then \
|
---|
286 | grep '^[^#]' po/POTFILES.in | sort > $@-1; \
|
---|
287 | $(PERL) -wn -e 'if (/\b_\(/) { $$ARGV eq "./makeint.h" || print "$$ARGV\n" and close ARGV }' `find . -name '*.[ch]'` | sed 's,^\./,,' | sort > $@-2; \
|
---|
288 | diff -u $@-1 $@-2 || exit 1; \
|
---|
289 | rm -f $@-1 $@-2; \
|
---|
290 | fi
|
---|
291 |
|
---|
292 |
|
---|
293 | ## --------------- ##
|
---|
294 | ## Generate docs. ##
|
---|
295 | ## --------------- ##
|
---|
296 |
|
---|
297 | .PHONY: update-makeweb gendocs
|
---|
298 |
|
---|
299 | CVS = cvs
|
---|
300 |
|
---|
301 | makeweb-repo = $(USER)@cvs.sv.gnu.org:/web/make
|
---|
302 | gnuweb-repo = :pserver:[email protected]:/web/www
|
---|
303 | gnuweb-dir = www/server/standards
|
---|
304 |
|
---|
305 | # Get the GNU make web page boilerplate etc.
|
---|
306 | update-makeweb:
|
---|
307 | [ -d '$(MAKEWEBDIR)' ] || mkdir -p '$(MAKEWEBDIR)'
|
---|
308 | [ -d '$(MAKEWEBDIR)'/CVS ] \
|
---|
309 | && { cd '$(MAKEWEBDIR)' && $(CVS) update; } \
|
---|
310 | || { mkdir -p '$(dir $(MAKEWEBDIR))' && cd '$(dir $(MAKEWEBDIR))' \
|
---|
311 | && $(CVS) -d $(makeweb-repo) co -d '$(notdir $(MAKEWEBDIR))' make; }
|
---|
312 |
|
---|
313 | # Get the GNU web page boilerplate etc.
|
---|
314 | update-gnuweb:
|
---|
315 | [ -d '$(GNUWEBDIR)' ] || mkdir -p '$(GNUWEBDIR)'
|
---|
316 | [ -d '$(GNUWEBDIR)/$(gnuweb-dir)'/CVS ] \
|
---|
317 | && { cd '$(GNUWEBDIR)/$(gnuweb-dir)' && $(CVS) update; } \
|
---|
318 | || { cd '$(GNUWEBDIR)' && $(CVS) -d $(gnuweb-repo) co '$(gnuweb-dir)'; }
|
---|
319 |
|
---|
320 | gendocs: update-gnuweb update-makeweb
|
---|
321 | cp $(GNULIBDIR)/doc/gendocs_template doc
|
---|
322 | cd doc \
|
---|
323 | && rm -rf doc/manual \
|
---|
324 | && $(GNULIBDIR)/build-aux/gendocs.sh --email '$(BUGLIST)' \
|
---|
325 | make 'GNU Make Manual'
|
---|
326 | find '$(MAKEWEBDIR)'/manual \( -name CVS -prune \) -o \( -name '[!.]*' -type f -exec rm -f '{}' \; \)
|
---|
327 | cp -r doc/manual '$(MAKEWEBDIR)'
|
---|
328 | @echo 'Status of $(MAKEWEBDIR) repo:' && cd '$(MAKEWEBDIR)' \
|
---|
329 | && cvs -q -n update | grep -v '^M ' \
|
---|
330 | && echo '- cvs add <new files>' \
|
---|
331 | && echo '- cvs remove <deleted files>' \
|
---|
332 | && echo '- cvs commit' \
|
---|
333 | && echo '- cvs tag make-$(subst .,-,$(VERSION))'
|
---|
334 |
|
---|
335 | ## ------------------------- ##
|
---|
336 | ## Make release targets. ##
|
---|
337 | ## ------------------------- ##
|
---|
338 |
|
---|
339 | .PHONY: tag-release
|
---|
340 | tag-release:
|
---|
341 | case '$(VERSION)' in \
|
---|
342 | (*.*.9*) message=" candidate" ;; \
|
---|
343 | (*) message= ;; \
|
---|
344 | esac; \
|
---|
345 | $(GIT) tag -m "GNU Make release$$message $(VERSION)" -u '$(GPG_FINGERPRINT)' '$(VERSION)'
|
---|
346 |
|
---|
347 | ## ------------------------- ##
|
---|
348 | ## GNU FTP upload artifacts. ##
|
---|
349 | ## ------------------------- ##
|
---|
350 |
|
---|
351 | # This target creates the upload artifacts.
|
---|
352 | # Sign it with my key. If you don't have my key/passphrase then sorry,
|
---|
353 | # you're SOL! :)
|
---|
354 |
|
---|
355 | GPG = gpg
|
---|
356 | GPGFLAGS = -u $(GPG_FINGERPRINT)
|
---|
357 |
|
---|
358 | DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES))
|
---|
359 | DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES))
|
---|
360 |
|
---|
361 | # A simple rule to test signing, etc.
|
---|
362 | .PHONY: distsign
|
---|
363 | distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
|
---|
364 |
|
---|
365 | %.sig : %
|
---|
366 | @echo "Signing file '$<':"
|
---|
367 | $(GPG) $(GPGFLAGS) -o "$@" -b "$<"
|
---|
368 |
|
---|
369 | %.directive.asc: %
|
---|
370 | @echo "Creating directive file '$@':"
|
---|
371 | @( \
|
---|
372 | echo 'version: 1.1'; \
|
---|
373 | echo 'directory: make'; \
|
---|
374 | echo 'filename: $*'; \
|
---|
375 | echo 'comment: Official upload of GNU make version $(VERSION)'; \
|
---|
376 | ) > "$*.directive"
|
---|
377 | $(GPG) $(GPGFLAGS) -o "$@" --clearsign "$*.directive"
|
---|
378 | @rm -f "$*.directive"
|
---|
379 |
|
---|
380 | # Upload the artifacts
|
---|
381 |
|
---|
382 | FTPPUT = ncftpput
|
---|
383 | gnu-upload-host = ftp-upload.gnu.org
|
---|
384 | gnu-upload-dir = /incoming
|
---|
385 |
|
---|
386 |
|
---|
387 | UPLOADS = upload-alpha upload-ftp
|
---|
388 | .PHONY: $(UPLOADS)
|
---|
389 | $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
|
---|
390 | $(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^
|
---|
391 |
|
---|
392 |
|
---|
393 | # Rebuild Makefile.in if this file is modifed.
|
---|
394 | Makefile.in: maintMakefile
|
---|
395 |
|
---|
396 | # Copyright (C) 1997-2016 Free Software Foundation, Inc.
|
---|
397 | # This file is part of GNU Make.
|
---|
398 | #
|
---|
399 | # GNU Make is free software; you can redistribute it and/or modify it under
|
---|
400 | # the terms of the GNU General Public License as published by the Free Software
|
---|
401 | # Foundation; either version 3 of the License, or (at your option) any later
|
---|
402 | # version.
|
---|
403 | #
|
---|
404 | # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
---|
405 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
406 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
---|
407 | # details.
|
---|
408 | #
|
---|
409 | # You should have received a copy of the GNU General Public License along with
|
---|
410 | # this program. If not, see <http://www.gnu.org/licenses/>.
|
---|