On BSD, realpath(3) doesn't fail if the target doesn't exist, so test
[make.git] / SMakefile.template
blobea737a4a0f4336565d5ed4cbbe6a32121437f30a
1 # -*-Makefile-*- for building GNU make with smake
3 # NOTE: If you have no 'make' program at all to process this makefile,
4 # run 'build.sh' instead.
6 # Copyright (C) 1995-2012 Free Software Foundation, Inc.
7 # This file is part of GNU Make.
9 # GNU Make is free software; you can redistribute it and/or modify it under
10 # the terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 3 of the License, or (at your option) any later
12 # version.
14 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17 # details.
19 # You should have received a copy of the GNU General Public License along with
20 # this program.  If not, see <http://www.gnu.org/licenses/>.
23 #       Makefile for GNU Make
26 # Ultrix 2.2 make doesn't expand the value of VPATH.
27 VPATH = /make-%VERSION%/
28 # This must repeat the value, because configure will remove 'VPATH = .'.
29 srcdir = /make-%VERSION%/
31 CC = sc
32 RM = delete
33 MAKE = smake
35 CFLAGS =
36 CPPFLAGS =
37 LDFLAGS =
39 # Define these for your system as follows:
40 #       -DNO_ARCHIVES           To disable 'ar' archive support.
41 #       -DNO_FLOAT              To avoid using floating-point numbers.
42 #       -DENUM_BITFIELDS        If the compiler isn't GCC but groks enum foo:2.
43 #                               Some compilers apparently accept this
44 #                               without complaint but produce losing code,
45 #                               so beware.
46 # NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
47 # See also 'config.h'.
48 defines =
50 # Which flavor of remote job execution support to use.
51 # The code is found in 'remote-$(REMOTE).c'.
52 REMOTE = stub
54 # If you are using the GNU C library, or have the GNU getopt functions in
55 # your C library, you can comment these out.
56 GETOPT = getopt.o getopt1.o
57 GETOPT_SRC = $(srcdir)getopt.c $(srcdir)getopt1.c $(srcdir)getopt.h
59 # If you are using the GNU C library, or have the GNU glob functions in
60 # your C library, you can comment this out.  GNU make uses special hooks
61 # into the glob functions to be more efficient (by using make's directory
62 # cache for globbing), so you must use the GNU functions even if your
63 # system's C library has the 1003.2 glob functions already.  Also, the glob
64 # functions in the AIX and HPUX C libraries are said to be buggy.
65 GLOB = Lib glob/glob.lib
67 # If your system doesn't have alloca, or the one provided is bad, define this.
68 ALLOCA = alloca.o
69 ALLOCA_SRC = $(srcdir)alloca.c
71 # If your system needs extra libraries loaded in, define them here.
72 # System V probably need -lPW for alloca.  HP-UX 7.0's alloca in
73 # libPW.a is broken on HP9000s300 and HP9000s400 machines.  Use
74 # alloca.c instead on those machines.
75 LOADLIBES =
77 # Any extra object files your system needs.
78 extras = amiga.o
80 # Common prefix for machine-independent installed files.
81 prefix =
82 # Common prefix for machine-dependent installed files.
83 exec_prefix =
85 # Directory to install 'make' in.
86 bindir = sc:c
87 # Directory to find libraries in for '-lXXX'.
88 libdir = lib:
89 # Directory to search by default for included makefiles.
90 includedir = include:
91 # Directory to install the Info files in.
92 infodir = doc:
93 # Directory to install the man page in.
94 mandir = t:
95 # Number to put on the man page filename.
96 manext = 1
97 # Prefix to put on installed 'make' binary file name.
98 binprefix =
99 # Prefix to put on installed 'make' man page file name.
100 manprefix = $(binprefix)
102 # Whether or not make needs to be installed setgid.
103 # The value should be either 'true' or 'false'.
104 # On many systems, the getloadavg function (used to implement the '-l'
105 # switch) will not work unless make is installed setgid kmem.
106 install_setgid = false
107 # Install make setgid to this group so it can read /dev/kmem.
108 group = sys
110 # Program to install 'make'.
111 INSTALL_PROGRAM = copy
112 # Program to install the man page.
113 INSTALL_DATA = copy
114 # Generic install program.
115 INSTALL = copy
117 # Program to format Texinfo source into Info files.
118 MAKEINFO = makeinfo
119 # Program to format Texinfo source into DVI files.
120 TEXI2DVI = texi2dvi
122 # Programs to make tags files.
123 ETAGS = etags -w
124 CTAGS = ctags -w
126 #guile = guile.o
128 objs = commands.o job.o dir.o file.o misc.o main.o read.o remake.o   \
129        rule.o implicit.o default.o variable.o expand.o function.o    \
130        vpath.o version.o ar.o arscan.o signame.o strcache.o hash.o   \
131        remote-$(REMOTE).o $(GLOB) $(GETOPT) $(ALLOCA) $(extras) $(guile)
133 srcs = $(srcdir)commands.c $(srcdir)job.c $(srcdir)dir.c             \
134        $(srcdir)file.c $(srcdir)getloadavg.c $(srcdir)misc.c         \
135        $(srcdir)main.c $(srcdir)read.c $(srcdir)remake.c             \
136        $(srcdir)rule.c $(srcdir)implicit.c $(srcdir)default.c        \
137        $(srcdir)variable.c $(srcdir)expand.c $(srcdir)function.c     \
138        $(srcdir)vpath.c $(srcdir)version.c $(srcdir)hash.c           \
139        $(srcdir)guile.c $(srcdir)remote-$(REMOTE).c                  \
140        $(srcdir)ar.c $(srcdir)arscan.c $(srcdir)strcache.c           \
141        $(srcdir)signame.c $(srcdir)signame.h $(GETOPT_SRC)           \
142        $(srcdir)commands.h $(srcdir)dep.h $(srcdir)file.h            \
143        $(srcdir)job.h $(srcdir)make.h $(srcdir)rule.h                \
144        $(srcdir)variable.h $(ALLOCA_SRC) $(srcdir)config.h.in
147 .SUFFIXES:
148 .SUFFIXES: .o .c .h .ps .dvi .info .texinfo
150 all: make
151 info: make.info
152 dvi: make.dvi
153 # Some makes apparently use .PHONY as the default goal if it is before 'all'.
154 .PHONY: all check info dvi
156 make.info: make.texinfo
157         $(MAKEINFO) -I$(srcdir) $(srcdir)make.texinfo -o make.info
159 make.dvi: make.texinfo
160         $(TEXI2DVI) $(srcdir)make.texinfo
162 make.ps: make.dvi
163         dvi2ps make.dvi > make.ps
165 make: $(objs) glob/glob.lib
166         $(CC) Link $(LDFLAGS) $(objs) $(LOADLIBES) To make.new
167         -delete quiet make
168         rename make.new make
170 # -I. is needed to find config.h in the build directory.
171 .c.o:
172         $(CC) $(defines) IDir "" IDir $(srcdir)glob \
173               $(CPPFLAGS) $(CFLAGS) $< $(OUTPUT_OPTION)
175 glob/glob.lib:
176         execute <<
177             cd glob
178             smake
181 tagsrcs = $(srcs) $(srcdir)remote-*.c
182 TAGS: $(tagsrcs)
183         $(ETAGS) $(tagsrcs)
184 tags: $(tagsrcs)
185         $(CTAGS) $(tagsrcs)
187 .PHONY: install installdirs
188 install:
189         copy make sc:c
191 loadavg: loadavg.c config.h
192         $(CC) $(defines) -DTEST -I. -I$(srcdir) $(CFLAGS) $(LDFLAGS) \
193               loadavg.c $(LOADLIBES) -o $@
195 clean: glob-clean
196         -$(RM) -f make loadavg *.o core make.dvi
198 distclean: clean glob-realclean
199         -$(RM) -f Makefile config.h config.status build.sh
200         -$(RM) -f config.log config.cache
201         -$(RM) -f TAGS tags
202         -$(RM) -f make.?? make.??s make.log make.toc make.*aux
203         -$(RM) -f loadavg.c
205 realclean: distclean
206         -$(RM) -f make.info*
208 mostlyclean: clean
210 .PHONY: glob-clean glob-realclean
212 glob-clean glob-realclean:
213         execute <<
214         cd glob
215         smake $@