1 # -*-Makefile-*- to build GNU make with nmake
3 # NOTE: If you have no 'make' program at all to process this makefile,
4 # run 'build_w32.bat' instead.
6 # Copyright (C) 1996-2016 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
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
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/>.
28 SUBPROC_MAKEFILE=NMakefile
30 CFLAGS_any = /nologo /MT /W4 /GX /Zi /YX /I . /I glob /I w32/include /D WIN32 /D WINDOWS32 /D _CONSOLE /D HAVE_CONFIG_H
31 CFLAGS_debug = $(CFLAGS_any) /Od /D DEBUG /D _DEBUG /FR.\WinDebug/ /Fp.\WinDebug/make.pch /Fo.\WinDebug/ /Fd.\WinDebug/make.pdb
32 CFLAGS_release = $(CFLAGS_any) /O2 /D NDEBUG /FR.\WinRel/ /Fp.\WinRel/make.pch /Fo.\WinRel/
34 LDFLAGS_debug = w32\subproc\WinDebug\subproc.lib /NOLOGO /SUBSYSTEM:console\
35 /STACK:0x400000 /INCREMENTAL:no /PDB:WinDebug/make.pdb /OUT:WinDebug/make.exe /DEBUG
36 LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\
37 /STACK:0x400000 /INCREMENTAL:no /OUT:WinRel/make.exe
39 all: config.h subproc Release Debug
42 # Make sure we build the subproc library first. It has it's own
43 # makefile. To be portable to Windows 95, we put the instructions
44 # on how to build the library into a batch file. On NT, we could
45 # simply have done foo && bar && dog, but this doesn't port.
47 subproc: w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib
49 w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib: w32/subproc/misc.c w32/subproc/sub_proc.c w32/subproc/w32err.c
50 subproc.bat $(SUBPROC_MAKEFILE) $(MAKE)
51 if exist WinDebug\make.exe erase WinDebug\make.exe
52 if exist WinRel\make.exe erase WinRel\make.exe
54 config.h: config.h.W32
58 $(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_release)" CFLAGS="$(CFLAGS_release)" OUTDIR=WinRel WinRel/make.exe
60 $(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_debug)" CFLAGS="$(CFLAGS_debug)" OUTDIR=WinDebug WinDebug/make.exe
63 if exist WinDebug\nul rmdir /s /q WinDebug
64 if exist WinRel\nul rmdir /s /q WinRel
65 if exist w32\subproc\WinDebug\nul rmdir /s /q w32\subproc\WinDebug
66 if exist w32\subproc\WinRel\nul rmdir /s /q w32\subproc\WinRel
67 if exist config.h erase config.h
71 if not exist .\$@\nul mkdir .\$@
73 LIBS = kernel32.lib user32.lib advapi32.lib
75 guile = $(OUTDIR)/guile.obj
79 $(OUTDIR)/arscan.obj \
80 $(OUTDIR)/commands.obj \
81 $(OUTDIR)/default.obj \
83 $(OUTDIR)/expand.obj \
85 $(OUTDIR)/function.obj \
86 $(OUTDIR)/getloadavg.obj \
87 $(OUTDIR)/getopt.obj \
88 $(OUTDIR)/getopt1.obj \
90 $(OUTDIR)/implicit.obj \
95 $(OUTDIR)/output.obj \
97 $(OUTDIR)/remake.obj \
98 $(OUTDIR)/remote-stub.obj \
100 $(OUTDIR)/signame.obj \
101 $(OUTDIR)/strcache.obj \
102 $(OUTDIR)/variable.obj \
103 $(OUTDIR)/version.obj \
104 $(OUTDIR)/vpath.obj \
106 $(OUTDIR)/fnmatch.obj \
107 $(OUTDIR)/dirent.obj \
108 $(OUTDIR)/pathstuff.obj \
109 $(OUTDIR)/posixfcn.obj \
110 $(OUTDIR)/w32os.obj \
113 $(OUTDIR)/make.exe: $(OUTDIR) $(OBJS)
115 $(LDFLAGS) $(LIBS) $(OBJS)
119 $(CC) $(CFLAGS) /c $<
121 $(OUTDIR)/glob.obj : glob/glob.c
122 $(CC) $(CFLAGS) /c $?
123 $(OUTDIR)/fnmatch.obj : glob/fnmatch.c
124 $(CC) $(CFLAGS) /c $?
125 $(OUTDIR)/dirent.obj : w32/compat/dirent.c
126 $(CC) $(CFLAGS) /c $?
127 $(OUTDIR)/posixfcn.obj : w32/compat/posixfcn.c
128 $(CC) $(CFLAGS) /c $?
129 $(OUTDIR)/pathstuff.obj : w32/pathstuff.c
130 $(CC) $(CFLAGS) /c $?
131 $(OUTDIR)/w32os.obj : w32/w32os.c
132 $(CC) $(CFLAGS) /c $?
134 # --------------- DEPENDENCIES
141 $(OUTDIR)/ar.obj: ar.c makeint.h config.h \
145 filedef.h hash.h dep.h
148 $(OUTDIR)/arscan.obj: arscan.c makeint.h config.h \
154 $(OUTDIR)/commands.obj: commands.c makeint.h config.h \
158 filedef.h hash.h dep.h variable.h job.h output.h \
162 $(OUTDIR)/default.obj: default.c makeint.h config.h \
166 filedef.h hash.h variable.h rule.h dep.h job.h \
171 $(OUTDIR)/dir.obj: dir.c makeint.h config.h \
179 $(OUTDIR)/expand.obj: expand.c makeint.h config.h \
183 filedef.h hash.h job.h output.h \
184 commands.h variable.h rule.h
187 $(OUTDIR)/file.obj: file.c makeint.h config.h \
191 filedef.h hash.h dep.h job.h output.h \
192 commands.h variable.h \
196 $(OUTDIR)/function.obj: function.c makeint.h config.h \
200 filedef.h hash.h variable.h dep.h job.h output.h \
203 # .deps/getloadavg.Po
207 $(OUTDIR)/getopt.obj: getopt.c config.h \
210 $(OUTDIR)/getopt1.obj: getopt1.c config.h getopt.h \
213 $(OUTDIR)/guile.obj: guile.c makeint.h config.h \
217 debug.h filedef.h hash.h dep.h variable.h \
221 $(OUTDIR)/hash.obj: hash.c makeint.h config.h \
228 $(OUTDIR)/implicit.obj: implicit.c makeint.h config.h \
232 filedef.h hash.h rule.h dep.h debug.h variable.h job.h output.h \
236 $(OUTDIR)/job.obj: job.c makeint.h config.h \
241 debug.h filedef.h hash.h \
242 commands.h variable.h os.h
245 $(OUTDIR)/load.obj: load.c makeint.h config.h \
250 filedef.h hash.h variable.h
253 $(OUTDIR)/loadapi.obj: loadapi.c makeint.h config.h \
257 filedef.h hash.h variable.h dep.h
259 # .deps/loadavg-getloadavg.Po
263 $(OUTDIR)/main.obj: main.c makeint.h config.h \
268 filedef.h hash.h dep.h variable.h job.h output.h \
269 commands.h rule.h debug.h \
273 $(OUTDIR)/misc.obj: misc.c makeint.h config.h \
277 filedef.h hash.h dep.h debug.h \
280 $(OUTDIR)/output.obj: output.c makeint.h config.h \
288 $(OUTDIR)/posixos.obj: posixos.c makeint.h config.h \
292 debug.h job.h output.h os.h
295 $(OUTDIR)/read.obj: read.c makeint.h config.h \
299 filedef.h hash.h dep.h job.h output.h \
300 commands.h variable.h rule.h \
304 $(OUTDIR)/remake.obj: remake.c makeint.h config.h \
308 filedef.h hash.h job.h output.h \
309 commands.h dep.h variable.h \
312 # .deps/remote-cstms.Po
315 # .deps/remote-stub.Po
316 $(OUTDIR)/remote-stub.obj: remote-stub.c makeint.h \
321 filedef.h hash.h job.h output.h \
325 $(OUTDIR)/rule.obj: rule.c makeint.h config.h \
329 filedef.h hash.h dep.h job.h output.h \
330 commands.h variable.h rule.h
333 $(OUTDIR)/signame.obj: signame.c makeint.h config.h \
339 $(OUTDIR)/strcache.obj: strcache.c makeint.h config.h \
346 $(OUTDIR)/variable.obj: variable.c makeint.h config.h \
350 filedef.h hash.h dep.h job.h output.h \
351 commands.h variable.h rule.h
354 $(OUTDIR)/version.obj: version.c config.h
360 $(OUTDIR)/vpath.obj: vpath.c makeint.h config.h \
364 filedef.h hash.h variable.h