VMS fix.
[make.git] / maintMakefile
blobf08c3ccf9760371c05e473a3a6022b2f665948a2
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 -W
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
26         rm -f $@
27         sed -e 's@%VERSION%@$(VERSION)@g' \
28             -e 's@%PACKAGE%@$(PACKAGE)@g' \
29           $< > $@
30         chmod a-w $@
32 # Construct Makefiles by adding on dependencies, etc.
34 $(MTEMPLATES) : % : %.template .dep_segment Makefile
35         rm -f $@
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' \
42           $< > $@
43         echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
44           cat $(word 2,$^) >>$@
45         chmod a-w $@
47 NMakefile: NMakefile.template .dep_segment Makefile
48         rm -f $@
49         cp $< $@
50         echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
51           sed 's/^\([^ ]*\)\.o:/$$(OUTDIR)\/\1.obj:/' $(word 2,$^) >>$@
52         chmod a-w $@
54 # Construct build.sh.in
56 build.sh.in: build.template Makefile
57         rm -f $@
58         sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out remote-%,$(make_OBJECTS)))@g' \
59             -e 's@%globobjs%@$(patsubst %.c,%.$${OBJEXT},$(globsrc)))@g' \
60           $< > $@
61         chmod a-w+x $@
64 # Use automake to build a dependency list file, for "foreign" makefiles like
65 # Makefile.DOS.
67 # Automake used to have a --generate-deps flag, but it's gone now, so we have
68 # to do it ourselves.
70 .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
71         cat $(DEP_FILES) \
72           | sed -e '/^[^:]*\.[ch] *:/d' \
73                 -e 's, /usr/[^ ]*,,g' \
74                 -e 's, $(srcdir)/, ,g' \
75                 -e '/^ \\$$/d' \
76           > $@
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                         missing build.sh.in .dep_segment po-check-?
85 # This rule tries to clean the tree right down to how it looks when you do a
86 # virgin CVS checkout.
88 .PHONY: cvs-clean
89 cvs-clean: maintainer-clean
90         -rm -f *~
91         -rm -f config/*~ config/Makefile.in config/[a-z]*
92         -rm -f po/*~ po/Makefile.in.in po/Rules-quot po/[a-z]*
93         -rm -f doc/*~ doc/Makefile.in doc/fdl.texi doc/make-stds.texi \
94                 doc/texinfo.tex
95         -rm -f glob/*~ glob/Makefile.in
96         -rm -f ABOUT-NLS $(CVS-CLEAN-FILES)
99 # ----------------------------------------------------------------------
101 # The sections below were stolen from the Makefile.maint used by fileutils,
102 # sh-utils, textutils, CPPI, Bison, and Autoconf.
105 ## ---------------- ##
106 ## Updating files.  ##
107 ## ---------------- ##
109 WGET = wget --passive-ftp --non-verbose
110 ftp-gnu = ftp://ftp.gnu.org/gnu
112 move_if_change =  if test -r $(target) && cmp -s $(target).t $(target); then \
113                     echo $(target) is unchanged; rm -f $(target).t; \
114                   else \
115                     mv $(target).t $(target); \
116                   fi
118 # ------------------- #
119 # Updating PO files.  #
120 # ------------------- #
122 po_repo = http://www2.iro.umontreal.ca/%7Egnutra/po/maint/$(PACKAGE)
123 .PHONY: do-po-update po-update
124 do-po-update:
125         tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
126         rm -rf $$tmppo && \
127         mkdir $$tmppo && \
128         (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
129         cp $$tmppo/*.po po
130         cd po && $(MAKE) update-po
131         $(MAKE) po-check
133 po-update:
134         if test -d "po"; then \
135           $(MAKE) do-po-update; \
136         fi
138 # -------------------------- #
139 # Updating GNU build tools.  #
140 # -------------------------- #
142 # The following pseudo table associates a local directory and a URL
143 # with each of the files that belongs to some other package and is
144 # regularly updated from the specified URL.
145 #              $(srcdir)/src/ansi2knr.c
148 wget_files ?= $(srcdir)/doc/texinfo.tex $(srcdir)/doc/make-stds.texi \
149               $(srcdir)/doc/fdl.texi
151 wget-targets = $(patsubst %, get-%, $(wget_files))
153 ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
155 texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
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)
165 $(wget-targets):
166         @echo $(WGET) $(url) -O $(target) \
167           && $(WGET) $(url) -O $(target).t \
168           && $(move_if_change)
170 config-prefix = http://savannah.gnu.org/cgi-bin/viewcvs/config
171 config-url = $(config-prefix)/$(patsubst get-%,%,$@)?rev=HEAD
172 get-config/config.guess get-config/config.sub:
173         @echo $(WGET) $(config-url) -O $(target) \
174           && $(WGET) $(config-url) -O $(target).t \
175           && $(move_if_change)
178 .PHONY: wget-update
179 wget-update: $(wget-targets)
182 # Updating tools via CVS.
183 cvs_files ?= depcomp missing
184 # config/config.guess config/config.sub
185 cvs-targets = $(patsubst %, get-%, $(cvs_files))
187 automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
188 .PHONY: $(cvs-targets)
189 $(cvs-targets):
190         $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
191           >$(target).t \
192             && $(move_if_change)
194 .PHONY: cvs-update
195 cvs-update: $(cvs-targets) get-config/config.guess get-config/config.sub
198 # --------------------- #
199 # Updating everything.  #
200 # --------------------- #
202 .PHONY: update
203 update: wget-update po-update
205 # cvs-update
208 ## --------------- ##
209 ## Sanity checks.  ##
210 ## --------------- ##
212 # Checks that don't require cvs.  Run `changelog-check' last as
213 # previous test may reveal problems requiring new ChangeLog entries.
214 local-check: po-check changelog-check
216 # copyright-check writable-files
218 changelog-check:
219         if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
220           :; \
221         else \
222           echo "$(VERSION) not in ChangeLog" 1>&2; \
223           exit 1; \
224         fi
226 # Verify that all source files using _() are listed in po/POTFILES.in.
227 # Ignore make.h; it defines _().
228 po-check:
229         if test -f po/POTFILES.in; then \
230           grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
231           grep -E -l '\b_\(' *.c *.h | grep -v make.h | sort > $@-2; \
232           diff -u $@-1 $@-2 || exit 1; \
233           rm -f $@-1 $@-2; \
234         fi