Shut MSVC warnings up
[reactos.git] / reactos / Makefile
1 # Well-known targets:
2 #
3 # all (default target)
4 # This target builds all of ReactOS.
5 #
6 # module
7 # These targets builds a single module. Replace module with the name of
8 # the module you want to build.
9 #
10 # bootcd
11 # This target builds an ISO (ReactOS.iso) from which ReactOS can be booted
12 # and installed.
13 #
14 # livecd
15 # This target builds an ISO (ReactOS-Live.iso) from which ReactOS can be
16 # booted, but not installed.
17 #
18 # install
19 # This target installs all of ReactOS to a location specified by the
20 # ROS_INSTALL environment variable.
21 #
22 # module_install
23 # These targets installs a single module to a location specified by the
24 # ROS_INSTALL environment variable. Replace module with the name of the
25 # module you want to install.
26 #
27 # clean
28 # This target cleans (deletes) all files that are generated when building
29 # ReactOS.
30 #
31 # module_clean
32 # These targets cleans (deletes) files that are generated when building a
33 # single module. Replace module with the name of the module you want to
34 # clean.
35 #
36 # depends
37 # This target does a complete dependency check of the ReactOS codebase.
38 # This can require several minutes to complete. If you only need to check
39 # dependencies for a single or few modules then you can use the
40 # module_depends targets instead. This target can also repair a damaged or
41 # missing makefile.auto if needed.
42 #
43 # module_depends
44 # These targets do a dependency check of individual modules. Replace module
45 # with the name of the module for which you want to check dependencies.
46 # This is faster than the depends target which does a complete dependency
47 # check of the ReactOS codebase.
48 #
49 #
50 # Accepted environment variables:
51 #
52 # ROS_PREFIX
53 # This variable specifies the prefix of the MinGW installation. On Windows
54 # a prefix is usually not needed, but on linux it is usually "mingw32". If
55 # not present and no executable named "gcc" can be found, then the prefix is
56 # assumed to be "mingw32". If your gcc is named i386-mingw32-gcc then set
57 # ROS_PREFIX to i386-mingw32. Don't include the dash (-) before gcc.
58 #
59 # ROS_INTERMEDIATE
60 # This variable controls where to put intermediate files. Intermediate
61 # files are generated files that are needed to generate the final
62 # output files. Examples of intermediate files include *.o, *.a, and
63 # *.coff. N.B. Don't put a path separator at the end. The variable
64 # defaults to .\obj-i386.
65 #
66 # ROS_OUTPUT
67 # This variable controls where to put output files. Output files are
68 # generated files that makes up the result of the build process.
69 # Examples of output files include *.exe, *.dll, and *.sys. N.B. Don't
70 # put a path separator at the end. The variable defaults to .\output-i386.
71 #
72 # ROS_TEMPORARY
73 # This variable controls where to put temporary files. Temporary files
74 # are (usually small) generated files that are needed to generate the
75 # intermediate or final output files. Examples of temporary files include
76 # *.rci (preprocessed .rc files for wrc), *.tmp, and *.exp. N.B. Don't put
77 # a path separator at the end. The variable defaults to the current
78 # directory.
79 #
80 # ROS_INSTALL
81 # This variable controls where to install output files to when using
82 # 'make install'. N.B. Don't put a path separator at the end. The variable
83 # defaults to .\reactos.
84 #
85 # ROS_BUILDMAP
86 # This variable controls if map files are to be generated for executable
87 # output files. Map files have the extension .map. The value can be either
88 # full (to build map files with assembly code), yes (to build map files
89 # without source code) or no (to not build any map files). The variable
90 # defaults to no.
91 #
92 # ROS_BUILDNOSTRIP
93 # This variable controls if non-symbol-stripped versions are to be built
94 # of executable output files. Non-symbol-stripped executable output files
95 # have .nostrip added to the filename just before the extension. The value
96 # can be either yes (to build non-symbol-stripped versions of executable
97 # output files) or no (to not build non-symbol-stripped versions of
98 # executable output files). The variable defaults to no.
99 #
100 # ROS_RBUILDFLAGS
101 # Pass parameters to rbuild.
102 # -v Be verbose.
103 # -c Clean as you go. Delete generated files as soon as they are not needed anymore.
104 # -dd Disable automatic dependencies.
105 # -dm{module} Check only automatic dependencies for this module.
106 # -mi Let make handle creation of install directories. Rbuild will not generate the directories.
107 # -ps Generate proxy makefiles in source tree instead of the output tree.
108 # -ud Disable compilation units.
109 # -r Input XML
110 #
111 # ROS_AUTOMAKE
112 # Alternate name of makefile.auto
113 #
114
115 # check for versions of make that don't have features we need...
116 # the function "eval" is only available in 3.80+, which happens to be the minimum
117 # version that has the features we use...
118 # THIS CHECK IS BORROWED FROM THE "GMSL" PROJECT, AND IS COVERED BY THE GPL LICENSE
119 # YOU CAN FIND OUT MORE ABOUT GMSL - A VERY COOL PROJECT - AT:
120 # http://gmsl.sourceforge.net/
121
122 __gmsl_have_eval :=
123 __gmsl_ignore := $(eval __gmsl_have_eval := T)
124
125 ifndef __gmsl_have_eval
126 $(error ReactOS's makefiles use GNU Make 3.80+ features, you have $(MAKE_VERSION), you MUST UPGRADE in order to build ReactOS - Sorry)
127 endif
128 # END of code borrowed from GMSL ( http://gmsl.sourceforge.net/ )
129
130 .PHONY: all
131 .PHONY: clean
132
133 ifeq ($(ROS_AUTOMAKE),)
134 ROS_AUTOMAKE=makefile.auto
135 endif
136
137 all: $(ROS_AUTOMAKE)
138
139
140 .SUFFIXES:
141
142 ifeq ($(HOST),)
143 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
144 ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
145 export OSTYPE = msys
146 HOST=mingw32-linux
147 else
148 HOST=mingw32-windows
149 endif
150 else
151 HOST=mingw32-linux
152 endif
153 endif
154
155 # Default to half-verbose mode
156 ifeq ($(VERBOSE),no)
157 Q = @
158 HALFVERBOSEECHO = no
159 BUILDNO_QUIET = -q
160 else
161 ifeq ($(VERBOSE),full)
162 Q =
163 HALFVERBOSEECHO = no
164 BUILDNO_QUIET =
165 else
166 Q = @
167 HALFVERBOSEECHO = yes
168 BUILDNO_QUIET = -q
169 endif
170 endif
171 ifeq ($(HOST),mingw32-linux)
172 QUOTE = "
173 else
174 QUOTE =
175 endif
176 ifeq ($(HALFVERBOSEECHO),yes)
177 ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
178 ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
179 ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
180 ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
181 ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
182 ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
183 ECHO_GAS =@echo $(QUOTE)[GAS] $<$(QUOTE)
184 ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
185 ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
186 ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
187 ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
188 ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
189 ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
190 ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL] $@$(QUOTE)
191 ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
192 ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
193 ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
194 ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
195 ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
196 ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
197 ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
198 ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
199 ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
200 ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
201 ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
202 ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
203 ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
204 else
205 ECHO_CP =
206 ECHO_MKDIR =
207 ECHO_BUILDNO =
208 ECHO_INVOKE =
209 ECHO_PCH =
210 ECHO_CC =
211 ECHO_GAS =
212 ECHO_NASM =
213 ECHO_AR =
214 ECHO_WINEBLD =
215 ECHO_WRC =
216 ECHO_WIDL =
217 ECHO_BIN2RES =
218 ECHO_DLLTOOL =
219 ECHO_LD =
220 ECHO_NM =
221 ECHO_OBJDUMP =
222 ECHO_RBUILD =
223 ECHO_RSYM =
224 ECHO_WMC =
225 ECHO_NCI =
226 ECHO_CABMAN =
227 ECHO_CDMAKE =
228 ECHO_MKHIVE =
229 ECHO_REGTESTS=
230 ECHO_TEST =
231 ECHO_GENDIB =
232 endif
233
234
235 host_gcc = $(Q)gcc
236 host_gpp = $(Q)g++
237 host_ld = $(Q)ld
238 host_ar = $(Q)ar
239 host_objcopy = $(Q)objcopy
240 ifeq ($(HOST),mingw32-linux)
241 export EXEPREFIX = ./
242 ifeq ($(OSTYPE),msys)
243 export EXEPOSTFIX = .exe
244 else
245 export EXEPOSTFIX =
246 endif
247 export SEP = /
248 mkdir = -$(Q)mkdir -p
249 gcc = $(Q)$(PREFIX)-gcc
250 gpp = $(Q)$(PREFIX)-g++
251 ld = $(Q)$(PREFIX)-ld
252 nm = $(Q)$(PREFIX)-nm
253 objdump = $(Q)$(PREFIX)-objdump
254 ar = $(Q)$(PREFIX)-ar
255 objcopy = $(Q)$(PREFIX)-objcopy
256 dlltool = $(Q)$(PREFIX)-dlltool
257 windres = $(Q)$(PREFIX)-windres
258 rm = $(Q)rm -f
259 cp = $(Q)cp
260 NUL = /dev/null
261 else # mingw32-windows
262 ifeq ($(OSTYPE),msys)
263 HOST=mingw32-linux
264 export EXEPREFIX = ./
265 export EXEPOSTFIX = .exe
266 export SEP = /
267 mkdir = -$(Q)mkdir -p
268 gcc = $(Q)gcc
269 gpp = $(Q)g++
270 ld = $(Q)ld
271 nm = $(Q)nm
272 objdump = $(Q)objdump
273 ar = $(Q)ar
274 objcopy = $(Q)objcopy
275 dlltool = $(Q)dlltool
276 windres = $(Q)windres
277 rm = $(Q)rm -f
278 cp = $(Q)cp
279 NUL = /dev/null
280 else
281 export EXEPREFIX =
282 export EXEPOSTFIX = .exe
283 ROS_EMPTY =
284 export SEP = \$(ROS_EMPTY)
285 mkdir = -$(Q)mkdir
286 gcc = $(Q)gcc
287 gpp = $(Q)g++
288 ld = $(Q)ld
289 nm = $(Q)nm
290 objdump = $(Q)objdump
291 ar = $(Q)ar
292 objcopy = $(Q)objcopy
293 dlltool = $(Q)dlltool
294 windres = $(Q)windres
295 rm = $(Q)del /f /q
296 cp = $(Q)copy /y
297 NUL = NUL
298 endif
299 endif
300
301 ifneq ($(ROS_INTERMEDIATE),)
302 INTERMEDIATE := $(ROS_INTERMEDIATE)
303 else
304 INTERMEDIATE := obj-i386
305 endif
306 INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
307
308 ifneq ($(ROS_OUTPUT),)
309 OUTPUT := $(ROS_OUTPUT)
310 else
311 OUTPUT := output-i386
312 endif
313 OUTPUT_ := $(OUTPUT)$(SEP)
314
315 ifneq ($(ROS_TEMPORARY),)
316 TEMPORARY := $(ROS_TEMPORARY)
317 else
318 TEMPORARY :=
319 endif
320 TEMPORARY_ := $(TEMPORARY)$(SEP)
321
322 ifneq ($(ROS_INSTALL),)
323 INSTALL := $(ROS_INSTALL)
324 else
325 INSTALL := reactos
326 endif
327 INSTALL_ := $(INSTALL)$(SEP)
328
329 $(INTERMEDIATE):
330 ${mkdir} $@
331
332 ifneq ($(INTERMEDIATE),$(OUTPUT))
333 $(OUTPUT):
334 ${mkdir} $@
335 endif
336
337
338 NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
339 KERNEL32_MC = lib$(SEP)kernel32$(SEP)kernel32.mc
340 BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
341 BUGCODES_H = include$(SEP)reactos$(SEP)bugcodes.h
342 BUGCODES_RC = ntoskrnl$(SEP)bugcodes.rc
343 ERRCODES_H = include$(SEP)reactos$(SEP)errcodes.h
344 ERRCODES_RC = lib$(SEP)kernel32$(SEP)errcodes.rc
345
346 include lib/lib.mak
347 include tools/tools.mak
348 include boot/freeldr/bootsect/bootsect.mak
349 -include $(ROS_AUTOMAKE)
350
351 PREAUTO := \
352 $(BIN2C_TARGET) \
353 $(BIN2RES_TARGET) \
354 $(BUILDNO_H) \
355 $(BUGCODES_H) \
356 $(BUGCODES_RC) \
357 $(ERRCODES_H) \
358 $(ERRCODES_RC) \
359 $(NCI_SERVICE_FILES) \
360 $(GENDIB_DIB_FILES)
361
362 $(ROS_AUTOMAKE): $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
363 $(ECHO_RBUILD)
364 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
365
366 .PHONY: msvc
367 msvc: $(RBUILD_TARGET)
368 $(ECHO_RBUILD)
369 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) msvc
370
371 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
372 $(ECHO_WMC)
373 $(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
374
375 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
376 $(ECHO_WMC)
377 $(Q)$(WMC_TARGET) -i -U -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
378
379 .PHONY: msvc6
380 msvc6: $(RBUILD_TARGET)
381 $(ECHO_RBUILD)
382 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs6.00 msvc
383
384 .PHONY: msvc7
385 msvc7: $(RBUILD_TARGET)
386 $(ECHO_RBUILD)
387 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 msvc
388
389 .PHONY: msvc71
390 msvc71: $(RBUILD_TARGET)
391 $(ECHO_RBUILD)
392 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 msvc
393
394 .PHONY: msvc8
395 msvc8: $(RBUILD_TARGET)
396 $(ECHO_RBUILD)
397 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 msvc
398
399 .PHONY: makefile_auto_clean
400 makefile_auto_clean:
401 -@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)
402
403 .PHONY: clean
404 clean: makefile_auto_clean
405
406 .PHONY: depends
407 depends:
408 @-$(rm) makefile.auto
409 @$(MAKE) $(filter-out depends, $(MAKECMDGOALS))