VirtualBox

source: kBuild/trunk/src/kmk/maintMakefile@ 3387

Last change on this file since 3387 was 3140, checked in by bird, 6 years ago

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

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

© 2023 Oracle
ContactPrivacy policyTerms of Use