* New feature: .LIBPATTERNS controls the way -lfoo dependencies are expanded.
[make/kirr.git] / Makefile.am
blob3bfaf47c93f4f02e68fa51c532a64b2ff7507e26
1 # -*-Makefile-*-, or close enough
3 AUTOMAKE_OPTIONS = 1.3
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@ glob/libglob.a
15 info_TEXINFOS = make.texinfo
16 man_MANS =      make.1
18 INCLUDES =      -DLIBDIR=\"$(libdir)\" -DINCLUDEDIR=\"$(includedir)\"
20 BUILT_SOURCES = README build.sh.in
22 EXTRA_DIST =    $(BUILT_SOURCES) $(man_MANS) README.customs remote-cstms.c\
23                 make-stds.texi texinfo.tex SCOPTIONS SMakefile\
24                 README.Amiga Makefile.ami config.ami make.lnk amiga.c amiga.h\
25                 README.DOS Makefile.DOS configure.bat dosbuild.bat configh.dos\
26                 README.W32 NMakefile config.h.W32 build_w32.bat subproc.bat\
27                 readme.vms makefile.vms makefile.com config.h-vms vmsdir.h\
28                 vmsfunctions.c vmsify.c
30 SUBDIRS =       glob
32 MOSTLYCLEANFILES = loadavg.c
33 CLEANFILES =    loadavg
36 # --------------- Local INSTALL Section
38 # If necessary, change the gid of the app and turn on the setgid flag.
41 # Whether or not make needs to be installed setgid.
42 # The value should be either `true' or `false'.
43 # On many systems, the getloadavg function (used to implement the `-l'
44 # switch) will not work unless make is installed setgid kmem.
46 inst_setgid = @NEED_SETGID@
48 # Install make setgid to this group so it can get the load average.
50 inst_group = @KMEM_GROUP@
52 install-exec-local:
53         @if $(inst_setgid); then \
54            app=$(DESTDIR)$(bindir)/`echo $(bin_PROGRAMS)|sed '$(transform)'`; \
55            if chgrp $(inst_group) $$app && chmod g+s $$app; then \
56              echo "chgrp $(inst_group) $$app && chmod g+s $$app"; \
57            else \
58              echo "$$app needs to be owned by group $(inst_group) and setgid;"; \
59              echo "otherwise the \`-l' option will probably not work."; \
60              echo "You may need special privileges to complete the installation"; \
61              echo "of $$app."; \
62            fi; \
63          else true; fi
65 # --------------- Local DIST Section
67 # Install the w32 subdirectory
69 dist-hook:
70         (cd $(srcdir); \
71          w32=`find w32 -follow \( -name CVS -prune \) -o \( -name \*.orig -o -name \*.rej -o -name \*~ -prune \) -o -type f -print`; \
72          tar chf - $$w32) \
73         | (cd $(distdir); tar xfBp -)
76 # --------------- Local CHECK Section
78 check-local: check-loadavg check-regression
79 .PHONY: check-loadavg check-regression
81 # > check-loadavg
83 loadavg: loadavg.c config.h
84         @rm -f loadavg
85         $(LINK) -I. -I$(srcdir) -DHAVE_CONFIG_H -DTEST $(make_LDFLAGS) loadavg.c $(LIBS)
87 # We copy getloadavg.c into a different file rather than compiling it
88 # directly because some compilers clobber getloadavg.o in the process.
90 loadavg.c: getloadavg.c
91         ln $(srcdir)/getloadavg.c loadavg.c || \
92           cp $(srcdir)/getloadavg.c loadavg.c
94 check-loadavg: loadavg
95         @echo The system uptime program believes the load average to be:
96         -uptime
97         @echo The GNU load average checking code believes:
98         -./loadavg
100 # > check-regression
102 # Look for the make test suite, and run it if found.  Look in MAKE_TEST if
103 # specified, or else in the srcdir or the distdir, their parents, and _their_
104 # parents.
106 MAKETESTFLAGS =
108 check-regression: all
109         @here=`pwd`; testdir=""; \
110           case "$(MAKE_TEST)" in "") \
111             for d1 in $$here $(srcdir); do \
112               for d2 in ../.. .. .; do \
113                 all=`echo $$d1/$$d2/make-test-[0-9]*/run_make_tests`; \
114                 case "$$all" in \
115                   "$$d1/$$d2/make-test-[0-9]*/run_make_tests") : ;; \
116                   *) try=`for x in $$all; do echo $$x; done | sort | tail -1`;\
117                      testdir=`dirname $$try` ;; esac; \
118             done; done ;; \
119             *) testdir="$(MAKE_TEST)" ;; \
120           esac; \
121           case "$$testdir" in \
122             "") echo "Couldn't find make-test-* regression test suite."; exit 0;; \
123           esac; \
124           echo "cd $$testdir && ./run_make_tests -make $$here/make $(MAKETESTFLAGS)"; \
125           cd $$testdir && ./run_make_tests -make $$here/make $(MAKETESTFLAGS)
128 # --------------- Maintainer's Section
130 if MAINT_MAKEFILE
131 # Note this requires GNU make.  Not to worry, since it will only be included
132 # in the Makefile if we're in the maintainer's environment.
133 # Ulp!  Need a leading space to "hide" this include from automake's new (in
134 # 1.4) include feature :(
135  include $(srcdir)/maintMakefile
136 endif