| 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.
|
|---|
| 4 | #
|
|---|
| 5 |
|
|---|
| 6 | # Find the glob source files... this might be dangerous, but we're maintainers!
|
|---|
| 7 | #
|
|---|
| 8 | globsrc := $(wildcard glob/*.c)
|
|---|
| 9 | globhdr := $(wildcard glob/*.h)
|
|---|
| 10 |
|
|---|
| 11 | TEMPLATES = README README.DOS README.W32 README.OS2 \
|
|---|
| 12 | config.ami configh.dos config.h.W32 config.h-vms
|
|---|
| 13 | MTEMPLATES = Makefile.DOS SMakefile
|
|---|
| 14 |
|
|---|
| 15 | all-am: $(TEMPLATES) $(MTEMPLATES) build.sh.in
|
|---|
| 16 |
|
|---|
| 17 | # We need this to ensure that README and build.sh.in are created on time to
|
|---|
| 18 | # avoid errors by automake.
|
|---|
| 19 | #
|
|---|
| 20 | #Makefile.in: README build.sh.in
|
|---|
| 21 |
|
|---|
| 22 | # General rule for turning a .template into a regular file.
|
|---|
| 23 | #
|
|---|
| 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 $@
|
|---|
| 30 |
|
|---|
| 31 | # Construct Makefiles by adding on dependencies, etc.
|
|---|
| 32 | #
|
|---|
| 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 $@
|
|---|
| 45 |
|
|---|
| 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 $@
|
|---|
| 52 |
|
|---|
| 53 | # Construct build.sh.in
|
|---|
| 54 | #
|
|---|
| 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 $@
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 | # Use automake to build a dependency list file, for "foreign" makefiles like
|
|---|
| 64 | # Makefile.DOS.
|
|---|
| 65 | #
|
|---|
| 66 | # Automake used to have a --generate-deps flag, but it's gone now, so we have
|
|---|
| 67 | # to do it ourselves.
|
|---|
| 68 | #
|
|---|
| 69 | .dep_segment: Makefile.am maintMakefile $(DEP_FILES)
|
|---|
| 70 | cat $(DEP_FILES) \
|
|---|
| 71 | | sed -e '/^[^:]*\.[ch] *:/d' \
|
|---|
| 72 | -e 's, /usr/[^ ]*,,g' \
|
|---|
| 73 | -e 's, $(srcdir)/, ,g' \
|
|---|
| 74 | -e '/^ \\$$/d' \
|
|---|
| 75 | > $@
|
|---|
| 76 |
|
|---|
| 77 | # Get rid of everything "else".
|
|---|
| 78 | #
|
|---|
| 79 | maintFILES = configure aclocal.m4 config.h.in Makefile.in stamp-h.in
|
|---|
| 80 |
|
|---|
| 81 | CVS-CLEAN-FILES += $(maintFILES) $(TEMPLATES) $(MTEMPLATES) NMakefile \
|
|---|
| 82 | missing build.sh.in .dep_segment po-check-?
|
|---|
| 83 |
|
|---|
| 84 | # This rule tries to clean the tree right down to how it looks when you do a
|
|---|
| 85 | # virgin CVS checkout.
|
|---|
| 86 |
|
|---|
| 87 | .PHONY: cvs-clean
|
|---|
| 88 | cvs-clean: maintainer-clean
|
|---|
| 89 | -rm -f *~
|
|---|
| 90 | -rm -f config/*~ config/Makefile.in config/[a-z]*
|
|---|
| 91 | -rm -f po/*~ po/Makefile.in.in po/Rules-quot po/[a-z]*
|
|---|
| 92 | -rm -f doc/*~ doc/Makefile.in doc/fdl.texi doc/make-stds.texi \
|
|---|
| 93 | doc/texinfo.tex
|
|---|
| 94 | -rm -f glob/*~ glob/Makefile.in
|
|---|
| 95 | -rm -f ABOUT-NLS $(CVS-CLEAN-FILES)
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | # ----------------------------------------------------------------------
|
|---|
| 99 | #
|
|---|
| 100 | # The sections below were stolen from the Makefile.maint used by fileutils,
|
|---|
| 101 | # sh-utils, textutils, CPPI, Bison, and Autoconf.
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 | ## ---------------- ##
|
|---|
| 105 | ## Updating files. ##
|
|---|
| 106 | ## ---------------- ##
|
|---|
| 107 |
|
|---|
| 108 | WGET = wget --passive-ftp --non-verbose
|
|---|
| 109 | ftp-gnu = ftp://ftp.gnu.org/gnu
|
|---|
| 110 |
|
|---|
| 111 | move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
|
|---|
| 112 | echo $(target) is unchanged; rm -f $(target).t; \
|
|---|
| 113 | else \
|
|---|
| 114 | mv $(target).t $(target); \
|
|---|
| 115 | fi
|
|---|
| 116 |
|
|---|
| 117 | # ------------------- #
|
|---|
| 118 | # Updating PO files. #
|
|---|
| 119 | # ------------------- #
|
|---|
| 120 |
|
|---|
| 121 | po_repo = http://www2.iro.umontreal.ca/%7Egnutra/po/maint/$(PACKAGE)
|
|---|
| 122 | .PHONY: do-po-update po-update
|
|---|
| 123 | do-po-update:
|
|---|
| 124 | tmppo=/tmp/$(PACKAGE)-$(VERSION)-po &&\
|
|---|
| 125 | rm -rf $$tmppo && \
|
|---|
| 126 | mkdir $$tmppo && \
|
|---|
| 127 | (cd $$tmppo && $(WGET) -r -l1 -nd --no-parent -A '*.po' $(po_repo)) &&\
|
|---|
| 128 | cp $$tmppo/*.po po
|
|---|
| 129 | cd po && $(MAKE) update-po
|
|---|
| 130 | $(MAKE) po-check
|
|---|
| 131 |
|
|---|
| 132 | po-update:
|
|---|
| 133 | if test -d "po"; then \
|
|---|
| 134 | $(MAKE) do-po-update; \
|
|---|
| 135 | fi
|
|---|
| 136 |
|
|---|
| 137 | # -------------------------- #
|
|---|
| 138 | # Updating GNU build tools. #
|
|---|
| 139 | # -------------------------- #
|
|---|
| 140 |
|
|---|
| 141 | # The following pseudo table associates a local directory and a URL
|
|---|
| 142 | # with each of the files that belongs to some other package and is
|
|---|
| 143 | # regularly updated from the specified URL.
|
|---|
| 144 | # $(srcdir)/src/ansi2knr.c
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 | wget_files ?= $(srcdir)/doc/texinfo.tex $(srcdir)/doc/make-stds.texi \
|
|---|
| 148 | $(srcdir)/doc/fdl.texi
|
|---|
| 149 |
|
|---|
| 150 | wget-targets = $(patsubst %, get-%, $(wget_files))
|
|---|
| 151 |
|
|---|
| 152 | ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/
|
|---|
| 153 |
|
|---|
| 154 | texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/
|
|---|
| 155 |
|
|---|
| 156 | standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/
|
|---|
| 157 | make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/
|
|---|
| 158 | fdl.texi-url_prefix = $(ftp-gnu)/GNUinfo/
|
|---|
| 159 |
|
|---|
| 160 | target = $(patsubst get-%,%,$@)
|
|---|
| 161 | url = $($(notdir $(target))-url_prefix)$(notdir $(target))
|
|---|
| 162 |
|
|---|
| 163 | .PHONY: $(wget-targets)
|
|---|
| 164 | $(wget-targets):
|
|---|
| 165 | @echo $(WGET) $(url) -O $(target) \
|
|---|
| 166 | && $(WGET) $(url) -O $(target).t \
|
|---|
| 167 | && $(move_if_change)
|
|---|
| 168 |
|
|---|
| 169 | config-prefix = http://savannah.gnu.org/cgi-bin/viewcvs/config
|
|---|
| 170 | config-url = $(config-prefix)/$(patsubst get-%,%,$@)?rev=HEAD
|
|---|
| 171 | get-config/config.guess get-config/config.sub:
|
|---|
| 172 | @echo $(WGET) $(config-url) -O $(target) \
|
|---|
| 173 | && $(WGET) $(config-url) -O $(target).t \
|
|---|
| 174 | && $(move_if_change)
|
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 | .PHONY: wget-update
|
|---|
| 178 | wget-update: $(wget-targets)
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 | # Updating tools via CVS.
|
|---|
| 182 | cvs_files ?= depcomp missing
|
|---|
| 183 | # config/config.guess config/config.sub
|
|---|
| 184 | cvs-targets = $(patsubst %, get-%, $(cvs_files))
|
|---|
| 185 |
|
|---|
| 186 | automake_repo = :pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake
|
|---|
| 187 | .PHONY: $(cvs-targets)
|
|---|
| 188 | $(cvs-targets):
|
|---|
| 189 | $(CVS) -d $(automake_repo) co -p automake/lib/$(notdir $(target)) \
|
|---|
| 190 | >$(target).t \
|
|---|
| 191 | && $(move_if_change)
|
|---|
| 192 |
|
|---|
| 193 | .PHONY: cvs-update
|
|---|
| 194 | cvs-update: $(cvs-targets) get-config/config.guess get-config/config.sub
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 | # --------------------- #
|
|---|
| 198 | # Updating everything. #
|
|---|
| 199 | # --------------------- #
|
|---|
| 200 |
|
|---|
| 201 | .PHONY: update
|
|---|
| 202 | update: wget-update po-update
|
|---|
| 203 |
|
|---|
| 204 | # cvs-update
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 | ## --------------- ##
|
|---|
| 208 | ## Sanity checks. ##
|
|---|
| 209 | ## --------------- ##
|
|---|
| 210 |
|
|---|
| 211 | # Checks that don't require cvs. Run `changelog-check' last as
|
|---|
| 212 | # previous test may reveal problems requiring new ChangeLog entries.
|
|---|
| 213 | local-check: po-check changelog-check
|
|---|
| 214 |
|
|---|
| 215 | # copyright-check writable-files
|
|---|
| 216 |
|
|---|
| 217 | changelog-check:
|
|---|
| 218 | if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
|
|---|
| 219 | :; \
|
|---|
| 220 | else \
|
|---|
| 221 | echo "$(VERSION) not in ChangeLog" 1>&2; \
|
|---|
| 222 | exit 1; \
|
|---|
| 223 | fi
|
|---|
| 224 |
|
|---|
| 225 | # Verify that all source files using _() are listed in po/POTFILES.in.
|
|---|
| 226 | # Ignore make.h; it defines _().
|
|---|
| 227 | po-check:
|
|---|
| 228 | if test -f po/POTFILES.in; then \
|
|---|
| 229 | grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \
|
|---|
| 230 | grep -E -l '\b_\(' *.c *.h | grep -v make.h | sort > $@-2; \
|
|---|
| 231 | diff -u $@-1 $@-2 || exit 1; \
|
|---|
| 232 | rm -f $@-1 $@-2; \
|
|---|
| 233 | fi
|
|---|