Capture window station name passed from usermode
[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
110 # check for versions of make that don't have features we need...
111 # the function "eval" is only available in 3.80+, which happens to be the minimum
112 # version that has the features we use...
113 # THIS CHECK IS BORROWED FROM THE "GMSL" PROJECT, AND IS COVERED BY THE GPL LICENSE
114 # YOU CAN FIND OUT MORE ABOUT GMSL - A VERY COOL PROJECT - AT:
115 # http://gmsl.sourceforge.net/
116
117 __gmsl_have_eval :=
118 __gmsl_ignore := $(eval __gmsl_have_eval := T)
119
120 ifndef __gmsl_have_eval
121 $(error ReactOS's makefiles use GNU Make 3.80+ features, you have $(MAKE_VERSION), you MUST UPGRADE in order to build ReactOS - Sorry)
122 endif
123 # END of code borrowed from GMSL ( http://gmsl.sourceforge.net/ )
124
125 .PHONY: all
126 .PHONY: clean
127 all: makefile.auto
128
129
130 .SUFFIXES:
131
132 ifeq ($(HOST),)
133 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
134 ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
135 export OSTYPE = msys
136 HOST=mingw32-linux
137 else
138 HOST=mingw32-windows
139 endif
140 else
141 HOST=mingw32-linux
142 endif
143 endif
144
145 # Default to half-verbose mode
146 ifeq ($(VERBOSE),no)
147 Q = @
148 HALFVERBOSEECHO = no
149 BUILDNO_QUIET = -q
150 else
151 ifeq ($(VERBOSE),full)
152 Q =
153 HALFVERBOSEECHO = no
154 BUILDNO_QUIET =
155 else
156 Q = @
157 HALFVERBOSEECHO = yes
158 BUILDNO_QUIET = -q
159 endif
160 endif
161 ifeq ($(HOST),mingw32-linux)
162 QUOTE = "
163 else
164 QUOTE =
165 endif
166 ifeq ($(HALFVERBOSEECHO),yes)
167 ECHO_CP =@echo $(QUOTE)[COPY] $@$(QUOTE)
168 ECHO_MKDIR =@echo $(QUOTE)[MKDIR] $@$(QUOTE)
169 ECHO_BUILDNO =@echo $(QUOTE)[BUILDNO] $@$(QUOTE)
170 ECHO_INVOKE =@echo $(QUOTE)[INVOKE] $<$(QUOTE)
171 ECHO_PCH =@echo $(QUOTE)[PCH] $@$(QUOTE)
172 ECHO_CC =@echo $(QUOTE)[CC] $<$(QUOTE)
173 ECHO_GAS =@echo $(QUOTE)[GAS] $<$(QUOTE)
174 ECHO_NASM =@echo $(QUOTE)[NASM] $<$(QUOTE)
175 ECHO_AR =@echo $(QUOTE)[AR] $@$(QUOTE)
176 ECHO_WINEBLD =@echo $(QUOTE)[WINEBLD] $@$(QUOTE)
177 ECHO_WRC =@echo $(QUOTE)[WRC] $@$(QUOTE)
178 ECHO_WIDL =@echo $(QUOTE)[WIDL] $@$(QUOTE)
179 ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES] $<$(QUOTE)
180 ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL] $@$(QUOTE)
181 ECHO_LD =@echo $(QUOTE)[LD] $@$(QUOTE)
182 ECHO_NM =@echo $(QUOTE)[NM] $@$(QUOTE)
183 ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
184 ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
185 ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
186 ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
187 ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
188 ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)
189 ECHO_CDMAKE =@echo $(QUOTE)[CDMAKE] $@$(QUOTE)
190 ECHO_MKHIVE =@echo $(QUOTE)[MKHIVE] $@$(QUOTE)
191 ECHO_REGTESTS=@echo $(QUOTE)[REGTESTS] $@$(QUOTE)
192 ECHO_TEST =@echo $(QUOTE)[TEST] $@$(QUOTE)
193 ECHO_GENDIB =@echo $(QUOTE)[GENDIB] $@$(QUOTE)
194 else
195 ECHO_CP =
196 ECHO_MKDIR =
197 ECHO_BUILDNO =
198 ECHO_INVOKE =
199 ECHO_PCH =
200 ECHO_CC =
201 ECHO_GAS =
202 ECHO_NASM =
203 ECHO_AR =
204 ECHO_WINEBLD =
205 ECHO_WRC =
206 ECHO_WIDL =
207 ECHO_BIN2RES =
208 ECHO_DLLTOOL =
209 ECHO_LD =
210 ECHO_NM =
211 ECHO_OBJDUMP =
212 ECHO_RBUILD =
213 ECHO_RSYM =
214 ECHO_WMC =
215 ECHO_NCI =
216 ECHO_CABMAN =
217 ECHO_CDMAKE =
218 ECHO_MKHIVE =
219 ECHO_REGTESTS=
220 ECHO_TEST =
221 ECHO_GENDIB =
222 endif
223
224
225 host_gcc = $(Q)gcc
226 host_gpp = $(Q)g++
227 host_ld = $(Q)ld
228 host_ar = $(Q)ar
229 host_objcopy = $(Q)objcopy
230 ifeq ($(HOST),mingw32-linux)
231 export EXEPREFIX = ./
232 ifeq ($(OSTYPE),msys)
233 export EXEPOSTFIX = .exe
234 else
235 export EXEPOSTFIX =
236 endif
237 export SEP = /
238 mkdir = -$(Q)mkdir -p
239 gcc = $(Q)$(PREFIX)-gcc
240 gpp = $(Q)$(PREFIX)-g++
241 ld = $(Q)$(PREFIX)-ld
242 nm = $(Q)$(PREFIX)-nm
243 objdump = $(Q)$(PREFIX)-objdump
244 ar = $(Q)$(PREFIX)-ar
245 objcopy = $(Q)$(PREFIX)-objcopy
246 dlltool = $(Q)$(PREFIX)-dlltool
247 windres = $(Q)$(PREFIX)-windres
248 rm = $(Q)rm -f
249 cp = $(Q)cp
250 NUL = /dev/null
251 else # mingw32-windows
252 ifeq ($(OSTYPE),msys)
253 HOST=mingw32-linux
254 export EXEPREFIX = ./
255 export EXEPOSTFIX = .exe
256 export SEP = /
257 mkdir = -$(Q)mkdir -p
258 gcc = $(Q)gcc
259 gpp = $(Q)g++
260 ld = $(Q)ld
261 nm = $(Q)nm
262 objdump = $(Q)objdump
263 ar = $(Q)ar
264 objcopy = $(Q)objcopy
265 dlltool = $(Q)dlltool
266 windres = $(Q)windres
267 rm = $(Q)rm -f
268 cp = $(Q)cp
269 NUL = /dev/null
270 else
271 export EXEPREFIX =
272 export EXEPOSTFIX = .exe
273 ROS_EMPTY =
274 export SEP = \$(ROS_EMPTY)
275 mkdir = -$(Q)mkdir
276 gcc = $(Q)gcc
277 gpp = $(Q)g++
278 ld = $(Q)ld
279 nm = $(Q)nm
280 objdump = $(Q)objdump
281 ar = $(Q)ar
282 objcopy = $(Q)objcopy
283 dlltool = $(Q)dlltool
284 windres = $(Q)windres
285 rm = $(Q)del /f /q
286 cp = $(Q)copy /y
287 NUL = NUL
288 endif
289 endif
290
291 ifneq ($(ROS_INTERMEDIATE),)
292 INTERMEDIATE := $(ROS_INTERMEDIATE)
293 else
294 INTERMEDIATE := obj-i386
295 endif
296 INTERMEDIATE_ := $(INTERMEDIATE)$(SEP)
297
298 ifneq ($(ROS_OUTPUT),)
299 OUTPUT := $(ROS_OUTPUT)
300 else
301 OUTPUT := output-i386
302 endif
303 OUTPUT_ := $(OUTPUT)$(SEP)
304
305 ifneq ($(ROS_TEMPORARY),)
306 TEMPORARY := $(ROS_TEMPORARY)
307 else
308 TEMPORARY :=
309 endif
310 TEMPORARY_ := $(TEMPORARY)$(SEP)
311
312 ifneq ($(ROS_INSTALL),)
313 INSTALL := $(ROS_INSTALL)
314 else
315 INSTALL := reactos
316 endif
317 INSTALL_ := $(INSTALL)$(SEP)
318
319 $(INTERMEDIATE):
320 ${mkdir} $@
321
322 ifneq ($(INTERMEDIATE),$(OUTPUT))
323 $(OUTPUT):
324 ${mkdir} $@
325 endif
326
327
328 NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
329 KERNEL32_MC = lib$(SEP)kernel32$(SEP)kernel32.mc
330 BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
331 BUGCODES_H = include$(SEP)reactos$(SEP)bugcodes.h
332 BUGCODES_RC = ntoskrnl$(SEP)bugcodes.rc
333 ERRCODES_H = include$(SEP)reactos$(SEP)errcodes.h
334 ERRCODES_RC = lib$(SEP)kernel32$(SEP)errcodes.rc
335
336 include lib/lib.mak
337 include tools/tools.mak
338 include boot/freeldr/bootsect/bootsect.mak
339 -include makefile.auto
340
341 PREAUTO := \
342 $(BIN2C_TARGET) \
343 $(BIN2RES_TARGET) \
344 $(BUILDNO_H) \
345 $(BUGCODES_H) \
346 $(BUGCODES_RC) \
347 $(ERRCODES_H) \
348 $(ERRCODES_RC) \
349 $(NCI_SERVICE_FILES) \
350 $(GENDIB_DIB_FILES)
351
352 makefile.auto: $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
353 $(ECHO_RBUILD)
354 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
355
356 .PHONY: msvc
357 msvc: $(RBUILD_TARGET)
358 $(ECHO_RBUILD)
359 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) msvc
360
361 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
362 $(ECHO_WMC)
363 $(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
364
365 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
366 $(ECHO_WMC)
367 $(Q)$(WMC_TARGET) -i -U -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
368
369 .PHONY: msvc6
370 msvc6: $(RBUILD_TARGET)
371 $(ECHO_RBUILD)
372 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs6.00 msvc
373
374 .PHONY: msvc7
375 msvc7: $(RBUILD_TARGET)
376 $(ECHO_RBUILD)
377 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.00 msvc
378
379 .PHONY: msvc71
380 msvc71: $(RBUILD_TARGET)
381 $(ECHO_RBUILD)
382 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs7.10 msvc
383
384 .PHONY: msvc8
385 msvc8: $(RBUILD_TARGET)
386 $(ECHO_RBUILD)
387 $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) -vs8.00 msvc
388
389 .PHONY: makefile_auto_clean
390 makefile_auto_clean:
391 -@$(rm) makefile.auto $(PREAUTO) 2>$(NUL)
392
393 .PHONY: clean
394 clean: makefile_auto_clean
395
396 .PHONY: depends
397 depends:
398 @-$(rm) makefile.auto
399 @$(MAKE) $(filter-out depends, $(MAKECMDGOALS))