Of course, I forgot to commit the new file in revision 22049...
[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 .PHONY: world
133 .PHONY: universe
134
135 ifeq ($(ROS_AUTOMAKE),)
136 ROS_AUTOMAKE=makefile.auto
137 endif
138
139 all: $(ROS_AUTOMAKE)
140
141
142 .SUFFIXES:
143
144 ifeq ($(HOST),)
145 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
146 ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
147 export OSTYPE = msys
148 HOST=mingw32-linux
149 else
150 HOST=mingw32-windows
151 endif
152 else
153 HOST=mingw32-linux
154 endif
155 endif
156
157 # Default to half-verbose mode
158 ifeq ($(VERBOSE),no)
159 Q = @
160 HALFVERBOSEECHO = no
161 BUILDNO_QUIET = -q
162 else
163 ifeq ($(VERBOSE),full)
164 Q =
165 HALFVERBOSEECHO = no
166 BUILDNO_QUIET =
167 else
168 Q = @
169 HALFVERBOSEECHO = yes
170 BUILDNO_QUIET = -q
171 endif
172 endif
173 ifeq ($(HOST),mingw32-linux)
174 QUOTE = "
175 else
176 QUOTE =
177 endif
178 ifeq ($(HALFVERBOSEECHO),yes)
179 ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
180 ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
181 ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
182 ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
183 ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
184 ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
185 ECHO_GAS =@echo $(QUOTE)[GAS] $<$(QUOTE)
186 ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
187 ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
188 ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
189 ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
190 ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
191 ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
192 ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL] $@$(QUOTE)
193 ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
194 ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
195 ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
196 ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
197 ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
198 ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
199 ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
200 ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
201 ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
202 ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
203 ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
204 ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
205 ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
206 else
207 ECHO_CP =
208 ECHO_MKDIR =
209 ECHO_BUILDNO =
210 ECHO_INVOKE =
211 ECHO_PCH =
212 ECHO_CC =
213 ECHO_GAS =
214 ECHO_NASM =
215 ECHO_AR =
216 ECHO_WINEBLD =
217 ECHO_WRC =
218 ECHO_WIDL =
219 ECHO_BIN2RES =
220 ECHO_DLLTOOL =
221 ECHO_LD =
222 ECHO_NM =
223 ECHO_OBJDUMP =
224 ECHO_RBUILD =
225 ECHO_RSYM =
226 ECHO_WMC =
227 ECHO_NCI =
228 ECHO_CABMAN =
229 ECHO_CDMAKE =
230 ECHO_MKHIVE =
231 ECHO_REGTESTS=
232 ECHO_TEST =
233 ECHO_GENDIB =
234 endif
235
236
237 host_gcc = $(Q)gcc
238 host_gpp = $(Q)g++
239 host_ld = $(Q)ld
240 host_ar = $(Q)ar
241 host_objcopy = $(Q)objcopy
242 ifeq ($(HOST),mingw32-linux)
243 export EXEPREFIX = ./
244 ifeq ($(OSTYPE),msys)
245 export EXEPOSTFIX = .exe
246 else
247 export EXEPOSTFIX =
248 endif
249 export SEP = /
250 mkdir = -$(Q)mkdir -p
251 gcc = $(Q)$(PREFIX)-gcc
252 gpp = $(Q)$(PREFIX)-g++
253 ld = $(Q)$(PREFIX)-ld
254 nm = $(Q)$(PREFIX)-nm
255 objdump = $(Q)$(PREFIX)-objdump
256 ar = $(Q)$(PREFIX)-ar
257 objcopy = $(Q)$(PREFIX)-objcopy
258 dlltool = $(Q)$(PREFIX)-dlltool
259 windres = $(Q)$(PREFIX)-windres
260 rm = $(Q)rm -f
261 cp = $(Q)cp
262 NUL = /dev/null
263 else # mingw32-windows
264 ifeq ($(OSTYPE),msys)
265 HOST=mingw32-linux
266 export EXEPREFIX = ./
267 export EXEPOSTFIX = .exe
268 export SEP = /
269 mkdir = -$(Q)mkdir -p
270 gcc = $(Q)gcc
271 gpp = $(Q)g++
272 ld = $(Q)ld
273 nm = $(Q)nm
274 objdump = $(Q)objdump
275 ar = $(Q)ar
276 objcopy = $(Q)objcopy
277 dlltool = $(Q)dlltool
278 windres = $(Q)windres
279 rm = $(Q)rm -f
280 cp = $(Q)cp
281 NUL = /dev/null
282 else
283 export EXEPREFIX =
284 export EXEPOSTFIX = .exe
285 ROS_EMPTY =
286 export SEP = \$(ROS_EMPTY)
287 mkdir = -$(Q)mkdir
288 gcc = $(Q)gcc
289 gpp = $(Q)g++
290 ld = $(Q)ld
291 nm = $(Q)nm
292 objdump = $(Q)objdump
293 ar = $(Q)ar
294 objcopy = $(Q)objcopy
295 dlltool = $(Q)dlltool
296 windres = $(Q)windres
297 rm = $(Q)del /f /q
298 cp = $(Q)copy /y
299 NUL = NUL
300 endif
301 endif
302
303 ifneq ($(ROS_INTERMEDIATE),)
304 INTERMEDIATE := $(ROS_INTERMEDIATE)
305 else
306 INTERMEDIATE := obj-i386
307 endif
308 INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
309
310 ifneq ($(ROS_OUTPUT),)
311 OUTPUT := $(ROS_OUTPUT)
312 else
313 OUTPUT := output-i386
314 endif
315 OUTPUT_ := $(OUTPUT)$(SEP)
316
317 ifneq ($(ROS_TEMPORARY),)
318 TEMPORARY := $(ROS_TEMPORARY)
319 else
320 TEMPORARY :=
321 endif
322 TEMPORARY_ := $(TEMPORARY)$(SEP)
323
324 ifneq ($(ROS_INSTALL),)
325 INSTALL := $(ROS_INSTALL)
326 else
327 INSTALL := reactos
328 endif
329 INSTALL_ := $(INSTALL)$(SEP)
330
331 $(INTERMEDIATE):
332 ${mkdir} $@
333
334 ifneq ($(INTERMEDIATE),$(OUTPUT))
335 $(OUTPUT):
336 ${mkdir} $@
337 endif
338
339
340 NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
341 KERNEL32_MC = dll$(SEP)win32$(SEP)kernel32$(SEP)kernel32.mc
342 BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
343 BUGCODES_H = include$(SEP)reactos$(SEP)bugcodes.h
344 BUGCODES_RC = ntoskrnl$(SEP)bugcodes.rc
345 ERRCODES_H = include$(SEP)reactos$(SEP)errcodes.h
346 ERRCODES_RC = dll$(SEP)win32$(SEP)kernel32$(SEP)errcodes.rc
347
348 include lib/lib.mak
349 include tools/tools.mak
350 include boot/freeldr/bootsect/bootsect.mak
351 -include $(ROS_AUTOMAKE)
352
353 PREAUTO := \
354 $(BIN2C_TARGET) \
355 $(BIN2RES_TARGET) \
356 $(BUILDNO_H) \
357 $(BUGCODES_H) \
358 $(BUGCODES_RC) \
359 $(ERRCODES_H) \
360 $(ERRCODES_RC) \
361 $(NCI_SERVICE_FILES) \
362 $(GENDIB_DIB_FILES)
363
364 $(ROS_AUTOMAKE): $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
365 $(ECHO_RBUILD)
366 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
367
368 world: all bootcd livecd
369
370 universe:
371 $(MAKE) KDBG=1 DBG=1 \
372 ROS_AUTOMAKE=makefile-$(ARCH)-kd.auto \
373 ROS_INSTALL=reactos-$(ARCH)-kd \
374 ROS_INTERMEDIATE=obj-$(ARCH)-kd \
375 ROS_OUTPUT=output-$(ARCH)-kd \
376 world
377 $(MAKE) KDBG=0 DBG=1 \
378 ROS_AUTOMAKE=makefile-$(ARCH)-d.auto \
379 ROS_INSTALL=reactos-$(ARCH)-d \
380 ROS_INTERMEDIATE=obj-$(ARCH)-d \
381 ROS_OUTPUT=output-$(ARCH)-d \
382 world
383 $(MAKE) KDBG=0 DBG=0 \
384 ROS_AUTOMAKE=makefile-$(ARCH)-r.auto \
385 ROS_INSTALL=reactos-$(ARCH)-r \
386 ROS_INTERMEDIATE=obj-$(ARCH)-r \
387 ROS_OUTPUT=output-$(ARCH)-r \
388 world
389
390 .PHONY: msvc
391 msvc: $(RBUILD_TARGET)
392 $(ECHO_RBUILD)
393 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) msvc
394
395 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
396 $(ECHO_WMC)
397 $(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
398
399 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
400 $(ECHO_WMC)
401 $(Q)$(WMC_TARGET) -i -U -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
402
403 .PHONY: msvc6
404 msvc6: $(RBUILD_TARGET)
405 $(ECHO_RBUILD)
406 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs6.00 msvc
407
408 .PHONY: msvc7
409 msvc7: $(RBUILD_TARGET)
410 $(ECHO_RBUILD)
411 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 msvc
412
413 .PHONY: msvc71
414 msvc71: $(RBUILD_TARGET)
415 $(ECHO_RBUILD)
416 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 msvc
417
418 .PHONY: msvc8
419 msvc8: $(RBUILD_TARGET)
420 $(ECHO_RBUILD)
421 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 msvc
422
423 .PHONY: msvc6_clean
424 msvc6_clean: $(RBUILD_TARGET)
425 $(ECHO_RBUILD)
426 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs6.00 msvc
427
428 .PHONY: msvc7_clean
429 msvc7_clean: $(RBUILD_TARGET)
430 $(ECHO_RBUILD)
431 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.00 msvc
432
433 .PHONY: msvc71_clean
434 msvc71_clean: $(RBUILD_TARGET)
435 $(ECHO_RBUILD)
436 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 msvc
437
438 .PHONY: msvc8_clean
439 msvc8_clean: $(RBUILD_TARGET)
440 $(ECHO_RBUILD)
441 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.00 msvc
442
443 .PHONY: msvc_clean
444 msvc_clean: $(RBUILD_TARGET)
445 $(ECHO_RBUILD)
446 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c msvc
447
448 .PHONY: msvc_clean_all
449 msvc_clean_all: $(RBUILD_TARGET)
450 $(ECHO_RBUILD)
451 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs6.00 msvc
452 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.00 msvc
453 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 msvc
454 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.10 msvc
455
456 .PHONY: msvc7_install_debug
457 msvc7_install_debug: $(RBUILD_TARGET)
458 $(ECHO_RBUILD)
459 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcdebug msvc
460
461 .PHONY: msvc7_install_release
462 msvc7_install_release: $(RBUILD_TARGET)
463 $(ECHO_RBUILD)
464 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcrelease msvc
465
466 .PHONY: msvc7_install_speed
467 msvc7_install_speed: $(RBUILD_TARGET)
468 $(ECHO_RBUILD)
469 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcspeed msvc
470
471 .PHONY: msvc71_install_debug
472 msvc71_install_debug: $(RBUILD_TARGET)
473 $(ECHO_RBUILD)
474 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcdebug msvc
475
476 .PHONY: msvc71_install_release
477 msvc71_install_release: $(RBUILD_TARGET)
478 $(ECHO_RBUILD)
479 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcrelease msvc
480
481
482 .PHONY: msvc71_install_speed
483 msvc71_install_speed: $(RBUILD_TARGET)
484 $(ECHO_RBUILD)
485 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcspeed msvc
486
487 .PHONY: msvc8_install_debug
488 msvc8_install_debug: $(RBUILD_TARGET)
489 $(ECHO_RBUILD)
490 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcdebug msvc
491
492 .PHONY: msvc8_install_release
493 msvc8_install_release: $(RBUILD_TARGET)
494 $(ECHO_RBUILD)
495 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcrelease msvc
496
497 .PHONY: msvc8_install_speed
498 msvc8_install_speed: $(RBUILD_TARGET)
499 $(ECHO_RBUILD)
500 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcspeed msvc
501
502 .PHONY: makefile_auto_clean
503 makefile_auto_clean:
504 -@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)
505
506 .PHONY: clean
507 clean: makefile_auto_clean
508
509 .PHONY: depends
510 depends:
511 @-$(rm) makefile.auto
512 @$(MAKE) $(filter-out depends, $(MAKECMDGOALS))