* Added the test suite to the main distribution.
[make.git] / Makefile.am
blobb157f27c2257903e3137e1a1c8b501ed512a30ae
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 =      -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
34 # --------------- Local INSTALL Section
36 # If necessary, change the gid of the app and turn on the setgid flag.
39 # Whether or not make needs to be installed setgid.
40 # The value should be either `true' or `false'.
41 # On many systems, the getloadavg function (used to implement the `-l'
42 # switch) will not work unless make is installed setgid kmem.
44 inst_setgid = @NEED_SETGID@
46 # Install make setgid to this group so it can get the load average.
48 inst_group = @KMEM_GROUP@
50 install-exec-local:
51         @if $(inst_setgid); then \
52            app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
53            if chgrp $(inst_group) $$app && chmod g+s $$app; then \
54              echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
55            else \
56              echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
57              echo "otherwise the \`-l' option will probably not work."; \
58              echo "You may need special privileges to complete the installation"; \
59              echo "of $$app."; \
60            fi; \
61          else true; fi
63 # --------------- Local DIST Section
65 # Install the w32 and tests subdirectories
67 dist-hook:
68         (cd $(srcdir); \
69          sub=`find w32 tests -follow \( -name CVS -prune \) -o \( -name \*.orig -o -name \*.rej -o -name \*~ -prune \) -o -type f -print`; \
70          tar chf - $$sub) \
71         | (cd $(distdir); tar xfBp -)
74 # --------------- Local CHECK Section
76 check-local: check-regression check-loadavg
77 .PHONY: check-loadavg check-regression
79 # > check-loadavg
81 loadavg: loadavg.c config.h
82         @rm -f loadavg
83         $(LINK) $(DEFS) $(CPPFLAGS) -DTEST $(make_LDFLAGS) loadavg.c $(LIBS)
85 # We copy getloadavg.c into a different file rather than compiling it
86 # directly because some compilers clobber getloadavg.o in the process.
88 loadavg.c: getloadavg.c
89         ln $(srcdir)/getloadavg.c loadavg.c || \
90           cp $(srcdir)/getloadavg.c loadavg.c
92 check-loadavg: loadavg
93         @echo The system uptime program believes the load average to be:
94         -uptime
95         @echo The GNU load average checking code believes:
96         -./loadavg
98 # > check-regression
100 # Look for the make test suite, and run it if found and we can find perl.
101 # If we're building outside the tree, we use symlinks to make a local copy of
102 # the test suite.  Unfortunately the test suite itself isn't localizable yet.
104 MAKETESTFLAGS =
106 check-regression:
107         @if test -f "$(srcdir)/tests/run_make_tests"; then \
108           if $(PERL) -v >/dev/null 2>&1; then \
109             case `cd $(srcdir); pwd` in `pwd`) : ;; \
110               *) mkdir tests; \
111                  if ln -s "$(srcdir)/tests" srctests; then \
112                    for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
113                      rm -f tests/$$f; ln -s ../srctests/$$f tests; \
114                    done; fi ;; \
115             esac; \
116             echo "cd tests && ./run_make_tests -make ../make $(MAKETESTFLAGS)"; \
117             cd tests && ./run_make_tests -make ../make $(MAKETESTFLAGS); \
118           else \
119             echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
120           fi; \
121          else \
122           echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
123          fi
126 # --------------- Local CLEAN section
128 maintainer-clean-local:
129         -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
132 # --------------- Maintainer's Section
134 @MAINT_MAKEFILE@