1 # Basic GNU -*-Makefile-*- to build GNU make
4 # If you have no 'make' program at all to process this makefile:
5 # * On Windows, run ".\buildw32.bat" to bootstrap one.
6 # * On MS-DOS, run ".\builddos.bat" to bootstrap one.
8 # Once you have a GNU make program created, you can use it with this makefile
9 # to keep it up to date if you make changes, as:
11 # make.exe -f Basic.mk
13 # Copyright (C) 2017-2022 Free Software Foundation, Inc.
14 # This file is part of GNU Make.
16 # GNU Make is free software; you can redistribute it and/or modify it under
17 # the terms of the GNU General Public License as published by the Free Software
18 # Foundation; either version 3 of the License, or (at your option) any later
21 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
22 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
23 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
26 # You should have received a copy of the GNU General Public License along with
27 # this program. If not, see <https://www.gnu.org/licenses/>.
34 make_SOURCES = $(src)ar.c $(src)arscan.c $(src)commands.c $(src)default.c $(src)dir.c $(src)expand.c $(src)file.c $(src)function.c $(src)getopt.c $(src)getopt1.c $(src)guile.c $(src)hash.c $(src)implicit.c $(src)job.c $(src)load.c $(src)loadapi.c $(src)main.c $(src)misc.c $(src)output.c $(src)read.c $(src)remake.c $(src)rule.c $(src)shuffle.c $(src)signame.c $(src)strcache.c $(src)variable.c $(src)version.c $(src)vpath.c
35 glob_SOURCES = $(lib)fnmatch.c $(lib)glob.c
36 loadavg_SOURCES = $(lib)getloadavg.c
37 alloca_SOURCES = $(lib)alloca.c
38 w32_SOURCES = $(src)w32/pathstuff.c $(src)w32/w32os.c $(src)w32/compat/dirent.c $(src)w32/compat/posixfcn.c $(src)w32/subproc/misc.c $(src)w32/subproc/sub_proc.c $(src)w32/subproc/w32err.c
39 vms_SOURCES = $(src)vms_exit.c $(src)vms_export_symbol.c $(src)vms_progname.c $(src)vmsfunctions.c $(src)vmsify.c
40 amiga_SOURCES = $(src)amiga.c
42 remote_SOURCES = $(src)remote-stub.c
51 INCLUDEDIR = $(PREFIX)/include
52 LIBDIR = $(PREFIX)/lib
53 LOCALEDIR = $(PREFIX)/share
55 PROG = $(OUTDIR)make$(EXEEXT)
57 prog_SOURCES = $(make_SOURCES) $(remote_SOURCES)
61 OBJECTS = $(patsubst %.c,$(OUTDIR)%.$(OBJEXT),$(prog_SOURCES))
63 OBJDIRS = $(addsuffix .,$(sort $(dir $(OBJECTS))))
65 # Use the default value of CC
68 # Reserved for command-line override
73 extra_CPPFLAGS = -DHAVE_CONFIG_H -I$(OUTDIR)src -I$(SRCDIR)/src -I$(OUTDIR)lib -I$(SRCDIR)/lib \
74 -DLIBDIR=\"$(LIBDIR)\" -DINCLUDEDIR=\"$(INCLUDEDIR)\" -DLOCALEDIR=\"$(LOCALDIR)\"
76 extra_LDFLAGS = $(extra_CFLAGS) $(CFLAGS)
84 # $(call COMPILE.cmd,<src>,<tgt>)
85 COMPILE.cmd = $(CC) $(extra_CFLAGS) $(CFLAGS) $(extra_CPPFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OUTPUT_OPTION) $(C_SOURCE) $1
87 # $(call LINK.cmd,<objectlist>)
88 LINK.cmd = $(LD) $(extra_LDFLAGS) $(LDFLAGS) $(TARGET_ARCH) $1 $(LDLIBS) $(LINK_OUTPUT)
90 # $(CHECK.cmd) $(CHECK.args)
91 CHECK.cmd = cd $(SRCDIR)/tests && ./run_make_tests -make $(shell cd $(<D) && pwd)/$(<F)
94 # $(call MKDIR.cmd,<dirlist>)
95 MKDIR.cmd = mkdir -p $1
97 # $(call RM.cmd,<filelist>)
100 # $(call CP.cmd,<from>,<to>)
103 CLEANSPACE = $(call RM.cmd,$(OBJECTS) $(PROG) $(BUILT_SOURCES))
105 # Load overrides for the above variables.
106 include $(firstword $(wildcard $(SRCDIR)/mk/$(lastword $(subst -, ,$(MAKE_HOST)).mk)))
115 $(OBJECTS): $(OUTDIR)%.$(OBJEXT): %.c
116 $(call COMPILE.cmd,$<)
118 $(OBJECTS): | $(OBJDIRS) $(BUILT_SOURCES)
124 $(CHECK.cmd) $(CHECK.args)
129 $(filter %.h,$(BUILT_SOURCES)): %.h : %.in.h
133 .PHONY: all check clean
135 # --------------- DEPENDENCIES
138 $(OBJECTS): $(SRCDIR)/src/mkconfig.h
146 # src/.deps/arscan.Po
149 # src/.deps/commands.Po
152 # src/.deps/default.Po
158 # src/.deps/expand.Po
164 # src/.deps/function.Po
167 # src/.deps/getopt.Po
170 # src/.deps/getopt1.Po
179 # src/.deps/implicit.Po
188 # src/.deps/loadapi.Po
197 # src/.deps/output.Po
200 # src/.deps/posixos.Po
206 # src/.deps/remake.Po
209 # src/.deps/remote-cstms.Po
212 # src/.deps/remote-stub.Po
218 # src/.deps/shuffle.Po
221 # src/.deps/signame.Po
224 # src/.deps/strcache.Po
227 # src/.deps/variable.Po
230 # src/.deps/version.Po
233 # src/.deps/vms_exit.Po
236 # src/.deps/vms_export_symbol.Po
239 # src/.deps/vms_progname.Po
242 # src/.deps/vmsfunctions.Po
245 # src/.deps/vmsify.Po