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.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 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.
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.
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.
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
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.
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
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.
101 # This variable controls if all binaries should be stripped out of useless
102 # data added by GCC/LD as well as of RSYM symbol data. Output binary size
103 # will go from 80 to 40MB, memory usage from 58 to 38MB and the install CD
104 # from 18 to 13MB. The variable defaults to no.
107 # Pass parameters to rbuild.
109 # -c Clean as you go. Delete generated files as soon as they are not needed anymore.
110 # -dd Disable automatic dependencies.
111 # -dm{module} Check only automatic dependencies for this module.
112 # -mi Let make handle creation of install directories. Rbuild will not generate the directories.
113 # -ps Generate proxy makefiles in source tree instead of the output tree.
114 # -ud Disable compilation units.
118 # Alternate name of makefile.auto
121 # check for versions of make that don't have features we need...
122 # the function "eval" is only available in 3.80+, which happens to be the minimum
123 # version that has the features we use...
124 # THIS CHECK IS BORROWED FROM THE "GMSL" PROJECT, AND IS COVERED BY THE GPL LICENSE
125 # YOU CAN FIND OUT MORE ABOUT GMSL - A VERY COOL PROJECT - AT:
126 # http://gmsl.sourceforge.net/
129 __gmsl_ignore
:= $(eval __gmsl_have_eval
:= T
)
131 ifndef __gmsl_have_eval
132 $(error ReactOS
's makefiles use GNU Make 3.80+ features, you have $(MAKE_VERSION), you MUST UPGRADE in order to build ReactOS - Sorry)
134 # END of code borrowed from GMSL ( http://gmsl.sourceforge.net/ )
141 ifeq ($(ROS_AUTOMAKE),)
142 ROS_AUTOMAKE=makefile.auto
151 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
152 ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
155 CFLAGS+=-fshort-wchar
156 CPPFLAGS+=-fshort-wchar
162 CFLAGS+=-fshort-wchar
163 CPPFLAGS+=-fshort-wchar
167 # Default to half-verbose mode
173 ifeq ($(VERBOSE),full)
179 HALFVERBOSEECHO = yes
183 ifeq ($(HOST),mingw32-linux)
188 ifeq ($(HALFVERBOSEECHO),yes)
189 ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
190 ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
191 ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
192 ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
193 ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
194 ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
195 ECHO_GAS =@echo $(QUOTE)[GAS] $<$(QUOTE)
196 ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
197 ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
198 ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
199 ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
200 ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
201 ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
202 ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL] $@$(QUOTE)
203 ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
204 ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
205 ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
206 ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
207 ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
208 ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
209 ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
210 ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
211 ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
212 ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
213 ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
214 ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
215 ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
216 ECHO_STRIP =@echo $(QUOTE)[STRIP] $@$(QUOTE)
253 host_objcopy = $(Q)objcopy
254 ifeq ($(HOST),mingw32-linux)
255 export EXEPREFIX = ./
256 ifeq ($(OSTYPE),msys)
257 export EXEPOSTFIX = .exe
262 mkdir = -$(Q)mkdir -p
263 gcc = $(Q)$(PREFIX)-gcc
264 gpp = $(Q)$(PREFIX)-g++
265 ld = $(Q)$(PREFIX)-ld
266 nm = $(Q)$(PREFIX)-nm
267 objdump = $(Q)$(PREFIX)-objdump
268 ar = $(Q)$(PREFIX)-ar
269 objcopy = $(Q)$(PREFIX)-objcopy
270 dlltool = $(Q)$(PREFIX)-dlltool
271 strip = $(Q)$(PREFIX)-strip
272 windres = $(Q)$(PREFIX)-windres
276 else # mingw32-windows
277 ifeq ($(OSTYPE),msys)
279 export EXEPREFIX = ./
280 export EXEPOSTFIX = .exe
282 mkdir = -$(Q)mkdir -p
287 objdump = $(Q)objdump
289 objcopy = $(Q)objcopy
290 dlltool = $(Q)dlltool
292 windres = $(Q)windres
298 export EXEPOSTFIX = .exe
300 export SEP = \$(ROS_EMPTY)
306 objdump = $(Q)objdump
308 objcopy = $(Q)objcopy
309 dlltool = $(Q)dlltool
311 windres = $(Q)windres
318 ifneq ($(ROS_INTERMEDIATE),)
319 INTERMEDIATE := $(ROS_INTERMEDIATE)
321 INTERMEDIATE := obj-i386
323 INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
325 ifneq ($(ROS_OUTPUT),)
326 OUTPUT := $(ROS_OUTPUT)
328 OUTPUT := output-i386
330 OUTPUT_ := $(OUTPUT)$(SEP)
332 ifneq ($(ROS_TEMPORARY),)
333 TEMPORARY := $(ROS_TEMPORARY)
337 TEMPORARY_ := $(TEMPORARY)$(SEP)
339 ifneq ($(ROS_INSTALL),)
340 INSTALL := $(ROS_INSTALL)
344 INSTALL_ := $(INSTALL)$(SEP)
349 ifneq ($(INTERMEDIATE),$(OUTPUT))
355 NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
356 KERNEL32_MC = dll$(SEP)win32$(SEP)kernel32$(SEP)kernel32.mc
357 BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
358 BUGCODES_H = include$(SEP)reactos$(SEP)bugcodes.h
359 BUGCODES_RC = ntoskrnl$(SEP)bugcodes.rc
360 ERRCODES_H = include$(SEP)reactos$(SEP)errcodes.h
361 ERRCODES_RC = dll$(SEP)win32$(SEP)kernel32$(SEP)errcodes.rc
364 include tools/tools.mak
365 include boot/freeldr/bootsect/bootsect.mak
366 -include $(ROS_AUTOMAKE)
376 $(NCI_SERVICE_FILES) \
379 $(ROS_AUTOMAKE): $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
381 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
383 world: all bootcd livecd
386 $(MAKE) KDBG=1 DBG=1 \
387 ROS_AUTOMAKE=makefile-$(ARCH)-kd.auto \
388 ROS_INSTALL=reactos-$(ARCH)-kd \
389 ROS_INTERMEDIATE=obj-$(ARCH)-kd \
390 ROS_OUTPUT=output-$(ARCH)-kd \
392 $(MAKE) KDBG=0 DBG=1 \
393 ROS_AUTOMAKE=makefile-$(ARCH)-d.auto \
394 ROS_INSTALL=reactos-$(ARCH)-d \
395 ROS_INTERMEDIATE=obj-$(ARCH)-d \
396 ROS_OUTPUT=output-$(ARCH)-d \
398 $(MAKE) KDBG=0 DBG=0 \
399 ROS_AUTOMAKE=makefile-$(ARCH)-r.auto \
400 ROS_INSTALL=reactos-$(ARCH)-r \
401 ROS_INTERMEDIATE=obj-$(ARCH)-r \
402 ROS_OUTPUT=output-$(ARCH)-r \
406 -mkdir $(OUTPUT_)cd$(SEP)reactos
407 $(cp) boot$(SEP)bootdata$(SEP)unattend.inf.sample boot$(SEP)bootdata$(SEP)unattend.inf
408 $(cp) boot$(SEP)bootdata$(SEP)unattend.inf.sample $(OUTPUT_)cd$(SEP)reactos$(SEP)unattend.inf
409 $(cp) boot$(SEP)bootdata$(SEP)bootcdregtest$(SEP)testboot.bat.sample boot$(SEP)bootdata$(SEP)bootcdregtest$(SEP)testboot.bat
411 $(MAKE) bootcdregtest
413 $(OUTPUT_)tools$(SEP)sysreg$(SEP)sysreg$(EXEPOSTFIX) tools$(SEP)sysreg$(SEP)txtmode.cfg rosboot
414 $(OUTPUT_)tools$(SEP)sysreg$(SEP)sysreg$(EXEPOSTFIX) tools$(SEP)sysreg$(SEP)secstage.cfg rosboot
415 $(OUTPUT_)tools$(SEP)sysreg$(SEP)sysreg$(EXEPOSTFIX) tools$(SEP)sysreg$(SEP)runonce.cfg rosboot
418 $(rm) boot$(SEP)bootdata$(SEP)unattend.inf
419 $(rm) boot$(SEP)bootdata$(SEP)bootcdregtest$(SEP)testboot.bat
420 $(rm) $(OUTPUT_)cd$(SEP)reactos$(SEP)unattend.inf
423 $(cp) boot$(SEP)bootdata$(SEP)unattend.inf.sample $(OUTPUT_)cd$(SEP)reactos$(SEP)unattend.inf
424 $(MAKE) bootcdregtest
425 $(rm) $(OUTPUT_)cd$(SEP)reactos$(SEP)unattend.inf
430 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) cb
434 msvc: $(RBUILD_TARGET)
436 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) msvc
438 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
440 $(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
442 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
444 $(Q)$(WMC_TARGET) -i -U -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
447 msvc6: $(RBUILD_TARGET)
449 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs6.00 -voversionconfiguration msvc
452 msvc7: $(RBUILD_TARGET)
454 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -voversionconfiguration msvc
457 msvc71: $(RBUILD_TARGET)
459 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -voversionconfiguration msvc
462 msvc8: $(RBUILD_TARGET)
464 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -voversionconfiguration msvc
467 msvc6_clean: $(RBUILD_TARGET)
469 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
472 msvc7_clean: $(RBUILD_TARGET)
474 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
477 msvc71_clean: $(RBUILD_TARGET)
479 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
482 msvc8_clean: $(RBUILD_TARGET)
484 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.00 -voversionconfiguration msvc
487 msvc_clean: $(RBUILD_TARGET)
489 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c msvc
491 .PHONY: msvc_clean_all
492 msvc_clean_all: $(RBUILD_TARGET)
494 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs6.00 -voversionconfiguration msvc
495 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.00 -voversionconfiguration msvc
496 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs7.10 -voversionconfiguration msvc
497 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -c -vs8.10 -voversionconfiguration msvc
499 .PHONY: msvc7_install_debug
500 msvc7_install_debug: $(RBUILD_TARGET)
502 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcdebug -voversionconfiguration msvc
504 .PHONY: msvc7_install_release
505 msvc7_install_release: $(RBUILD_TARGET)
507 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcrelease -voversionconfiguration msvc
509 .PHONY: msvc7_install_speed
510 msvc7_install_speed: $(RBUILD_TARGET)
512 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 -vcspeed -voversionconfiguration msvc
514 .PHONY: msvc71_install_debug
515 msvc71_install_debug: $(RBUILD_TARGET)
517 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcdebug -voversionconfiguration msvc
519 .PHONY: msvc71_install_release
520 msvc71_install_release: $(RBUILD_TARGET)
522 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcrelease -voversionconfiguration msvc
525 .PHONY: msvc71_install_speed
526 msvc71_install_speed: $(RBUILD_TARGET)
528 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 -vcspeed -voversionconfiguration msvc
530 .PHONY: msvc8_install_debug
531 msvc8_install_debug: $(RBUILD_TARGET)
533 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcdebug -voversionconfiguration msvc
535 .PHONY: msvc8_install_release
536 msvc8_install_release: $(RBUILD_TARGET)
538 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcrelease -voversionconfiguration msvc
540 .PHONY: msvc8_install_speed
541 msvc8_install_speed: $(RBUILD_TARGET)
543 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 -vcspeed -voversionconfiguration msvc
545 .PHONY: makefile_auto_clean
547 -@$(rm) $(ROS_AUTOMAKE) $(PREAUTO) 2>$(NUL)
550 clean: makefile_auto_clean
554 @-$(rm) makefile.auto
555 @$(MAKE) $(filter-out depends, $(MAKECMDGOALS))