Try using POSIX::getcwd to find the working directory wherever it exists.
[make.git] / Makefile.am
blob96b30759bfb050292941782c06bd8823f9faa1d7
1 # This is a -*-Makefile-*-, or close enough
3 AUTOMAKE_OPTIONS = 1.8 dist-bzip2 check-news ansi2knr
4 ACLOCAL_AMFLAGS =  -I config
6 # Only process if target is MS-Windows
7 if WINDOWSENV
8   MAYBE_W32 =   w32
9   W32INC =      -I $(top_srcdir)/w32/include
10   W32LIB =      -Lw32 -lw32
11 endif
13 SUBDIRS =       glob config po doc $(MAYBE_W32)
15 bin_PROGRAMS =  make
17 if USE_CUSTOMS
18   remote =      remote-cstms.c
19 else
20   remote =      remote-stub.c
21 endif
24 make_SOURCES =  ar.c arscan.c commands.c default.c dir.c expand.c file.c \
25                 function.c getopt.c getopt1.c implicit.c job.c main.c \
26                 misc.c read.c remake.c $(remote) rule.c signame.c \
27                 variable.c version.c vpath.c hash.c
29 EXTRA_make_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c
31 noinst_HEADERS = commands.h dep.h filedef.h job.h make.h rule.h variable.h \
32                 debug.h getopt.h gettext.h hash.h
34 make_LDADD =    @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ @LIBINTL@
35 # Only process if target is MS-Windows
36 if WINDOWSENV
37     make_LDADD += $(W32LIB)
38 endif
40 man_MANS =      make.1
42 DEFS =          -DLOCALEDIR=\"$(localedir)\" -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" @DEFS@
44 AM_CPPFLAGS =   $(GLOBINC)
45 # Only process if target is MS-Windows
46 if WINDOWSENV
47     AM_CPPFLAGS +=      $(W32INC)
48 endif
51 # Extra stuff to include in the distribution.
52 # Note we need all the glob stuff here, rather than in glob/Makefile.am,
53 # because often that directory isn't built on the systems used by the
54 # maintainers.
56 EXTRA_DIST =    README build.sh.in $(man_MANS) \
57                 README.customs README.OS2 \
58                 SCOPTIONS SMakefile \
59                 README.Amiga Makefile.ami config.ami make.lnk amiga.c amiga.h \
60                 README.DOS Makefile.DOS configure.bat dosbuild.bat configh.dos\
61                 README.W32 NMakefile config.h.W32 build_w32.bat subproc.bat \
62                 make_msvc_net2003.sln make_msvc_net2003.vcproj \
63                 readme.vms makefile.vms makefile.com config.h-vms \
64                 vmsdir.h vmsfunctions.c vmsify.c
66 MAKE_HOST =     @MAKE_HOST@
69 # Forward targets
71 html:
72         cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
74 .PHONY: html
76 # --------------- Internationalization Section
78 localedir =     $(datadir)/locale
80 # --------------- Local INSTALL Section
82 # If necessary, change the gid of the app and turn on the setgid flag.
85 # Whether or not make needs to be installed setgid.
86 # The value should be either `true' or `false'.
87 # On many systems, the getloadavg function (used to implement the `-l'
88 # switch) will not work unless make is installed setgid kmem.
90 inst_setgid = @NEED_SETGID@
92 # Install make setgid to this group so it can get the load average.
94 inst_group = @KMEM_GROUP@
96 install-exec-local:
97         @if $(inst_setgid); then \
98            app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
99            if chgrp $(inst_group) $$app && chmod g+s $$app; then \
100              echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
101            else \
102              echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
103              echo "otherwise the \`-l' option will probably not work."; \
104              echo "You may need special privileges to complete the installation"; \
105              echo "of $$app."; \
106            fi; \
107          else true; fi
109 # --------------- Local DIST Section
111 # Install the w32 and tests subdirectories
113 dist-hook:
114         (cd $(srcdir); \
115          sub=`find w32 tests -follow \( -name CVS -prune -o -name .cvsignore -o -name work -prune \) -o \( -name \*.orig -o -name \*.rej -o -name \*~ -prune \) -o -type f -print`; \
116          tar chf - $$sub) \
117         | (cd $(distdir); tar xfBp -)
120 # --------------- Local CHECK Section
122 check-local: check-regression check-loadavg
123         @banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
124         dashes=`echo "$$banner" | sed s/./=/g`; \
125         echo; \
126         echo "$$dashes"; \
127         echo "$$banner"; \
128         echo "$$dashes"; \
129         echo
131 .PHONY: check-loadavg check-regression
133 check-loadavg: loadavg$(EXEEXT)
134         @echo The system uptime program believes the load average to be:
135         -uptime
136         @echo The GNU load average checking code thinks:
137         -./loadavg$(EXEEXT)
139 # The loadavg function is invoked during "make check" to test getloadavg.
140 noinst_PROGRAMS = loadavg
141 nodist_loadavg_SOURCES = getloadavg.c
142 loadavg_CPPFLAGS = -DTEST
143 loadavg_LDADD = @GETLOADAVG_LIBS@
145 # > check-regression
147 # Look for the make test suite, and run it if found and we can find perl.
148 # If we're building outside the tree, we use symlinks to make a local copy of
149 # the test suite.  Unfortunately the test suite itself isn't localizable yet.
151 MAKETESTFLAGS =
153 check-regression:
154         @if test -f "$(srcdir)/tests/run_make_tests"; then \
155           if $(PERL) -v >/dev/null 2>&1; then \
156             case `cd $(srcdir); pwd` in `pwd`) : ;; \
157               *) test -d tests || mkdir tests; \
158                  rm -f srctests; \
159                  if ln -s "$(srcdir)/tests" srctests; then \
160                    for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
161                      rm -f tests/$$f; ln -s ../srctests/$$f tests; \
162                    done; fi ;; \
163             esac; \
164             echo "cd tests && $(PERL) ./run_make_tests.pl -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
165             cd tests && $(PERL) ./run_make_tests.pl -make ../make$(EXEEXT) $(MAKETESTFLAGS); \
166           else \
167             echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
168           fi; \
169          else \
170           echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
171          fi
174 # --------------- Maintainer's Section
176 # Tell automake that I haven't forgotten about this file and it will be
177 # created before we build a distribution (see maintMakefile in the CVS
178 # distribution).
180 README:
182 @MAINT_MAKEFILE@