[53] | 1 | # This is a -*-Makefile-*-, or close enough
|
---|
[503] | 2 | #
|
---|
[3140] | 3 | # Copyright (C) 1997-2016 Free Software Foundation, Inc.
|
---|
[503] | 4 | # This file is part of GNU Make.
|
---|
| 5 | #
|
---|
[1993] | 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.
|
---|
[503] | 10 | #
|
---|
| 11 | # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
---|
[1993] | 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.
|
---|
[503] | 15 | #
|
---|
| 16 | # You should have received a copy of the GNU General Public License along with
|
---|
[1993] | 17 | # this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
[53] | 18 |
|
---|
[3140] | 19 | AUTOMAKE_OPTIONS = dist-bzip2 silent-rules std-options
|
---|
| 20 | ACLOCAL_AMFLAGS = -I config
|
---|
[53] | 21 |
|
---|
[503] | 22 | MAKE_HOST = @MAKE_HOST@
|
---|
| 23 |
|
---|
[280] | 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
|
---|
[3140] | 29 | ossrc =
|
---|
| 30 | else
|
---|
| 31 | ossrc = posixos.c
|
---|
[280] | 32 | endif
|
---|
[53] | 33 |
|
---|
[931] | 34 | # we can safely drop doc and po when bootstrapping kmk.
|
---|
| 35 | # SUBDIRS = glob config po doc $(MAYBE_W32)
|
---|
| 36 | SUBDIRS = glob config $(MAYBE_W32)
|
---|
[280] | 37 |
|
---|
[1340] | 38 | bin_PROGRAMS = kmk kmk_redirect
|
---|
[3140] | 39 | include_HEADERS = gnumake.h
|
---|
[53] | 40 |
|
---|
| 41 | if USE_CUSTOMS
|
---|
| 42 | remote = remote-cstms.c
|
---|
| 43 | else
|
---|
| 44 | remote = remote-stub.c
|
---|
| 45 | endif
|
---|
| 46 |
|
---|
[928] | 47 | kmk_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \
|
---|
[3140] | 48 | function.c getopt.c getopt1.c guile.c implicit.c job.c load.c \
|
---|
| 49 | loadapi.c main.c misc.c $(ossrc) output.c read.c remake.c \
|
---|
| 50 | rule.c signame.c strcache.c variable.c version.c vpath.c \
|
---|
| 51 | hash.c $(remote) \
|
---|
[928] | 52 | \
|
---|
[1724] | 53 | expreval.c \
|
---|
[1797] | 54 | incdep.c \
|
---|
[1869] | 55 | strcache2.c \
|
---|
[2062] | 56 | alloccache.c \
|
---|
[928] | 57 | kbuild.c \
|
---|
[2723] | 58 | kbuild-object.c \
|
---|
[928] | 59 | electric.c \
|
---|
[1340] | 60 | ../lib/md5.c \
|
---|
| 61 | ../lib/kDep.c \
|
---|
[3029] | 62 | ../lib/kbuild_version.c \
|
---|
[3114] | 63 | ../lib/dos2unix.c \
|
---|
[3029] | 64 | ../lib/maybe_con_fwrite.c \
|
---|
[3394] | 65 | ../lib/version_compare.c \
|
---|
[928] | 66 | \
|
---|
| 67 | kmkbuiltin.c \
|
---|
| 68 | kmkbuiltin/append.c \
|
---|
| 69 | kmkbuiltin/cat.c \
|
---|
[1705] | 70 | kmkbuiltin/chmod.c \
|
---|
[1120] | 71 | kmkbuiltin/cmp.c \
|
---|
[1309] | 72 | kmkbuiltin/cmp_util.c \
|
---|
[928] | 73 | kmkbuiltin/cp.c \
|
---|
| 74 | kmkbuiltin/cp_utils.c \
|
---|
| 75 | kmkbuiltin/echo.c \
|
---|
[1707] | 76 | kmkbuiltin/expr.c \
|
---|
[928] | 77 | kmkbuiltin/install.c \
|
---|
[1162] | 78 | kmkbuiltin/kDepIDB.c \
|
---|
[2263] | 79 | kmkbuiltin/kDepObj.c \
|
---|
[1162] | 80 | kmkbuiltin/ln.c \
|
---|
[1154] | 81 | kmkbuiltin/md5sum.c \
|
---|
[928] | 82 | kmkbuiltin/mkdir.c \
|
---|
| 83 | kmkbuiltin/mv.c \
|
---|
| 84 | kmkbuiltin/printf.c \
|
---|
[3029] | 85 | kmkbuiltin/redirect.c \
|
---|
[928] | 86 | kmkbuiltin/rm.c \
|
---|
| 87 | kmkbuiltin/rmdir.c \
|
---|
[2003] | 88 | kmkbuiltin/sleep.c \
|
---|
[1340] | 89 | kmkbuiltin/test.c \
|
---|
[3067] | 90 | kmkbuiltin/touch.c \
|
---|
| 91 | \
|
---|
[928] | 92 | kmkbuiltin/err.c \
|
---|
[3259] | 93 | kmkbuiltin/getopt_r.c \
|
---|
| 94 | kmkbuiltin/getopt1_r.c \
|
---|
[2249] | 95 | kmkbuiltin/fts.c \
|
---|
[928] | 96 | kmkbuiltin/setmode.c \
|
---|
| 97 | kmkbuiltin/strmode.c \
|
---|
| 98 | kmkbuiltin/strlcpy.c \
|
---|
[1183] | 99 | kmkbuiltin/osdep.c \
|
---|
[1598] | 100 | kmkbuiltin/kbuild_protection.c \
|
---|
[3029] | 101 | kmkbuiltin/common-env-and-cwd-opt.c
|
---|
[53] | 102 |
|
---|
[3029] | 103 | kmk_redirect_SOURCES = kmkbuiltin/redirect.c \
|
---|
| 104 | kmkbuiltin/common-env-and-cwd-opt.c \
|
---|
| 105 | kmkbuiltin/err.c \
|
---|
| 106 | ../lib/kbuild_version.c
|
---|
[3259] | 107 | kmk_redirect_CFLAGS = -UKMK -DKMK_BUILTIN_STANDALONE
|
---|
[53] | 108 |
|
---|
[928] | 109 | EXTRA_kmk_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c
|
---|
| 110 |
|
---|
[3140] | 111 | noinst_HEADERS = commands.h dep.h filedef.h job.h makeint.h rule.h variable.h \
|
---|
| 112 | debug.h getopt.h gettext.h hash.h output.h os.h
|
---|
[53] | 113 |
|
---|
[928] | 114 | #kmk_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ @LIBINTL@
|
---|
[3140] | 115 | kmk_LDADD = @LIBOBJS@ @ALLOCA@ $(GLOBLIB) @GETLOADAVG_LIBS@ \
|
---|
| 116 | $(GUILE_LIBS)
|
---|
[280] | 117 | # Only process if target is MS-Windows
|
---|
| 118 | if WINDOWSENV
|
---|
[928] | 119 | kmk_LDADD += $(W32LIB)
|
---|
[280] | 120 | endif
|
---|
[53] | 121 |
|
---|
| 122 | man_MANS = make.1
|
---|
| 123 |
|
---|
[928] | 124 | # org - DEFS = -DLOCALEDIR=\"$(localedir)\" -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\" @DEFS@
|
---|
| 125 | DEFS = \
|
---|
| 126 | -DNO_ARCHIVES \
|
---|
| 127 | -DEXPERIMENTAL \
|
---|
| 128 | -DCONFIG_WITH_TOUPPER_TOLOWER \
|
---|
[1716] | 129 | -DCONFIG_WITH_DEFINED \
|
---|
[928] | 130 | -DCONFIG_WITH_EXPLICIT_MULTITARGET \
|
---|
[2024] | 131 | -DCONFIG_WITH_DOT_MUST_MAKE \
|
---|
[937] | 132 | -DCONFIG_WITH_PREPEND_ASSIGNMENT \
|
---|
[1408] | 133 | -DCONFIG_WITH_LOCAL_VARIABLES \
|
---|
[1701] | 134 | -DCONFIG_WITH_2ND_TARGET_EXPANSION \
|
---|
[1863] | 135 | -DCONFIG_WITH_ALLOC_CACHES \
|
---|
[1870] | 136 | -DCONFIG_WITH_STRCACHE2 \
|
---|
[928] | 137 | \
|
---|
| 138 | -DKMK \
|
---|
| 139 | -DKMK_HELPERS \
|
---|
| 140 | -DCONFIG_NO_DEFAULT_SUFFIXES \
|
---|
| 141 | -DCONFIG_NO_DEFAULT_PATTERN_RULES \
|
---|
| 142 | -DCONFIG_NO_DEFAULT_TERMINAL_RULES \
|
---|
| 143 | -DCONFIG_NO_DEFAULT_SUFFIX_RULES \
|
---|
| 144 | -DCONFIG_NO_DEFAULT_VARIABLES \
|
---|
| 145 | -DCONFIG_WITH_EXTENDED_NOTPARALLEL \
|
---|
| 146 | -DCONFIG_WITH_INCLUDEDEP \
|
---|
[2091] | 147 | -DCONFIG_WITHOUT_THREADS \
|
---|
[928] | 148 | -DCONFIG_WITH_VALUE_LENGTH \
|
---|
[2489] | 149 | \
|
---|
| 150 | -DCONFIG_WITH_ABSPATHEX \
|
---|
| 151 | -DCONFIG_WITH_COMMANDS_FUNC \
|
---|
| 152 | -DCONFIG_WITH_DATE \
|
---|
| 153 | -DCONFIG_WITH_DEFINED_FUNCTIONS \
|
---|
| 154 | -DCONFIG_WITH_EVALPLUS \
|
---|
| 155 | -DCONFIG_WITH_FILE_SIZE \
|
---|
| 156 | -DCONFIG_WITH_LOOP_FUNCTIONS \
|
---|
| 157 | -DCONFIG_WITH_MATH \
|
---|
| 158 | -DCONFIG_WITH_NANOTS \
|
---|
| 159 | -DCONFIG_WITH_ROOT_FUNC \
|
---|
[928] | 160 | -DCONFIG_WITH_RSORT \
|
---|
| 161 | -DCONFIG_WITH_STACK \
|
---|
[2489] | 162 | -DCONFIG_WITH_STRING_FUNCTIONS \
|
---|
[2532] | 163 | -DCONFIG_WITH_WHERE_FUNCTION \
|
---|
[2489] | 164 | -DCONFIG_WITH_WHICH \
|
---|
[928] | 165 | -DCONFIG_WITH_XARGS \
|
---|
[2489] | 166 | \
|
---|
| 167 | -DCONFIG_WITH_COMPARE \
|
---|
[1109] | 168 | -DCONFIG_WITH_SET_CONDITIONALS \
|
---|
[1722] | 169 | -DCONFIG_WITH_IF_CONDITIONALS \
|
---|
[2141] | 170 | -DCONFIG_WITH_PRINTF \
|
---|
[1915] | 171 | -DCONFIG_WITH_MINIMAL_STATS \
|
---|
[928] | 172 | -DCONFIG_PRETTY_COMMAND_PRINTING \
|
---|
[1918] | 173 | -DCONFIG_WITH_PRINT_STATS_SWITCH \
|
---|
[2101] | 174 | -DCONFIG_WITH_PRINT_TIME_SWITCH \
|
---|
[1932] | 175 | -DCONFIG_WITH_RDONLY_VARIABLE_VALUE \
|
---|
[2061] | 176 | -DCONFIG_WITH_LAZY_DEPS_VARS \
|
---|
[928] | 177 | \
|
---|
[2010] | 178 | -DKBUILD_TYPE=\"$(KBUILD_TYPE)\" \
|
---|
| 179 | -DKBUILD_HOST=\"$(KBUILD_TARGET)\" \
|
---|
| 180 | -DKBUILD_HOST_ARCH=\"$(KBUILD_TARGET_ARCH)\" \
|
---|
| 181 | -DKBUILD_HOST_CPU=\"$(KBUILD_TARGET_CPU)\" \
|
---|
[928] | 182 | \
|
---|
[1526] | 183 | -DKBUILD_SVN_REV=1 \
|
---|
[1109] | 184 | -DKBUILD_VERSION_MAJOR=0 \
|
---|
| 185 | -DKBUILD_VERSION_MINOR=1 \
|
---|
[2538] | 186 | -DKBUILD_VERSION_PATCH=9998 \
|
---|
[928] | 187 | \
|
---|
| 188 | -DCONFIG_WITH_KMK_BUILTIN \
|
---|
| 189 | @DEFS@
|
---|
[53] | 190 |
|
---|
[3029] | 191 | AM_CPPFLAGS = $(GLOBINC) -I$(srcdir)/../lib -I$(srcdir)/../lib/kStuff/include
|
---|
[3140] | 192 | AM_CFLAGS = $(GUILE_CFLAGS)
|
---|
[280] | 193 | # Only process if target is MS-Windows
|
---|
| 194 | if WINDOWSENV
|
---|
| 195 | AM_CPPFLAGS += $(W32INC)
|
---|
| 196 | endif
|
---|
[53] | 197 |
|
---|
| 198 |
|
---|
| 199 | # Extra stuff to include in the distribution.
|
---|
| 200 |
|
---|
[3140] | 201 | EXTRA_DIST = ChangeLog README build.sh.in $(man_MANS) \
|
---|
[53] | 202 | README.customs README.OS2 \
|
---|
| 203 | SCOPTIONS SMakefile \
|
---|
| 204 | README.Amiga Makefile.ami config.ami make.lnk amiga.c amiga.h \
|
---|
| 205 | README.DOS Makefile.DOS configure.bat dosbuild.bat configh.dos\
|
---|
| 206 | README.W32 NMakefile config.h.W32 build_w32.bat subproc.bat \
|
---|
[503] | 207 | make_msvc_net2003.sln make_msvc_net2003.vcproj \
|
---|
[3140] | 208 | README.VMS makefile.vms makefile.com config.h-vms \
|
---|
| 209 | vmsdir.h vmsfunctions.c vmsify.c vms_exit.c vms_progname.c \
|
---|
| 210 | vms_export_symbol.c vms_export_symbol_test.com \
|
---|
| 211 | gmk-default.scm gmk-default.h
|
---|
[53] | 212 |
|
---|
[503] | 213 | # This is built during configure, but behind configure's back
|
---|
[53] | 214 |
|
---|
[503] | 215 | DISTCLEANFILES = build.sh
|
---|
[53] | 216 |
|
---|
| 217 | # --------------- Internationalization Section
|
---|
| 218 |
|
---|
| 219 | localedir = $(datadir)/locale
|
---|
| 220 |
|
---|
| 221 | # --------------- Local INSTALL Section
|
---|
| 222 |
|
---|
| 223 | # If necessary, change the gid of the app and turn on the setgid flag.
|
---|
| 224 | #
|
---|
| 225 |
|
---|
| 226 | # Whether or not make needs to be installed setgid.
|
---|
[3140] | 227 | # The value should be either 'true' or 'false'.
|
---|
| 228 | # On many systems, the getloadavg function (used to implement the '-l'
|
---|
[53] | 229 | # switch) will not work unless make is installed setgid kmem.
|
---|
| 230 | #
|
---|
| 231 | inst_setgid = @NEED_SETGID@
|
---|
| 232 |
|
---|
| 233 | # Install make setgid to this group so it can get the load average.
|
---|
| 234 | #
|
---|
| 235 | inst_group = @KMEM_GROUP@
|
---|
| 236 |
|
---|
| 237 | install-exec-local:
|
---|
| 238 | @if $(inst_setgid); then \
|
---|
| 239 | app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
|
---|
| 240 | if chgrp $(inst_group) $$app && chmod g+s $$app; then \
|
---|
| 241 | echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
|
---|
| 242 | else \
|
---|
| 243 | echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
|
---|
[3140] | 244 | echo "otherwise the '-l' option will probably not work."; \
|
---|
[53] | 245 | echo "You may need special privileges to complete the installation"; \
|
---|
| 246 | echo "of $$app."; \
|
---|
| 247 | fi; \
|
---|
| 248 | else true; fi
|
---|
| 249 |
|
---|
[3140] | 250 | # --------------- Generate the Guile default module content
|
---|
| 251 |
|
---|
| 252 | guile.$(OBJEXT): gmk-default.h
|
---|
| 253 | gmk-default.h: $(srcdir)/gmk-default.scm
|
---|
| 254 | (echo 'static const char *const GUILE_module_defn = " '\\ \
|
---|
| 255 | && sed -e 's/;.*//' -e '/^[ \t]*$$/d' -e 's/"/\\"/g' -e 's/$$/ \\/' \
|
---|
| 256 | $(srcdir)/gmk-default.scm \
|
---|
| 257 | && echo '";') > $@
|
---|
| 258 |
|
---|
[53] | 259 | # --------------- Local DIST Section
|
---|
| 260 |
|
---|
| 261 | # Install the w32 and tests subdirectories
|
---|
| 262 | #
|
---|
| 263 | dist-hook:
|
---|
| 264 | (cd $(srcdir); \
|
---|
[3140] | 265 | 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`; \
|
---|
[53] | 266 | tar chf - $$sub) \
|
---|
| 267 | | (cd $(distdir); tar xfBp -)
|
---|
| 268 |
|
---|
| 269 |
|
---|
| 270 | # --------------- Local CHECK Section
|
---|
| 271 |
|
---|
| 272 | check-local: check-regression check-loadavg
|
---|
| 273 | @banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
|
---|
| 274 | dashes=`echo "$$banner" | sed s/./=/g`; \
|
---|
| 275 | echo; \
|
---|
| 276 | echo "$$dashes"; \
|
---|
| 277 | echo "$$banner"; \
|
---|
| 278 | echo "$$dashes"; \
|
---|
| 279 | echo
|
---|
| 280 |
|
---|
| 281 | .PHONY: check-loadavg check-regression
|
---|
| 282 |
|
---|
[280] | 283 | check-loadavg: loadavg$(EXEEXT)
|
---|
[53] | 284 | @echo The system uptime program believes the load average to be:
|
---|
| 285 | -uptime
|
---|
| 286 | @echo The GNU load average checking code thinks:
|
---|
[280] | 287 | -./loadavg$(EXEEXT)
|
---|
[53] | 288 |
|
---|
| 289 | # The loadavg function is invoked during "make check" to test getloadavg.
|
---|
[503] | 290 | check_PROGRAMS = loadavg
|
---|
[53] | 291 | nodist_loadavg_SOURCES = getloadavg.c
|
---|
| 292 | loadavg_CPPFLAGS = -DTEST
|
---|
| 293 | loadavg_LDADD = @GETLOADAVG_LIBS@
|
---|
| 294 |
|
---|
| 295 | # > check-regression
|
---|
| 296 | #
|
---|
| 297 | # Look for the make test suite, and run it if found and we can find perl.
|
---|
| 298 | # If we're building outside the tree, we use symlinks to make a local copy of
|
---|
| 299 | # the test suite. Unfortunately the test suite itself isn't localizable yet.
|
---|
| 300 | #
|
---|
| 301 | MAKETESTFLAGS =
|
---|
| 302 |
|
---|
[3140] | 303 | check-regression: tests/config-flags.pm
|
---|
| 304 | @if test -f '$(srcdir)/tests/run_make_tests'; then \
|
---|
| 305 | ulimit -n 128; \
|
---|
[53] | 306 | if $(PERL) -v >/dev/null 2>&1; then \
|
---|
[3140] | 307 | case `cd '$(srcdir)'; pwd` in `pwd`) : ;; \
|
---|
[53] | 308 | *) test -d tests || mkdir tests; \
|
---|
| 309 | rm -f srctests; \
|
---|
[3140] | 310 | if ln -s '$(srcdir)/tests' srctests; then \
|
---|
[53] | 311 | for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
|
---|
| 312 | rm -f tests/$$f; ln -s ../srctests/$$f tests; \
|
---|
| 313 | done; fi ;; \
|
---|
| 314 | esac; \
|
---|
[3140] | 315 | echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
|
---|
| 316 | cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
|
---|
[53] | 317 | else \
|
---|
| 318 | echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
|
---|
| 319 | fi; \
|
---|
[3140] | 320 | else \
|
---|
[53] | 321 | echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
|
---|
[3140] | 322 | fi
|
---|
[53] | 323 |
|
---|
| 324 |
|
---|
| 325 | # --------------- Maintainer's Section
|
---|
| 326 |
|
---|
[280] | 327 | # Tell automake that I haven't forgotten about this file and it will be
|
---|
[3140] | 328 | # created before we build a distribution (see maintMakefile in the Git
|
---|
[280] | 329 | # distribution).
|
---|
| 330 |
|
---|
| 331 | README:
|
---|
| 332 |
|
---|
[53] | 333 | @MAINT_MAKEFILE@
|
---|