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 all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
18 # We need this to ensure that README and build.sh.in are created on time to
19 # avoid errors by automake.
21 #Makefile.in: README build.sh.in
23 # General rule for turning a .template into a regular file.
25 $(TEMPLATES) : % : %.template Makefile
27 sed -e 's@%VERSION%@$(VERSION)@g' \
28 -e 's@%PACKAGE%@$(PACKAGE)@g' \
32 # Construct Makefiles by adding on dependencies, etc.
34 $(MTEMPLATES) : % : %.template .dep_segment Makefile
36 sed -e 's@%VERSION%@$(VERSION)@g' \
37 -e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
38 -e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
39 -e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
40 -e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
41 -e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
43 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
47 NMakefile: NMakefile.template .dep_segment Makefile
50 echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
51 sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
54 # Construct build.sh.in
56 build.sh.in: build.template Makefile
58 sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \
59 -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc))@g' \
64 # Use automake to build a dependency list file, for "foreign" makefiles like
67 # Automake used to have a --generate-deps flag, but it's gone now, so we have
70 .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
72 | sed -e '/^[^:]*\.[ch] *:/d' \
73 -e 's, /usr/[^ ]*,,g' \
74 -e 's, $(srcdir)/, ,g' \
78 # Get rid of everything "else".
80 maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
82 CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
83 build.sh.in .deps .dep_segment ABOUT-NLS \
86 # This rule tries to clean the tree right down to how it looks when you do a
87 # virgin CVS checkout.
89 # This is potentially dangerous since it removes _ANY FILE_ that is not in
90 # CVS. Including files you might mean to add to CVS but haven't yet...
91 # I only use this in subdirectories where it's unlikely we have any new
93 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";'
96 cvs-clean: maintainer-clean
97 -rm -rf *~ $(CVS-CLEAN-FILES)
98 -cd config && $(cvsclean)
100 -cd doc && $(cvsclean)
101 -cd glob && $(cvsclean)
104 # ----------------------------------------------------------------------
106 # The sections below were stolen from the Makefile.maint used by fileutils,
107 # sh-utils, textutils, CPPI, Bison, and Autoconf.
110 ## ---------------- ##
111 ## Updating files. ##
112 ## ---------------- ##
114 WGET = wget --passive-ftp --non-verbose
115 ftp-gnu = ftp://ftp.gnu.org/gnu
117 move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
118 echo $(target) is unchanged; rm -f $(target).t; \
120 mv $(target).t $(target); \
123 # ------------------- #
124 # Updating PO files. #
125 # ------------------- #
127 po_repo = http://www2.iro.umontreal.ca/%7Egnutra/po/maint/$(PACKAGE)
128 .PHONY: do-po-update po-update
130 tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
133 (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
135 cd po && $(MAKE) update-po
139 if test -d "po"; then \
140 $(MAKE) do-po-update; \
143 # -------------------------- #
144 # Updating GNU build tools. #
145 # -------------------------- #
147 # The following pseudo table associates a local directory and a URL
148 # with each of the files that belongs to some other package and is
149 # regularly updated from the specified URL.
151 wget_files ?= $(srcdir)/doc/make-stds.texi $(srcdir)/doc/fdl.texi
153 wget-targets = $(patsubst %, get-%, $(wget_files))
155 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
157 standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
158 make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
159 fdl.texi-url_prefix = $(ftp-gnu)/GNUinfo/
161 target = $(patsubst get-%,%,$@)
162 url = $($(notdir $(target))-url_prefix)$(notdir $(target))
164 .PHONY: $(wget-targets)
166 @echo $(WGET) $(url) -O $(target) \
167 && $(WGET) $(url) -O $(target).t \
170 savannah-url = http://savannah.gnu.org/cgi-bin/viewcvs
171 viewcvs-suffix = \?rev=HEAD\&content-type=text/plain
173 config-url = $(savannah-url)/config/config/$(patsubst get-config/%,%,$@)$(viewcvs-suffix)
174 get-config/config.guess get-config/config.sub:
175 @echo $(WGET) $(config-url) -O $(target) \
176 && $(WGET) $(config-url) -O $(target).t \
179 gnulib-url = $(savannah-url)/gnulib/gnulib/config/$(patsubst get-config/%,%,$@)$(viewcvs-suffix)
181 get-config/texinfo.tex:
182 @echo $(WGET) $(gnulib-url) -O $(target) \
183 && $(WGET) $(gnulib-url) -O $(target).t \
188 wget-update: $(wget-targets)
191 # Updating tools via CVS.
192 # cvs_files ?= depcomp missing
193 # cvs-targets = $(patsubst %, get-%, $(cvs_files))
195 # automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
196 # .PHONY: $(cvs-targets)
198 # $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
200 # && $(move_if_change)
205 cvs-update: get-config/texinfo.tex get-config/config.guess get-config/config.sub
208 # --------------------- #
209 # Updating everything. #
210 # --------------------- #
213 update: wget-update po-update cvs-update
216 ## --------------- ##
218 ## --------------- ##
220 # Checks that don't require cvs. Run `changelog-check' last as
221 # previous test may reveal problems requiring new ChangeLog entries.
222 local-check: po-check changelog-check
224 # copyright-check writable-files
227 if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
230 echo "$(VERSION) not in ChangeLog" 1>&2; \
234 # Verify that all source files using _() are listed in po/POTFILES.in.
235 # Ignore make.h; it defines _().
237 if test -f po/POTFILES.in; then \
238 grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
239 grep -E -l '\b_\(' *.c *.h | grep -v make.h | sort > $@-2; \
240 diff -u $@-1 $@-2 || exit 1; \
244 ## ------------------------- ##
245 ## GNU FTP upload artifacts. ##
246 ## ------------------------- ##
248 # This target creates the upload artifacts.
249 # Sign it with my key.
252 GPGFLAGS = -u 6338B6D4
254 DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES))
255 DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES))
258 distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
260 $(DIST_ARCHIVES_DIRECTIVE): .directive.asc
264 @echo "Signing file '$<':"
265 $(GPG) $(GPGFLAGS) -o $@ -b $<
268 @echo "Creating directive file '$@':"
269 @echo 'directory: make' > .directive
270 $(GPG) $(GPGFLAGS) -o $@ --clearsign .directive
273 # Upload the artifacts
276 gnu-url = ftp-upload.gnu.org /incoming
278 UPLOADS = upload-alpha upload-ftp
280 $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
281 $(FTPPUT) $(gnu-url)/$(@:upload-%=%) $^