4 # This target builds all of ReactOS.
7 # These targets builds a single module. Replace module with the name of
8 # the module you want to build.
11 # This target builds an ISO (ReactOS.iso) from which ReactOS can be booted
15 # This target builds an ISO (ReactOS-Live.iso) from which ReactOS can be
16 # booted, but not installed.
19 # This target installs all of ReactOS to a location specified by the
20 # ROS_INSTALL environment variable.
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.
28 # This target cleans (deletes) all files that are generated when building
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
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-{ROS_ARCH}.auto if needed.
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.
50 # Accepted environment variables:
53 # This variable specifies the name of the architecture to build ReactOS for.
54 # The variable defaults to i386.
57 # This variable specifies the prefix of the MinGW installation. On Windows
58 # a prefix is usually not needed, but on linux it is usually "mingw32". If
59 # not present and no executable named "gcc" can be found, then the prefix is
60 # assumed to be "mingw32". If your gcc is named i386-mingw32-gcc then set
61 # ROS_PREFIX to i386-mingw32. Don't include the dash (-) before gcc.
64 # This variable controls where to put intermediate files. Intermediate
65 # files are generated files that are needed to generate the final
66 # output files. Examples of intermediate files include *.o, *.a, and
67 # *.coff. N.B. Don't put a path separator at the end. The variable
68 # defaults to .\obj-{ROS_ARCH}.
71 # This variable controls where to put output files. Output files are
72 # generated files that makes up the result of the build process.
73 # Examples of output files include *.exe, *.dll, and *.sys. N.B. Don't
74 # put a path separator at the end. The variable defaults to .\output-{ROS_ARCH}.
77 # This variable controls the name of the ReactOS directory on cdrom.
78 # The variable defaults to reactos.
79 # Warning: setting this value may lead to a not bootable/installable cdrom.
82 # This variable controls where to put temporary files. Temporary files
83 # are (usually small) generated files that are needed to generate the
84 # intermediate or final output files. Examples of temporary files include
85 # *.rci (preprocessed .rc files for wrc), *.tmp, and *.exp. N.B. Don't put
86 # a path separator at the end. The variable defaults to the current
90 # This variable controls where to install output files to when using
91 # 'make install'. N.B. Don't put a path separator at the end. The variable
92 # defaults to .\{ROS_CDOUTPUT}.
95 # This variable controls if map files are to be generated for executable
96 # output files. Map files have the extension .map. The value can be either
97 # full (to build map files with assembly code), yes (to build map files
98 # without source code) or no (to not build any map files). The variable
102 # This variable controls if non-symbol-stripped versions are to be built
103 # of executable output files. Non-symbol-stripped executable output files
104 # have .nostrip added to the filename just before the extension. The value
105 # can be either yes (to build non-symbol-stripped versions of executable
106 # output files) or no (to not build non-symbol-stripped versions of
107 # executable output files). The variable defaults to no.
110 # This variable controls if all binaries should be stripped out of useless
111 # data added by GCC/LD as well as of RSYM symbol data. Output binary size
112 # will go from 80 to 40MB, memory usage from 58 to 38MB and the install CD
113 # from 18 to 13MB. The variable defaults to no.
116 # Pass parameters to rbuild.
118 # -c Clean as you go. Delete generated files as soon as they are not needed anymore.
119 # -dd Disable automatic dependencies.
120 # -dm{module} Check only automatic dependencies for this module.
121 # -mi Let make handle creation of install directories. Rbuild will not generate the directories.
122 # -ps Generate proxy makefiles in source tree instead of the output tree.
123 # -ud Disable compilation units.
127 # Alternate name of makefile.auto
130 # check for versions of make that don't have features we need...
131 # the function "eval" is only available in 3.80+, which happens to be the minimum
132 # version that has the features we use...
133 # THIS CHECK IS BORROWED FROM THE "GMSL" PROJECT, AND IS COVERED BY THE GPL LICENSE
134 # YOU CAN FIND OUT MORE ABOUT GMSL - A VERY COOL PROJECT - AT:
135 # http://gmsl.sourceforge.net/
138 __gmsl_ignore
:= $(eval __gmsl_have_eval
:= T
)
140 ifndef __gmsl_have_eval
141 $(error ReactOS
's makefiles use GNU Make 3.80+ features, you have $(MAKE_VERSION), you MUST UPGRADE in order to build ReactOS - Sorry)
143 # END of code borrowed from GMSL ( http://gmsl.sourceforge.net/ )
156 ifeq ($(ROS_AUTOMAKE),)
157 ROS_AUTOMAKE=makefile.auto
166 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
167 ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
170 HOST_CFLAGS+=-fshort-wchar
171 HOST_CPPFLAGS+=-fshort-wchar
177 HOST_CFLAGS+=-fshort-wchar
178 HOST_CPPFLAGS+=-fshort-wchar
182 # Default to half-verbose mode
188 ifeq ($(VERBOSE),full)
194 HALFVERBOSEECHO = yes
198 ifeq ($(HOST),mingw32-linux)
203 ifeq ($(HALFVERBOSEECHO),yes)
204 ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
205 ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
206 ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
207 ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
208 ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
209 ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
210 ECHO_GAS =@echo $(QUOTE)[GAS] $<$(QUOTE)
211 ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
212 ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
213 ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
214 ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
215 ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
216 ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
217 ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL] $@$(QUOTE)
218 ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
219 ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
220 ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
221 ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
222 ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
223 ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
224 ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
225 ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
226 ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
227 ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
228 ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
229 ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
230 ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
231 ECHO_STRIP =@echo $(QUOTE)[STRIP] $@$(QUOTE)
263 # Set host compiler/linker
270 host_gcc = $(Q)$(HOST_CC)
271 host_gpp = $(Q)$(HOST_CPP)
274 host_objcopy = $(Q)objcopy
276 # Set target compiler/linker
277 ifneq ($(ROS_PREFIX),)
278 PREFIX_ := $(ROS_PREFIX)-
280 ifeq ($(HOST),mingw32-linux)
287 TARGET_CC = $(PREFIX_)gcc
289 ifeq ($(TARGET_CPP),)
290 TARGET_CPP = $(PREFIX_)g++
292 gcc = $(Q)$(TARGET_CC)
293 gpp = $(Q)$(TARGET_CPP)
294 ld = $(Q)$(PREFIX_)ld
295 nm = $(Q)$(PREFIX_)nm
296 objdump = $(Q)$(PREFIX_)objdump
297 ar = $(Q)$(PREFIX_)ar
298 objcopy = $(Q)$(PREFIX_)objcopy
299 dlltool = $(Q)$(PREFIX_)dlltool
300 strip = $(Q)$(PREFIX_)strip
301 windres = $(Q)$(PREFIX_)windres
304 ifeq ($(OSTYPE),msys)
307 ifeq ($(HOST),mingw32-linux)
308 ifeq ($(OSTYPE),msys)
309 export EXEPOSTFIX = .exe
314 mkdir = -$(Q)mkdir -p
318 else # mingw32-windows
319 export EXEPOSTFIX = .exe
321 export SEP = \$(ROS_EMPTY)
328 ifneq ($(ROS_INTERMEDIATE),)
329 INTERMEDIATE := $(ROS_INTERMEDIATE)
331 INTERMEDIATE := obj-$(ARCH)
333 INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
335 ifneq ($(ROS_OUTPUT),)
336 OUTPUT := $(ROS_OUTPUT)
338 OUTPUT := output-$(ARCH)
340 OUTPUT_ := $(OUTPUT)$(SEP)
342 ifneq ($(ROS_CDOUTPUT),)
343 CDOUTPUT := $(ROS_CDOUTPUT)
347 CDOUTPUT_ := $(CDOUTPUT)$(SEP)
349 ifneq ($(ROS_TEMPORARY),)
350 TEMPORARY := $(ROS_TEMPORARY)
354 TEMPORARY_ := $(TEMPORARY)$(SEP)
356 ifneq ($(ROS_INSTALL),)
357 INSTALL := $(ROS_INSTALL)
359 INSTALL := $(CDOUTPUT)
361 INSTALL_ := $(INSTALL)$(SEP)
363 RBUILD_FLAGS := -rReactOS-$(ARCH).rbuild -DARCH=$(ARCH)
368 ifneq ($(INTERMEDIATE),$(OUTPUT))
374 NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
375 KERNEL32_MC = dll$(SEP)win32$(SEP)kernel32$(SEP)kernel32.mc
376 BUILDNO_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)buildno.h
377 BUGCODES_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)bugcodes.h
378 BUGCODES_RC = $(INTERMEDIATE_)ntoskrnl$(SEP)bugcodes.rc
379 ERRCODES_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)errcodes.h
380 ERRCODES_RC = $(INTERMEDIATE_)dll$(SEP)win32$(SEP)kernel32$(SEP)errcodes.rc
384 include tools/tools.mak
385 include boot/freeldr/bootsect/bootsect.mak
386 -include $(ROS_AUTOMAKE)
396 $(GENDIB_DIB_FILES) \
398 ifeq ($(ARCH),powerpc)
399 PREAUTO += $(OFW_INTERFACE_SERVICE_FILES) $(PPCMMU_TARGETS)
402 $(ROS_AUTOMAKE): $(RBUILD_TARGET) $(XMLBUILDFILES) | $(PREAUTO)
403 ${mkdir} $(OUTPUT_)media$(SEP)inf 2>$(NUL)
405 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) mingw
407 world: all bootcd livecd
410 $(MAKE) KDBG=1 DBG=1 \
411 ROS_AUTOMAKE=makefile-$(ARCH)-kd.auto \
412 ROS_INSTALL=reactos-$(ARCH)-kd \
413 ROS_INTERMEDIATE=obj-$(ARCH)-kd \
414 ROS_OUTPUT=output-$(ARCH)-kd \
416 $(MAKE) KDBG=0 DBG=1 \
417 ROS_AUTOMAKE=makefile-$(ARCH)-d.auto \
418 ROS_INSTALL=reactos-$(ARCH)-d \
419 ROS_INTERMEDIATE=obj-$(ARCH)-d \
420 ROS_OUTPUT=output-$(ARCH)-d \
422 $(MAKE) KDBG=0 DBG=0 \
423 ROS_AUTOMAKE=makefile-$(ARCH)-r.auto \
424 ROS_INSTALL=reactos-$(ARCH)-r \
425 ROS_INTERMEDIATE=obj-$(ARCH)-r \
426 ROS_OUTPUT=output-$(ARCH)-r \
430 $(OUTPUT_)tools$(SEP)sysreg$(SEP)sysreg$(EXEPOSTFIX) tools$(SEP)sysreg$(SEP)txtmode.cfg
436 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) cb
439 msbuild: $(RBUILD_TARGET)
441 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) msbuild
443 .PHONY: msbuild_clean
444 msbuild_clean: $(RBUILD_TARGET)
446 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c msbuild
449 depmap: $(RBUILD_TARGET)
451 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) depmap
454 vreport:$(RBUILD_TARGET)
456 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) vreport
459 msvc: $(RBUILD_TARGET)
461 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) msvc
463 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
464 ${mkdir} $(INTERMEDIATE_)include$(SEP)reactos 2>$(NUL)
465 ${mkdir} $(INTERMEDIATE_)ntoskrnl 2>$(NUL)
467 $(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
469 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
470 ${mkdir} $(INTERMEDIATE_)include$(SEP)reactos 2>$(NUL)
471 ${mkdir} $(INTERMEDIATE_)dll$(SEP)win32$(SEP)kernel32 2>$(NUL)
473 $(Q)$(WMC_TARGET) -i -U -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
476 msvc6: $(RBUILD_TARGET)
478 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs6.00 -voversionconfiguration msvc
481 msvc7: $(RBUILD_TARGET)
483 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -voversionconfiguration msvc
486 msvc71: $(RBUILD_TARGET)
488 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -voversionconfiguration msvc
491 msvc8: $(RBUILD_TARGET)
493 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -voversionconfiguration msvc
496 msvc9: $(RBUILD_TARGET)
498 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs9.00 -voversionconfiguration msvc
501 msvc6_clean: $(RBUILD_TARGET)
503 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
506 msvc7_clean: $(RBUILD_TARGET)
508 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
511 msvc71_clean: $(RBUILD_TARGET)
513 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
516 msvc8_clean: $(RBUILD_TARGET)
518 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs8.00 -voversionconfiguration msvc
521 msvc9_clean: $(RBUILD_TARGET)
523 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs9.00 -voversionconfiguration msvc
526 msvc_clean: $(RBUILD_TARGET)
528 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c msvc
530 .PHONY: msvc_clean_all
531 msvc_clean_all: $(RBUILD_TARGET)
533 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
534 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
535 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
536 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs8.10 -voversionconfiguration msvc
538 .PHONY: msvc7_install_debug
539 msvc7_install_debug: $(RBUILD_TARGET)
541 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcdebug -voversionconfiguration msvc
543 .PHONY: msvc7_install_release
544 msvc7_install_release: $(RBUILD_TARGET)
546 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcrelease -voversionconfiguration msvc
548 .PHONY: msvc7_install_speed
549 msvc7_install_speed: $(RBUILD_TARGET)
551 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.00 -vcspeed -voversionconfiguration msvc
553 .PHONY: msvc71_install_debug
554 msvc71_install_debug: $(RBUILD_TARGET)
556 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcdebug -voversionconfiguration msvc
558 .PHONY: msvc71_install_release
559 msvc71_install_release: $(RBUILD_TARGET)
561 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcrelease -voversionconfiguration msvc
564 .PHONY: msvc71_install_speed
565 msvc71_install_speed: $(RBUILD_TARGET)
567 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs7.10 -vcspeed -voversionconfiguration msvc
569 .PHONY: msvc8_install_debug
570 msvc8_install_debug: $(RBUILD_TARGET)
572 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcdebug -voversionconfiguration msvc
574 .PHONY: msvc8_install_release
575 msvc8_install_release: $(RBUILD_TARGET)
577 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcrelease -voversionconfiguration msvc
579 .PHONY: msvc8_install_speed
580 msvc8_install_speed: $(RBUILD_TARGET)
582 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs8.00 -vcspeed -voversionconfiguration msvc
584 .PHONY: makefile_auto_clean
586 -@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)
589 clean: makefile_auto_clean
592 depends: $(RBUILD_TARGET)
594 $(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) mingw