* Ensure -Iglob comes before any user-specified CPPFLAGS.
[make.git] / Makefile.am
blob483d012392c1499e58c787f403538cb585679b0f
1 # This is a -*-Makefile-*-, or close enough
3 AUTOMAKE_OPTIONS = 1.4
5 bin_PROGRAMS =  make
7 make_SOURCES =  main.c commands.c job.c dir.c file.c misc.c read.c remake.c \
8                 rule.c implicit.c default.c variable.c expand.c function.c \
9                 vpath.c version.c ar.c arscan.c remote-$(REMOTE).c \
10                 commands.h dep.h filedef.h job.h make.h rule.h variable.h \
11                 signame.c signame.h \
12                 getopt.c getopt1.c getopt.h
13 make_LDADD =    @LIBOBJS@ @ALLOCA@ @GLOBLIB@
15 info_TEXINFOS = make.texinfo
16 man_MANS =      make.1
18 INCLUDES =      @GLOBINC@ -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\"
20 EXTRA_DIST =    README build.sh.in $(man_MANS) README.customs remote-cstms.c\
21                 make-stds.texi texinfo.tex SCOPTIONS SMakefile\
22                 README.Amiga Makefile.ami config.ami make.lnk amiga.c amiga.h\
23                 README.DOS Makefile.DOS configure.bat dosbuild.bat configh.dos\
24                 README.W32 NMakefile config.h.W32 build_w32.bat subproc.bat\
25                 readme.vms makefile.vms makefile.com config.h-vms vmsdir.h\
26                 vmsfunctions.c vmsify.c
28 SUBDIRS =       glob
30 MOSTLYCLEANFILES = loadavg.c
31 CLEANFILES =    loadavg
33 MAKE_HOST = @MAKE_HOST@
36 # --------------- Local INSTALL Section
38 # If necessary, change the gid of the app and turn on the setgid flag.
41 # Whether or not make needs to be installed setgid.
42 # The value should be either `true' or `false'.
43 # On many systems, the getloadavg function (used to implement the `-l'
44 # switch) will not work unless make is installed setgid kmem.
46 inst_setgid = @NEED_SETGID@
48 # Install make setgid to this group so it can get the load average.
50 inst_group = @KMEM_GROUP@
52 install-exec-local:
53         @if $(inst_setgid); then \
54            app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
55            if chgrp $(inst_group) $$app && chmod g+s $$app; then \
56              echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
57            else \
58              echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
59              echo "otherwise the \`-l' option will probably not work."; \
60              echo "You may need special privileges to complete the installation"; \
61              echo "of $$app."; \
62            fi; \
63          else true; fi
65 # --------------- Local DIST Section
67 # Install the w32 and tests subdirectories
69 dist-hook:
70         (cd $(srcdir); \
71          sub=`find w32 tests -follow \( -name CVS -prune -o -name work -prune \) -o \( -name \*.orig -o -name \*.rej -o -name \*~ -prune \) -o -type f -print`; \
72          tar chf - $$sub) \
73         | (cd $(distdir); tar xfBp -)
76 # --------------- Local CHECK Section
78 check-local: check-regression check-loadavg
79         @banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
80         dashes=`echo "$$banner" | sed s/./=/g`; \
81         echo; \
82         echo "$$dashes"; \
83         echo "$$banner"; \
84         echo "$$dashes"; \
85         echo
87 .PHONY: check-loadavg check-regression
89 # > check-loadavg
91 loadavg: loadavg.c config.h
92         @rm -f loadavg
93         $(LINK) $(DEFS) $(CPPFLAGS) -DTEST $(make_LDFLAGS) loadavg.c $(LIBS)
95 # We copy getloadavg.c into a different file rather than compiling it
96 # directly because some compilers clobber getloadavg.o in the process.
98 loadavg.c: getloadavg.c
99         ln $(srcdir)/getloadavg.c loadavg.c || \
100           cp $(srcdir)/getloadavg.c loadavg.c
102 check-loadavg: loadavg
103         @echo The system uptime program believes the load average to be:
104         -uptime
105         @echo The GNU load average checking code believes:
106         -./loadavg
108 # > check-regression
110 # Look for the make test suite, and run it if found and we can find perl.
111 # If we're building outside the tree, we use symlinks to make a local copy of
112 # the test suite.  Unfortunately the test suite itself isn't localizable yet.
114 MAKETESTFLAGS =
116 check-regression:
117         @if test -f "$(srcdir)/tests/run_make_tests"; then \
118           if $(PERL) -v >/dev/null 2>&1; then \
119             case `cd $(srcdir); pwd` in `pwd`) : ;; \
120               *) test -d tests || mkdir tests; \
121                  rm -f srctests; \
122                  if ln -s "$(srcdir)/tests" srctests; then \
123                    for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
124                      rm -f tests/$$f; ln -s ../srctests/$$f tests; \
125                    done; fi ;; \
126             esac; \
127             echo "cd tests && $(PERL) ./run_make_tests.pl -make ../make $(MAKETESTFLAGS)"; \
128             cd tests && $(PERL) ./run_make_tests.pl -make ../make $(MAKETESTFLAGS); \
129           else \
130             echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
131           fi; \
132          else \
133           echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
134          fi
137 # --------------- Local CLEAN section
139 maintainer-clean-local:
140         -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
143 # --------------- Maintainer's Section
145 @MAINT_MAKEFILE@