parallel build
[platform/upstream/make.git] / Makefile.am
1 # This is a -*-Makefile-*-, or close enough
2 #
3 # Copyright (C) 1997-2013 Free Software Foundation, Inc.
4 # This file is part of GNU Make.
5 #
6 # GNU Make is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free Software
8 # Foundation; either version 3 of the License, or (at your option) any later
9 # version.
10 #
11 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
12 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14 # details.
15 #
16 # You should have received a copy of the GNU General Public License along with
17 # this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 AUTOMAKE_OPTIONS = 1.8 dist-bzip2 check-news
20 ACLOCAL_AMFLAGS =  -I config
21
22 MAKE_HOST =     @MAKE_HOST@
23
24 # Only process if target is MS-Windows
25 if WINDOWSENV
26   MAYBE_W32 =   w32
27   W32INC =      -I $(top_srcdir)/w32/include
28   W32LIB =      -Lw32 -lw32
29 endif
30
31 SUBDIRS =       glob config po doc $(MAYBE_W32)
32
33 bin_PROGRAMS =  make
34 include_HEADERS = gnumake.h
35
36 if USE_CUSTOMS
37   remote =      remote-cstms.c
38 else
39   remote =      remote-stub.c
40 endif
41
42 make_SOURCES =  ar.c arscan.c commands.c default.c dir.c expand.c file.c \
43                 function.c getopt.c getopt1.c implicit.c job.c load.c \
44                 loadapi.c main.c misc.c output.c read.c remake.c rule.c \
45                 signame.c strcache.c variable.c version.c vpath.c hash.c \
46                 $(remote)
47
48 if HAVE_GUILE
49   make_SOURCES += guile.c
50 endif
51
52 EXTRA_make_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c
53
54 noinst_HEADERS = commands.h dep.h filedef.h job.h makeint.h rule.h variable.h \
55                 debug.h getopt.h gettext.h hash.h output.h
56
57 make_LDADD =    @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ @LIBINTL@ \
58                 $(GUILE_LIBS)
59 # Only process if target is MS-Windows
60 if WINDOWSENV
61     make_LDADD += $(W32LIB)
62 endif
63
64 man_MANS =      make.1
65
66 DEFS =          -DLOCALEDIR=\"$(localedir)\" -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" @DEFS@
67
68 AM_CPPFLAGS =   $(GLOBINC)
69 AM_CFLAGS =     $(GUILE_CFLAGS)
70 # Only process if target is MS-Windows
71 if WINDOWSENV
72     AM_CPPFLAGS +=      $(W32INC)
73 endif
74
75
76 # Extra stuff to include in the distribution.
77
78 EXTRA_DIST =    README build.sh.in $(man_MANS) \
79                 README.customs README.OS2 \
80                 SCOPTIONS SMakefile \
81                 README.Amiga Makefile.ami config.ami make.lnk amiga.c amiga.h \
82                 README.DOS Makefile.DOS configure.bat dosbuild.bat configh.dos\
83                 README.W32 NMakefile config.h.W32 build_w32.bat subproc.bat \
84                 make_msvc_net2003.sln make_msvc_net2003.vcproj \
85                 README.VMS makefile.vms makefile.com config.h-vms \
86                 vmsdir.h vmsfunctions.c vmsify.c \
87                 gmk-default.scm gmk-default.h
88
89 # This is built during configure, but behind configure's back
90
91 DISTCLEANFILES = build.sh
92
93 # Forward targets
94
95 html:
96         cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
97
98 .PHONY: html
99
100 # --------------- Internationalization Section
101
102 localedir =     $(datadir)/locale
103
104 # --------------- Local INSTALL Section
105
106 # If necessary, change the gid of the app and turn on the setgid flag.
107 #
108
109 # Whether or not make needs to be installed setgid.
110 # The value should be either 'true' or 'false'.
111 # On many systems, the getloadavg function (used to implement the '-l'
112 # switch) will not work unless make is installed setgid kmem.
113 #
114 inst_setgid = @NEED_SETGID@
115
116 # Install make setgid to this group so it can get the load average.
117 #
118 inst_group = @KMEM_GROUP@
119
120 install-exec-local:
121         @if $(inst_setgid); then \
122            app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
123            if chgrp $(inst_group) $$app && chmod g+s $$app; then \
124              echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
125            else \
126              echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
127              echo "otherwise the '-l' option will probably not work."; \
128              echo "You may need special privileges to complete the installation"; \
129              echo "of $$app."; \
130            fi; \
131          else true; fi
132
133 # --------------- Generate the Guile default module content
134
135 guile.$(OBJEXT): gmk-default.h
136 gmk-default.h: $(srcdir)/gmk-default.scm
137         (echo 'static const char *const GUILE_module_defn = " '\\ \
138           && sed -e 's/;.*//' -e '/^[ \t]*$$/d' -e 's/"/\\"/g' -e 's/$$/ \\/' \
139                  $(srcdir)/gmk-default.scm \
140           && echo '";') > $@
141
142 # --------------- Local DIST Section
143
144 # Install the w32 and tests subdirectories
145 #
146 dist-hook:
147         (cd $(srcdir); \
148          sub=`find w32 tests -follow \( -name .git -o -name .deps -o -name work -o -name .gitignore -o -name \*.orig -o -name \*.rej -o -name \*~ -o -name Makefile \) -prune -o -type f -print`; \
149          tar chf - $$sub) \
150         | (cd $(distdir); tar xfBp -)
151
152
153 # --------------- Local CHECK Section
154
155 check-local: check-regression check-loadavg
156         @banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
157         dashes=`echo "$$banner" | sed s/./=/g`; \
158         echo; \
159         echo "$$dashes"; \
160         echo "$$banner"; \
161         echo "$$dashes"; \
162         echo
163
164 .PHONY: check-loadavg check-regression
165
166 check-loadavg: loadavg$(EXEEXT)
167         @echo The system uptime program believes the load average to be:
168         -uptime
169         @echo The GNU load average checking code thinks:
170         -./loadavg$(EXEEXT)
171
172 # The loadavg function is invoked during "make check" to test getloadavg.
173 check_PROGRAMS = loadavg
174 nodist_loadavg_SOURCES = getloadavg.c
175 loadavg_CPPFLAGS = -DTEST
176 loadavg_LDADD = @GETLOADAVG_LIBS@
177
178 # > check-regression
179 #
180 # Look for the make test suite, and run it if found and we can find perl.
181 # If we're building outside the tree, we use symlinks to make a local copy of
182 # the test suite.  Unfortunately the test suite itself isn't localizable yet.
183 #
184 MAKETESTFLAGS =
185
186 check-regression:
187         @if test -f '$(srcdir)/tests/run_make_tests'; then \
188           if $(PERL) -v >/dev/null 2>&1; then \
189             case `cd '$(srcdir)'; pwd` in `pwd`) : ;; \
190               *) test -d tests || mkdir tests; \
191                  rm -f srctests; \
192                  if ln -s '$(srcdir)/tests' srctests; then \
193                    for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
194                      rm -f tests/$$f; ln -s ../srctests/$$f tests; \
195                    done; fi ;; \
196             esac; \
197             echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
198             cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
199           else \
200             echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
201           fi; \
202          else \
203           echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
204          fi
205
206
207 # --------------- Maintainer's Section
208
209 # Tell automake that I haven't forgotten about this file and it will be
210 # created before we build a distribution (see maintMakefile in the Git
211 # distribution).
212
213 README:
214
215 @MAINT_MAKEFILE@