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-2013 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 /INCREMENTAL:no /PDB:WinDebug/make.pdb /OUT:WinDebug/make.exe /DEBUG
36 LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\
37 /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 \
94 $(OUTDIR)/output.obj \
96 $(OUTDIR)/remake.obj \
97 $(OUTDIR)/remote-stub.obj \
99 $(OUTDIR)/signame.obj \
100 $(OUTDIR)/strcache.obj \
101 $(OUTDIR)/variable.obj \
102 $(OUTDIR)/version.obj \
103 $(OUTDIR)/vpath.obj \
105 $(OUTDIR)/fnmatch.obj \
106 $(OUTDIR)/dirent.obj \
107 $(OUTDIR)/pathstuff.obj \
110 $(OUTDIR)/make.exe: $(OUTDIR) $(OBJS)
112 $(LDFLAGS) $(LIBS) $(OBJS)
116 $(CC) $(CFLAGS) /c $<
118 $(OUTDIR)/glob.obj : glob/glob.c
119 $(CC) $(CFLAGS) /c $?
120 $(OUTDIR)/fnmatch.obj : glob/fnmatch.c
121 $(CC) $(CFLAGS) /c $?
122 $(OUTDIR)/dirent.obj : w32/compat/dirent.c
123 $(CC) $(CFLAGS) /c $?
124 $(OUTDIR)/pathstuff.obj : w32/pathstuff.c
125 $(CC) $(CFLAGS) /c $?
127 # --------------- DEPENDENCIES
134 $(OUTDIR)/ar.obj: ar.c makeint.h config.h \
138 filedef.h hash.h dep.h \
141 $(OUTDIR)/arscan.obj: arscan.c makeint.h config.h \
147 $(OUTDIR)/commands.obj: commands.c \
152 filedef.h hash.h dep.h \
153 variable.h job.h output.h \
157 $(OUTDIR)/default.obj: default.c makeint.h config.h \
161 filedef.h hash.h variable.h rule.h dep.h job.h output.h \
165 $(OUTDIR)/dir.obj: dir.c makeint.h config.h \
169 hash.h filedef.h dep.h \
172 $(OUTDIR)/expand.obj: expand.c makeint.h config.h \
176 filedef.h hash.h job.h output.h \
177 commands.h variable.h rule.h
180 $(OUTDIR)/file.obj: file.c makeint.h config.h \
184 filedef.h hash.h dep.h job.h output.h \
185 commands.h variable.h \
189 $(OUTDIR)/function.obj: function.c makeint.h config.h \
194 variable.h dep.h job.h output.h \
197 # .deps/getloadavg.Po
201 $(OUTDIR)/getopt.obj: getopt.c config.h \
204 $(OUTDIR)/getopt1.obj: getopt1.c config.h getopt.h \
207 $(OUTDIR)/guile.obj: guile.c makeint.h config.h \
211 debug.h filedef.h hash.h \
216 $(OUTDIR)/hash.obj: hash.c makeint.h config.h \
223 $(OUTDIR)/implicit.obj: implicit.c makeint.h config.h \
227 filedef.h hash.h rule.h \
228 dep.h debug.h variable.h job.h output.h \
232 $(OUTDIR)/job.obj: job.c makeint.h config.h \
237 debug.h filedef.h hash.h \
238 commands.h variable.h
241 $(OUTDIR)/load.obj: load.c makeint.h config.h \
245 debug.h filedef.h hash.h \
249 $(OUTDIR)/loadapi.obj: loadapi.c makeint.h config.h \
256 # .deps/loadavg-getloadavg.Po
260 $(OUTDIR)/main.obj: main.c makeint.h config.h \
264 filedef.h hash.h dep.h \
265 variable.h job.h output.h \
266 commands.h rule.h debug.h \
270 $(OUTDIR)/misc.obj: misc.c makeint.h config.h \
274 filedef.h hash.h dep.h \
278 $(OUTDIR)/output.obj: output.c makeint.h config.h \
285 $(OUTDIR)/read.obj: read.c makeint.h config.h \
289 filedef.h hash.h dep.h job.h output.h \
290 commands.h variable.h rule.h \
294 $(OUTDIR)/remake.obj: remake.c makeint.h config.h \
298 filedef.h hash.h job.h \
300 commands.h dep.h variable.h \
303 # .deps/remote-cstms.Po
306 # .deps/remote-stub.Po
307 $(OUTDIR)/remote-stub.obj: remote-stub.c makeint.h config.h \
311 filedef.h hash.h job.h \
316 $(OUTDIR)/rule.obj: rule.c makeint.h config.h \
320 filedef.h hash.h dep.h job.h output.h \
321 commands.h variable.h rule.h
324 $(OUTDIR)/signame.obj: signame.c makeint.h config.h \
330 $(OUTDIR)/strcache.obj: strcache.c makeint.h config.h \
337 $(OUTDIR)/variable.obj: variable.c makeint.h config.h \
341 filedef.h hash.h dep.h job.h output.h \
342 commands.h variable.h rule.h
345 $(OUTDIR)/version.obj: version.c config.h
351 $(OUTDIR)/vpath.obj: vpath.c makeint.h config.h \