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