6bded590b5f431292735e35f7873c24566bce759
[reactos.git] / reactos / tools / helper.mk
1 # $Id$
2 #
3 # Helper makefile for ReactOS modules
4 # Variables this makefile accepts:
5 # $TARGET_TYPE = Type of target:
6 # program = User mode program
7 # proglib = Executable program that have exported functions
8 # dynlink = Dynamic Link Library (DLL)
9 # library = Library that will be linked with other code
10 # driver = Kernel mode driver
11 # export_driver = Kernel mode driver that have exported functions
12 # driver_library = Import library for a driver
13 # kmlibrary = Static kernel-mode library
14 # host_library = Static library for use in the build env
15 # hal = Hardware Abstraction Layer
16 # bootpgm = Boot program
17 # miniport = Kernel mode driver that does not link with ntoskrnl.exe or hal.dll
18 # gdi_driver = Kernel mode graphics driver that link with win32k.sys
19 # subsystem = Kernel subsystem
20 # kmdll = Kernel mode DLL
21 # winedll = DLL imported from wine
22 # kernel = ReactOS kernel
23 # test = ReactOS test
24 # $TARGET_APPTYPE = Application type (windows,native,console).
25 # Required only for TARGET_TYPEs program and proglib
26 # $TARGET_NAME = Base name of output file and .rc, .def, and .edf files
27 # $TARGET_OBJECTS = Object files that compose the module
28 # $TARGET_CPPAPP = C++ application (no,yes) (optional)
29 # $TARGET_HEADERS = Header files that the object files depend on (optional)
30 # $TARGET_DEFNAME = Base name of .def and .edf files (optional)
31 # $TARGET_BASENAME = Base name of output file (overrides $TARGET_NAME if it exists) (optional)
32 # $TARGET_EXTENSION = Extension of the output file (optional)
33 # $TARGET_DDKLIBS = DDK libraries that are to be imported by the module (optional)
34 # $TARGET_SDKLIBS = SDK libraries that are to be imported by the module (optional)
35 # $TARGET_LIBS = Other libraries that are to be imported by the module (optional)
36 # $TARGET_GCCLIBS = GCC libraries imported with -l (optional)
37 # $TARGET_LFLAGS = GCC flags when linking (optional)
38 # $TARGET_CFLAGS = GCC flags (optional)
39 # $TARGET_CPPFLAGS = G++ flags (optional)
40 # $TARGET_ASFLAGS = GCC assembler flags (optional)
41 # $TARGET_NFLAGS = NASM flags (optional)
42 # $TARGET_RCFLAGS = Windres flags (optional)
43 # $TARGET_CLEAN = Files that are part of the clean rule (optional)
44 # $TARGET_PATH = Relative path for *.def, *.edf, and *.rc (optional)
45 # $TARGET_BASE = Default base address (optional)
46 # $TARGET_ENTRY = Entry point (optional)
47 # $TARGET_NORC = Do not include standard resource file (no,yes) (optional)
48 # $TARGET_LIBPATH = Destination path for static libraries (optional)
49 # $TARGET_IMPLIBPATH = Destination path for import libraries (optional)
50 # $TARGET_INSTALLDIR = Destination path when installed (optional)
51 # $TARGET_PCH = Filename of header to use to generate a PCH if supported by the compiler (optional)
52 # $TARGET_BOOTSTRAP = Whether this file is needed to bootstrap the installation (no,yes) (optional)
53 # $TARGET_BOOTSTRAP_NAME = Name on the installation medium (optional)
54 # $TARGET_REGTESTS = This module has regression tests (no,yes) (optional)
55 # $TARGET_WINETESTS = This module Wine regression tests (no,yes) (optional)
56 # $TARGET_INSTALL = Install the file (no,yes) (optional)
57 # $SUBDIRS = Subdirs in which to run make (optional)
58
59 include $(PATH_TO_TOP)/config
60 include $(PATH_TO_TOP)/baseaddress.cfg
61
62 ifeq ($(TARGET_PATH),)
63 TARGET_PATH := .
64 endif
65
66 ifeq ($(ARCH),i386)
67 MK_ARCH_ID := _M_IX86
68 endif
69
70 ifeq ($(ARCH),alpha)
71 MK_ARCH_ID := _M_ALPHA
72 endif
73
74 ifeq ($(ARCH),mips)
75 MK_ARCH_ID := _M_MIPS
76 endif
77
78 ifeq ($(ARCH),powerpc)
79 MK_ARCH_ID := _M_PPC
80 endif
81
82 # unknown architecture
83 ifeq ($(MK_ARCH_ID),)
84 MK_ARCH_ID := _M_UNKNOWN
85 endif
86
87 #
88 # VARIABLES IN USE BY VARIOUS TARGETS
89 #
90 # MK_BOOTCDDIR = Directory on the ReactOS ISO CD in which to place the file (subdir of reactos/)
91 # MK_CFLAGS = C compiler command-line flags for this target
92 # MK_CPPFLAGS = C++ compiler command-line flags for this target
93 # MK_DDKLIBS = Import libraries from the ReactOS DDK to link with
94 # MK_DEFENTRY = Module entry point:
95 # _WinMain@16 for windows EXE files that are export libraries
96 # _DriverEntry@8 for .SYS files
97 # _DllMain@12 for .DLL files
98 # _DrvEnableDriver@12 for GDI drivers
99 # _WinMainCRTStartup for Win32 EXE files
100 # _NtProcessStartup@4 for Native EXE files
101 # _mainCRTStartup for Console EXE files
102 # MK_DEFEXT = Extension to give compiled modules (.EXE, .DLL, .SYS, .a)
103 # MK_DISTDIR = (unused?)
104 # MK_EXETYPE = Compiler option packages based on type of PE file (exe, dll)
105 # MK_IMPLIB = Whether or not to generate a DLL import stub library (yes, no)
106 # MK_IMPLIB_EXT = Extension to give import libraries (.a always)
107 # MK_IMPLIBDEFPATH = Default place to put the import stub library when built
108 # MK_IMPLIBONLY = Whether the target is only an import library (yes, no; used only by generic hal)
109 # MK_INSTALLDIR = Where "make install" should put the target, relative to reactos/
110 # MK_MODE = Mode the target's code is intended to run in
111 # user - User-mode compiler settings
112 # kernel - Kernel-mode compiler settings
113 # static - Static library compiler settings
114 # MK_RCFLAGS = Flags to add to resource compiler command line
115 # MK_RES_BASE = Base name of resource files
116 # MK_SDKLIBS = Default SDK libriaries to link with
117 #
118
119 ifeq ($(TARGET_TYPE),program)
120 MK_MODE := user
121 MK_EXETYPE := exe
122 MK_DEFEXT := .exe
123 MK_DEFENTRY := _DEFINE_TARGET_APPTYPE
124 MK_DDKLIBS :=
125 MK_SDKLIBS :=
126 MK_CFLAGS := -I.
127 MK_CPPFLAGS := -I.
128 MK_IMPLIB := no
129 MK_IMPLIBONLY := no
130 MK_IMPLIBDEFPATH :=
131 MK_IMPLIB_EXT := .a
132 MK_INSTALLDIR := bin
133 MK_BOOTCDDIR := system32
134 MK_DISTDIR := apps
135 MK_RES_BASE := $(TARGET_NAME)
136 endif
137
138 ifeq ($(TARGET_TYPE),proglib)
139 MK_MODE := user
140 MK_EXETYPE := dll
141 MK_DEFEXT := .exe
142 MK_DEFENTRY := _WinMain@16
143 MK_DDKLIBS :=
144 MK_SDKLIBS :=
145 MK_CFLAGS := -I.
146 MK_CPPFLAGS := -I.
147 MK_IMPLIB := yes
148 MK_IMPLIBONLY := no
149 MK_IMPLIBDEFPATH := $(SDK_PATH_LIB)
150 MK_IMPLIB_EXT := .a
151 MK_INSTALLDIR := bin
152 MK_BOOTCDDIR := system32
153 MK_DISTDIR := apps
154 MK_RES_BASE := $(TARGET_NAME)
155 endif
156
157 ifeq ($(TARGET_TYPE),dynlink)
158 MK_MODE := user
159 MK_EXETYPE := dll
160 MK_DEFEXT := .dll
161 MK_DEFENTRY := _DllMain@12
162 MK_DDKLIBS :=
163 MK_SDKLIBS :=
164 MK_CFLAGS := -I.
165 MK_CPPFLAGS := -I.
166 MK_IMPLIB := yes
167 MK_IMPLIBONLY := no
168 MK_IMPLIBDEFPATH := $(SDK_PATH_LIB)
169 MK_IMPLIB_EXT := .a
170 MK_INSTALLDIR := system32
171 MK_BOOTCDDIR := system32
172 MK_DISTDIR := dlls
173 MK_RES_BASE := $(TARGET_NAME)
174 endif
175
176 ifeq ($(TARGET_TYPE),library)
177 TARGET_NORC := yes
178 MK_MODE := static
179 MK_EXETYPE :=
180 MK_DEFEXT := .a
181 MK_DEFENTRY :=
182 MK_DDKLIBS :=
183 MK_SDKLIBS :=
184 MK_CFLAGS := -I.
185 MK_CPPFLAGS := -I.
186 MK_IMPLIB := no
187 MK_IMPLIBONLY := no
188 MK_IMPLIBDEFPATH :=
189 MK_IMPLIB_EXT :=
190 MK_INSTALLDIR := # none
191 MK_BOOTCDDIR := system32
192 MK_DISTDIR := # none
193 MK_RES_BASE :=
194 endif
195
196 ifeq ($(TARGET_TYPE),kmlibrary)
197 TARGET_NORC := yes
198 MK_MODE := static
199 MK_DEFEXT := .a
200 MK_CFLAGS := -I.
201 MK_CPPFLAGS := -I.
202 MK_IMPLIB := no
203 MK_IMPLIBONLY := no
204 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
205 #MK_IMPLIB_EXT :=
206 endif
207
208 ifeq ($(TARGET_TYPE),driver_library)
209 MK_MODE := kernel
210 MK_EXETYPE := dll
211 MK_DEFEXT := .dll
212 MK_DEFENTRY :=
213 MK_DDKLIBS :=
214 MK_SDKLIBS :=
215 MK_CFLAGS := -I.
216 MK_CPPFLAGS := -I.
217 MK_IMPLIB := no
218 MK_IMPLIBONLY := yes
219 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
220 MK_IMPLIB_EXT := .a
221 MK_INSTALLDIR := $(DDK_PATH_INC)
222 MK_BOOTCDDIR := .
223 MK_DISTDIR := # FIXME
224 MK_RES_BASE :=
225 endif
226
227 ifeq ($(TARGET_TYPE),host_library)
228 TARGET_NORC := yes
229 MK_MODE := static
230 MK_DEFEXT := .a
231 MK_CFLAGS :=
232 MK_CPPFLAGS :=
233 MK_LIBPATH := .
234 MK_IMPLIB := no
235 MK_IMPLIBONLY := no
236 MK_IMPLIBDEFPATH :=
237 MK_CC := $(HOST_CC)
238 MK_AR := $(HOST_AR)
239 endif
240
241 ifeq ($(TARGET_TYPE),driver)
242 MK_MODE := kernel
243 MK_EXETYPE := dll
244 MK_DEFEXT := .sys
245 MK_DEFENTRY := _DriverEntry@8
246 MK_DDKLIBS := ntoskrnl.a hal.a
247 MK_SDKLIBS :=
248 MK_CFLAGS := -D__NTDRIVER__ -I.
249 MK_CPPFLAGS := -D__NTDRIVER__ -I.
250 MK_IMPLIB := no
251 MK_IMPLIBONLY := no
252 MK_IMPLIBDEFPATH :=
253 MK_IMPLIB_EXT := .a
254 MK_INSTALLDIR := system32/drivers
255 MK_BOOTCDDIR := .
256 MK_DISTDIR := drivers
257 MK_RES_BASE := $(TARGET_NAME)
258 endif
259
260 ifeq ($(TARGET_TYPE),export_driver)
261 MK_MODE := kernel
262 MK_EXETYPE := dll
263 MK_DEFEXT := .sys
264 MK_DEFENTRY := _DriverEntry@8
265 MK_DDKLIBS := ntoskrnl.a hal.a
266 MK_SDKLIBS :=
267 MK_CFLAGS := -D__NTDRIVER__ -I.
268 MK_CPPFLAGS := -D__NTDRIVER__ -I.
269 MK_IMPLIB := yes
270 MK_IMPLIBONLY := no
271 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
272 MK_IMPLIB_EXT := .a
273 MK_INSTALLDIR := system32/drivers
274 MK_BOOTCDDIR := .
275 MK_DISTDIR := drivers
276 MK_RES_BASE := $(TARGET_NAME)
277 endif
278
279 ifeq ($(TARGET_TYPE),hal)
280 MK_MODE := kernel
281 MK_EXETYPE := dll
282 MK_DEFEXT := .dll
283 MK_DEFENTRY := _DriverEntry@8
284 MK_DDKLIBS := ntoskrnl.a
285 MK_SDKLIBS :=
286 MK_CFLAGS := -D__NTHAL__ -I.
287 MK_CPPFLAGS := -D__NTHAL__ -I.
288 MK_IMPLIB := yes
289 MK_IMPLIBONLY := no
290 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
291 MK_IMPLIB_EXT := .a
292 MK_INSTALLDIR := system32
293 MK_BOOTCDDIR := .
294 MK_DISTDIR := dlls
295 MK_RES_BASE := $(TARGET_NAME)
296 MK_INSTALL_BASENAME := hal
297 MK_INSTALL_FULLNAME := hal.dll
298 ifeq ($(TARGET_BOOTSTRAP),yes)
299 TARGET_BOOTSTRAP_NAME := hal.dll
300 else
301 TARGET_BOOTSTRAP_NAME := $(TARGET_NAME)$(MK_DEFEXT)
302 endif
303 TARGET_BOOTSTRAP := yes
304 endif
305
306 ifeq ($(TARGET_TYPE),bootpgm)
307 MK_MODE := kernel
308 MK_EXETYPE := exe
309 MK_DEFEXT := .exe
310 MK_DEFENTRY := _DriverEntry@8
311 MK_DDKLIBS :=
312 MK_SDKLIBS :=
313 MK_CFLAGS := -D__NTDRIVER__ -I.
314 MK_CPPFLAGS := -D__NTDRIVER__ -I.
315 MK_IMPLIB := no
316 MK_IMPLIBONLY := no
317 MK_IMPLIBDEFPATH :=
318 MK_IMPLIB_EXT := .a
319 MK_INSTALLDIR := system32
320 MK_BOOTCDDIR := system32
321 MK_DISTDIR := # FIXME
322 MK_RES_BASE := $(TARGET_NAME)
323 endif
324
325 ifeq ($(TARGET_TYPE),miniport)
326 MK_MODE := kernel
327 MK_EXETYPE := dll
328 MK_DEFEXT := .sys
329 MK_DEFENTRY := _DriverEntry@8
330 MK_DDKLIBS :=
331 MK_SDKLIBS :=
332 MK_CFLAGS := -D__NTDRIVER__ -I.
333 MK_CPPFLAGS := -D__NTDRIVER__ -I.
334 MK_IMPLIB := no
335 MK_IMPLIBONLY := no
336 MK_IMPLIBDEFPATH :=
337 MK_IMPLIB_EXT := .a
338 MK_INSTALLDIR := system32/drivers
339 MK_BOOTCDDIR := .
340 MK_DISTDIR := drivers
341 MK_RES_BASE := $(TARGET_NAME)
342 endif
343
344 ifeq ($(TARGET_TYPE),gdi_driver)
345 MK_MODE := kernel
346 MK_EXETYPE := dll
347 MK_DEFEXT := .dll
348 MK_DEFENTRY := _DrvEnableDriver@12
349 MK_DDKLIBS := ntoskrnl.a hal.a win32k.a
350 MK_SDKLIBS :=
351 MK_CFLAGS := -D__NTDRIVER__ -I.
352 MK_CPPFLAGS := -D__NTDRIVER__ -I.
353 MK_IMPLIB := yes
354 MK_IMPLIBONLY := no
355 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
356 MK_IMPLIB_EXT := .a
357 MK_INSTALLDIR := system32
358 MK_BOOTCDDIR := .
359 MK_DISTDIR := dlls
360 MK_RES_BASE := $(TARGET_NAME)
361 endif
362
363 ifeq ($(TARGET_TYPE),kernel)
364 MK_MODE := kernel
365 MK_EXETYPE := dll
366 MK_DEFEXT := .exe
367 MK_DEFENTRY := _NtProcessStartup
368 MK_DDKLIBS := hal.a
369 MK_SDKLIBS :=
370 MK_CFLAGS := -D__NTOSKRNL__ -I.
371 MK_CPPFLAGS := -D__NTOSKRNL__ -I.
372 MK_IMPLIB := yes
373 MK_IMPLIBONLY := no
374 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
375 MK_IMPLIB_EXT := .a
376 MK_INSTALLDIR := system32
377 MK_BOOTCDDIR := .
378 MK_RES_BASE := $(TARGET_NAME)
379 endif
380
381 ifeq ($(TARGET_TYPE),test)
382 TARGET_NORC := yes
383 MK_MODE := static
384 MK_EXETYPE :=
385 MK_DEFEXT := .a
386 MK_DEFENTRY :=
387 MK_DDKLIBS :=
388 MK_SDKLIBS :=
389 MK_CFLAGS := -I.
390 MK_CPPFLAGS := -I.
391 MK_IMPLIB := no
392 MK_IMPLIBONLY := no
393 MK_IMPLIBDEFPATH :=
394 MK_IMPLIB_EXT :=
395 MK_INSTALLDIR := # none
396 MK_BOOTCDDIR := system32
397 MK_DISTDIR := # none
398 MK_RES_BASE :=
399 TARGET_OBJECTS := _rtstub.o _regtests.o $(TARGET_OBJECTS)
400 endif
401
402 ifeq ($(MK_CC),)
403 MK_CC := $(CC)
404 endif
405
406 ifeq ($(MK_AR),)
407 MK_AR := $(AR)
408 endif
409
410 # can be overidden with $(CXX) for linkage of c++ executables
411 LD_CC = $(MK_CC)
412
413 ifeq ($(RM_AT_FROM_SYMBOLS),no)
414 MK_KILLAT :=
415 else
416 MK_KILLAT := --kill-at
417 endif
418
419 ifeq ($(TARGET_TYPE),program)
420 ifeq ($(TARGET_APPTYPE),windows)
421 MK_DEFENTRY := _WinMainCRTStartup
422 MK_SDKLIBS := ntdll.a kernel32.a gdi32.a user32.a
423 TARGET_LFLAGS += -Wl,--subsystem,windows
424 endif
425
426 ifeq ($(TARGET_APPTYPE),native)
427 MK_DEFENTRY := _NtProcessStartup@4
428 MK_SDKLIBS := ntdll.a
429 TARGET_LFLAGS += -Wl,--subsystem,native -nostartfiles
430 endif
431
432 ifeq ($(TARGET_APPTYPE),console)
433 MK_DEFENTRY := _mainCRTStartup
434 MK_SDKLIBS :=
435 TARGET_LFLAGS += -Wl,--subsystem,console
436 endif
437 endif
438
439 ifeq ($(TARGET_TYPE),proglib)
440 ifeq ($(TARGET_APPTYPE),windows)
441 MK_DEFENTRY := _WinMainCRTStartup
442 MK_SDKLIBS := ntdll.a kernel32.a gdi32.a user32.a
443 TARGET_LFLAGS += -Wl,--subsystem,windows
444 endif
445
446 ifeq ($(TARGET_APPTYPE),native)
447 MK_DEFENTRY := _NtProcessStartup@4
448 MK_SDKLIBS := ntdll.a
449 TARGET_LFLAGS += -Wl,--subsystem,native -nostartfiles
450 endif
451
452 ifeq ($(TARGET_APPTYPE),console)
453 MK_DEFENTRY := _mainCRTStartup
454 MK_SDKLIBS :=
455 TARGET_LFLAGS += -Wl,--subsystem,console
456 endif
457 endif
458
459 ifeq ($(TARGET_TYPE),subsystem)
460 MK_MODE := kernel
461 MK_EXETYPE := dll
462 MK_DEFEXT := .sys
463 MK_DEFENTRY := _DriverEntry@8
464 MK_DDKLIBS := ntoskrnl.a hal.a
465 MK_SDKLIBS :=
466 MK_CFLAGS := -D__NTDRIVER__ -I.
467 MK_CPPFLAGS := -D__NTDRIVER__ -I.
468 MK_IMPLIB := yes
469 MK_IMPLIBONLY := no
470 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
471 MK_IMPLIB_EXT := .a
472 MK_INSTALLDIR := system32
473 MK_DISTDIR := drivers
474 MK_RES_BASE := $(TARGET_NAME)
475 endif
476
477 ifeq ($(TARGET_TYPE),kmdll)
478 MK_MODE := kernel
479 MK_EXETYPE := dll
480 MK_DEFEXT := .dll
481 MK_DEFENTRY := 0x0
482 MK_DDKLIBS := ntoskrnl.a hal.a
483 MK_SDKLIBS :=
484 MK_CFLAGS := -D__NTDRIVER__ -I.
485 MK_CPPFLAGS := -D__NTDRIVER__ -I.
486 MK_IMPLIB := yes
487 MK_IMPLIBONLY := no
488 MK_IMPLIBDEFPATH := $(DDK_PATH_LIB)
489 MK_IMPLIB_EXT := .a
490 MK_INSTALLDIR := system32
491 MK_DISTDIR := drivers
492 MK_RES_BASE := $(TARGET_NAME)
493 endif
494
495 ifeq ($(TARGET_TYPE),winedll)
496 -include Makefile.ros
497 MK_GENERATED_MAKEFILE = Makefile.ros
498 MK_MODE := user
499 MK_EXETYPE := dll
500 MK_DEFEXT := .dll
501 MK_DEFENTRY := _DllMain@12
502 MK_DDKLIBS :=
503 MK_SDKLIBS :=
504 MK_CFLAGS := -D__USE_W32API -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501 -DWINVER=0x501 -D_STDDEF_H -I$(PATH_TO_TOP)/include/wine
505 MK_CPPFLAGS := -D__USE_W32API -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501 -DWINVER=0x501 -D__need_offsetof -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/include/wine
506 MK_PREPROC_FOR_RC_FLAGS := -xc -E -DRC_INVOKED -D__USE_W32API -I$(PATH_TO_TOP)/include/wine -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/w32api/include
507 MK_IMPLIB := yes
508 MK_IMPLIBONLY := no
509 MK_IMPLIBDEFPATH := $(SDK_PATH_LIB)
510 MK_IMPLIB_EXT := .a
511 MK_INSTALLDIR := system32
512 MK_BOOTCDDIR := system32
513 MK_DISTDIR := dlls
514 MK_RES_BASE := $(TARGET_NAME)
515 ifeq ($(TARGET_DEFNAME),)
516 MK_DEFBASENAME := $(TARGET_NAME).spec
517 MK_SPECDEF := $(MK_DEFBASENAME).def
518 else
519 MK_DEFBASENAME := $(TARGET_DEFNAME)
520 endif
521 ifneq ($(TARGET_STUBS),no)
522 MK_STUBS_SRC := $(TARGET_NAME).stubs.c
523 MK_STUBS_OBJ := $(TARGET_NAME).stubs.o
524 endif
525 MK_RC_BINARIES = $(TARGET_RC_BINARIES)
526 endif
527
528 ifeq ($(TARGET_TYPE),winedrv)
529 -include Makefile.ros
530 MK_GENERATED_MAKEFILE = Makefile.ros
531 MK_MODE := user
532 MK_EXETYPE := drv
533 MK_DEFEXT := .drv
534 # does this need changing?:
535 MK_DEFENTRY := _DllMain@12
536 MK_DDKLIBS :=
537 MK_SDKLIBS :=
538 MK_CFLAGS := -D__USE_W32API -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501 -DWINVER=0x501 -D__need_offsetof -I$(PATH_TO_TOP)/include/wine
539 MK_CPPFLAGS := -D__USE_W32API -D_WIN32_IE=0x600 -D_WIN32_WINNT=0x501 -DWINVER=0x501 -D__need_offsetof -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/include/wine
540 MK_RCFLAGS := --define __USE_W32API --include-dir $(PATH_TO_TOP)/include/wine
541 MK_IMPLIB := yes
542 MK_IMPLIBONLY := no
543 MK_IMPLIBDEFPATH := $(SDK_PATH_LIB)
544 MK_IMPLIB_EXT := .a
545 MK_INSTALLDIR := system32
546 MK_BOOTCDDIR := system32
547 MK_DISTDIR := dlls
548 MK_RES_BASE := $(TARGET_NAME)
549 ifeq ($(TARGET_DEFNAME),)
550 MK_DEFBASENAME := $(TARGET_NAME).spec
551 MK_SPECDEF := $(MK_DEFBASENAME).def
552 else
553 MK_DEFBASENAME := $(TARGET_DEFNAME)
554 endif
555 MK_RC_BINARIES = $(TARGET_RC_BINARIES)
556 endif
557
558 ifeq ($(TARGET_RC_SRCS),)
559 MK_RES_SRC := $(TARGET_PATH)/$(MK_RES_BASE).rc
560 MK_RESOURCE := $(TARGET_PATH)/$(MK_RES_BASE).coff
561 else
562 MK_RES_SRC := $(TARGET_RC_SRCS)
563 MK_RESOURCE := $(TARGET_RC_SRCS:.rc=.coff)
564 endif
565
566 ifneq ($(TARGET_INSTALLDIR),)
567 MK_INSTALLDIR := $(TARGET_INSTALLDIR)
568 endif
569
570
571 ifneq ($(BOOTCD_INSTALL),)
572 MK_INSTALLDIR := .
573 endif
574
575
576 ifeq ($(TARGET_LIBPATH),)
577 ifeq ($(MK_LIBPATH),)
578 MK_LIBPATH := $(SDK_PATH_LIB)
579 endif
580 else
581 MK_LIBPATH := $(TARGET_LIBPATH)
582 endif
583
584 ifeq ($(TARGET_IMPLIBPATH),)
585 MK_IMPLIBPATH := $(MK_IMPLIBDEFPATH)
586 else
587 MK_IMPLIBPATH := $(TARGET_IMPLIBPATH)
588 endif
589
590
591 ifeq ($(TARGET_BASENAME),)
592 MK_BASENAME := $(TARGET_NAME)
593 else
594 MK_BASENAME := $(TARGET_BASENAME)
595 endif
596
597
598 ifeq ($(TARGET_EXTENSION),)
599 MK_EXT := $(MK_DEFEXT)
600 else
601 MK_EXT := $(TARGET_EXTENSION)
602 endif
603
604
605 ifeq ($(TARGET_NORC),yes)
606 MK_FULLRES :=
607 else
608 MK_FULLRES := $(MK_RESOURCE)
609 endif
610
611 ifneq ($(TARGET_TYPE),winedll)
612 ifeq ($(TARGET_DEFNAME),)
613 MK_DEFBASENAME := $(TARGET_NAME)
614 else
615 MK_DEFBASENAME := $(TARGET_DEFNAME)
616 endif
617 endif
618
619 MK_DEFNAME := $(TARGET_PATH)/$(MK_DEFBASENAME).def
620
621 ifeq ($(MK_MODE),user)
622 ifeq ($(MK_EXETYPE),dll)
623 MK_DEFBASE := 0x10000000
624 else
625 MK_DEFBASE := 0x400000
626 endif
627 ifneq ($(TARGET_SDKLIBS),)
628 MK_LIBS := $(addprefix $(SDK_PATH_LIB)/lib, $(TARGET_SDKLIBS))
629 else
630 MK_LIBS := $(addprefix $(SDK_PATH_LIB)/lib, $(MK_SDKLIBS))
631 endif
632 endif
633
634
635 ifeq ($(MK_MODE),kernel)
636 MK_DEFBASE := 0x10000
637 MK_LIBS := $(addprefix $(DDK_PATH_LIB)/lib, $(TARGET_DDKLIBS) $(MK_DDKLIBS))
638 MK_CFLAGS += -D_SEH_NO_NATIVE_NLG
639 MK_CPPFLAGS += -D_SEH_NO_NATIVE_NLG
640 MK_LFLAGS += -nostartfiles
641 ifneq ($(TARGET_TYPE),kernel)
642 MK_LFLAGS += -nostdlib
643 endif
644 endif
645
646 #
647 # Enable Tree-Wide Optimization.
648 # Protect uncompatible files here with an ifneq
649 # if needed, until their problems can be found
650 #
651 ifeq ($(OPTIMIZED), 1)
652 MK_CFLAGS += -O2 -Wno-strict-aliasing
653 MK_CPPFLAGS += -O2 -Wno-strict-aliasing
654 endif
655
656 ifneq ($(TARGET_LIBS),)
657 MK_LIBS := $(TARGET_LIBS) $(MK_LIBS)
658 endif
659
660
661 ifeq ($(TARGET_BASE),)
662 TARGET_BASE := $(MK_DEFBASE)
663 endif
664
665
666 ifeq ($(TARGET_ENTRY),)
667 TARGET_ENTRY := $(MK_DEFENTRY)
668 endif
669
670 #
671 # Include details of the OS configuration
672 #
673 include $(PATH_TO_TOP)/config
674
675
676 TARGET_CFLAGS += $(MK_CFLAGS) $(STD_CFLAGS) -g
677
678 TARGET_CPPFLAGS += $(MK_CPPFLAGS) $(STD_CPPFLAGS) -g
679
680 TARGET_RCFLAGS += $(MK_RCFLAGS) $(STD_RCFLAGS)
681
682 TARGET_ASFLAGS += $(MK_ASFLAGS) $(STD_ASFLAGS) -g
683
684 TARGET_NFLAGS += $(MK_NFLAGS) $(STD_NFLAGS)
685
686 TARGET_LFLAGS += $(MK_LFLAGS) $(STD_LFLAGS) -g
687
688
689 MK_GCCLIBS := $(addprefix -l, $(TARGET_GCCLIBS))
690
691 ifeq ($(MK_MODE),static)
692 MK_FULLNAME := $(MK_LIBPATH)/lib$(MK_BASENAME)$(MK_EXT)
693 else
694 MK_FULLNAME := $(MK_BASENAME)$(MK_EXT)
695 endif
696
697 ifeq ($(TARGET_TYPE), kmlibrary)
698 MK_FULLNAME := $(DDK_PATH_LIB)/lib$(MK_BASENAME)$(MK_EXT)
699 endif
700
701 MK_IMPLIB_FULLNAME := lib$(MK_BASENAME)$(MK_IMPLIB_EXT)
702
703 MK_NOSTRIPNAME := $(MK_BASENAME).nostrip$(MK_EXT)
704 MK_DEBUGNAME := $(MK_BASENAME).dbg
705
706 MK_EXTRADEP := $(filter %.h,$(TARGET_OBJECTS))
707
708 ifeq ($(TARGET_TYPE),test)
709 MK_EXTRADEP += _stubs.o _hooks.o
710 endif
711
712 # We don't want to link header files
713 MK_OBJECTS := $(filter-out %.h,$(TARGET_OBJECTS)) $(MK_STUBS_OBJ)
714
715 # There is problems with C++ applications and ld -r. Ld can cause errors like:
716 # reloc refers to symbol `.text$_ZN9CCABCodecC2Ev' which is not being output
717 ifeq ($(TARGET_CPPAPP),yes)
718 MK_STRIPPED_OBJECT := $(MK_OBJECTS)
719 else
720 MK_STRIPPED_OBJECT := $(MK_BASENAME).stripped.o
721 endif
722
723 ifeq ($(TARGET_REGTESTS),yes)
724 REGTEST_TARGETS := tests/_hooks.c tests/_regtests.c tests/_stubs.S tests/Makefile.tests tests/_rtstub.c
725 MK_REGTESTS_CLEAN := clean_regtests
726 else
727 REGTEST_TARGETS :=
728 MK_REGTESTS_CLEAN :=
729 endif
730
731 ifeq ($(TARGET_WINETESTS),yes)
732 all:
733 - $(MAKE) -C winetests
734 MK_REGTESTS_CLEAN := clean_winetests
735 endif
736
737 ifeq ($(TARGET_INSTALL),)
738 MK_INSTALL := yes
739 else
740 MK_INSTALL := $(TARGET_INSTALL)
741 endif
742
743 ifeq ($(MK_INSTALL_BASENAME),)
744 MK_INSTALL_BASENAME := $(MK_BASENAME)
745 endif
746 ifeq ($(MK_INSTALL_FULLNAME),)
747 MK_INSTALL_FULLNAME := $(MK_FULLNAME)
748 endif
749
750 ifeq ($(MK_IMPLIBONLY),yes)
751
752 TARGET_CLEAN += $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME)
753
754 all: $(WINETEST_TARGETS) $(REGTEST_TARGETS) $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME)
755
756 $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME): $(MK_OBJECTS) $(MK_DEFNAME)
757 $(HALFVERBOSEECHO) [DLLTOOL] $(MK_IMPLIB_FULLNAME)
758 $(DLLTOOL) \
759 --dllname $(MK_FULLNAME) \
760 --def $(MK_DEFNAME) \
761 --output-lib $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME) \
762 $(MK_KILLAT)
763
764 else # MK_IMPLIBONLY
765
766 all: $(REGTEST_TARGETS) $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(SUBDIRS:%=%_all)
767
768
769 ifeq ($(MK_IMPLIB),yes)
770 MK_EXTRACMD := --def $(MK_DEFNAME)
771 else
772 MK_EXTRACMD :=
773 endif
774
775
776 # User mode targets
777 ifeq ($(MK_MODE),user)
778
779 ifeq ($(MK_EXETYPE),dll)
780 TARGET_LFLAGS += -mdll -Wl,--image-base,$(TARGET_BASE)
781 MK_EXTRADEP += $(MK_DEFNAME)
782 MK_EXTRACMD2 := -Wl,temp.exp
783 else
784 MK_EXTRACMD2 :=
785 endif
786
787 $(MK_BASENAME).a: $(MK_OBJECTS)
788 $(HALFVERBOSEECHO) [AR] $(MK_BASENAME).a
789 $(MK_AR) -rc $(MK_BASENAME).a $(MK_OBJECTS)
790
791 $(MK_NOSTRIPNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_BASENAME).a $(MK_LIBS) $(MK_STUBS_SRC) $(MK_STUBS_OBJ)
792 $(HALFVERBOSEECHO) [LD] $(MK_NOSTRIPNAME)
793 ifeq ($(MK_EXETYPE),dll)
794 $(LD_CC) -Wl,--base-file,base.tmp \
795 -Wl,--entry,$(TARGET_ENTRY) \
796 $(TARGET_LFLAGS) \
797 -o junk.tmp \
798 $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
799 - $(RM) junk.tmp
800 $(DLLTOOL) --dllname $(MK_FULLNAME) \
801 --base-file base.tmp \
802 --output-exp temp.exp $(MK_EXTRACMD)
803 - $(RM) base.tmp
804 $(LD_CC) -Wl,--base-file,base.tmp \
805 -Wl,--entry,$(TARGET_ENTRY) \
806 $(TARGET_LFLAGS) \
807 temp.exp \
808 -o junk.tmp \
809 $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
810 - $(RM) junk.tmp
811 $(DLLTOOL) --dllname $(MK_FULLNAME) \
812 --base-file base.tmp \
813 --output-exp temp.exp $(MK_KILLAT) $(MK_EXTRACMD)
814 - $(RM) base.tmp
815 endif
816 $(LD_CC) $(TARGET_LFLAGS) \
817 -Wl,--entry,$(TARGET_ENTRY) $(MK_EXTRACMD2) \
818 -o $(MK_NOSTRIPNAME) \
819 $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
820 - $(RM) temp.exp
821 ifeq ($(BUILD_MAP),full)
822 $(HALFVERBOSEECHO) [OBJDUMP] $(MK_BASENAME).map
823 $(OBJDUMP) -d -S $(MK_NOSTRIPNAME) > $(MK_BASENAME).map
824 else
825 ifeq ($(BUILD_MAP),yes)
826 $(HALFVERBOSEECHO) [NM] $(MK_BASENAME).map
827 $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).map
828 endif
829 endif
830
831 $(MK_FULLNAME): $(MK_NOSTRIPNAME) $(MK_EXTRADEP)
832 $(HALFVERBOSEECHO) [RSYM] $(MK_FULLNAME)
833 $(RSYM) $(MK_NOSTRIPNAME) $(MK_FULLNAME)
834
835 endif # KM_MODE
836
837 # Kernel mode targets
838 ifeq ($(MK_MODE),kernel)
839
840 ifeq ($(MK_IMPLIB),yes)
841 MK_EXTRACMD := --def $(MK_DEFNAME)
842 else
843 MK_EXTRACMD :=
844 endif
845
846 $(MK_BASENAME).a: $(MK_OBJECTS)
847 $(HALFVERBOSEECHO) [AR] $(MK_BASENAME).a
848 $(MK_AR) -rc $(MK_BASENAME).a $(MK_OBJECTS)
849
850 $(MK_NOSTRIPNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_BASENAME).a $(MK_LIBS)
851 $(HALFVERBOSEECHO) [LD] $(MK_NOSTRIPNAME)
852 $(LD_CC) -Wl,--base-file,base.tmp \
853 -Wl,--entry,$(TARGET_ENTRY) \
854 $(TARGET_LFLAGS) \
855 -o junk.tmp \
856 $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
857 - $(RM) junk.tmp
858 $(DLLTOOL) --dllname $(MK_FULLNAME) \
859 --base-file base.tmp \
860 --output-exp temp.exp $(MK_EXTRACMD) $(MK_KILLAT)
861 - $(RM) base.tmp
862 $(LD_CC) $(TARGET_LFLAGS) \
863 -Wl,--subsystem,native \
864 -Wl,--image-base,$(TARGET_BASE) \
865 -Wl,--file-alignment,0x1000 \
866 -Wl,--section-alignment,0x1000 \
867 -Wl,--entry,$(TARGET_ENTRY) \
868 -Wl,temp.exp -mdll \
869 -o $(MK_NOSTRIPNAME) \
870 $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
871 - $(RM) temp.exp
872 ifeq ($(BUILD_MAP),full)
873 $(HALFVERBOSEECHO) [OBJDUMP] $(MK_BASENAME).map
874 $(OBJDUMP) -d -S $(MK_NOSTRIPNAME) > $(MK_BASENAME).map
875 else
876 ifeq ($(BUILD_MAP),yes)
877 $(HALFVERBOSEECHO) [NM] $(MK_BASENAME).map
878 $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).map
879 endif
880 endif
881
882 $(MK_FULLNAME): $(MK_NOSTRIPNAME)
883 $(HALFVERBOSEECHO) [RSYM] $(MK_FULLNAME)
884 $(RSYM) $(MK_NOSTRIPNAME) $(MK_FULLNAME)
885
886 endif # MK_MODE
887
888 # Static library target
889 ifeq ($(MK_MODE),static)
890
891 $(MK_FULLNAME): $(MK_EXTRADEP) $(MK_OBJECTS)
892 $(HALFVERBOSEECHO) [AR] $(MK_FULLNAME)
893 $(MK_AR) -rc $(MK_FULLNAME) $(MK_OBJECTS)
894
895 # Static libraries dont have a nostrip version
896 $(MK_NOSTRIPNAME):
897 -
898
899 .PHONY: $(MK_NOSTRIPNAME)
900
901 endif # MK_MODE
902
903 endif # MK_IMPLIBONLY
904
905
906 $(MK_FULLRES): $(PATH_TO_TOP)/include/reactos/buildno.h $(MK_RES_SRC)
907
908 ifeq ($(MK_DEPENDS),yes)
909 depends:
910 else
911 depends:
912 endif
913
914 ifeq ($(MK_IMPLIB),yes)
915 $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME): $(MK_DEFNAME)
916 $(HALFVERBOSEECHO) [DLLTOOL] $(MK_IMPLIB_FULLNAME)
917 $(DLLTOOL) --dllname $(MK_FULLNAME) \
918 --def $(MK_DEFNAME) \
919 --output-lib $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME) \
920 $(MK_KILLAT)
921
922 implib: $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME)
923 else
924 implib: $(SUBDIRS:%=%_implib)
925 endif
926
927 # Precompiled header support
928 # When using PCHs, use dependency tracking to keep the .gch files up-to-date.
929 # When TARGET_PCH is defined, we always want to clean the .gch file, even if
930 # ROS_USE_PCH is not active. This prevents problems when switching between
931 # PCH and non-PCH builds.
932
933 ifneq ($(TARGET_PCH),)
934 MK_PCHCLEAN = $(TARGET_PCH).gch
935 ifeq ($(ROS_USE_PCH),yes)
936 MK_PCHNAME = $(TARGET_PCH).gch
937 ifeq ($(TARGET_CPPAPP),yes)
938 PCH_CC := $(CXX)
939 else # TARGET_CPPAPP
940 PCH_CC := $(MK_CC)
941 endif # TARGET_CPPAPP
942 else # ROS_USE_PCH
943 MK_PCHNAME =
944 endif # ROS_USE_PCH
945 else # TARGET_PCH
946 MK_PCHCLEAN =
947 MK_PCHNAME =
948 endif # TARGET_PCH
949
950 # Be carefull not to clean non-object files
951 MK_CLEANFILES := $(filter %.o,$(MK_OBJECTS))
952 MK_CLEANFILTERED := $(MK_OBJECTS:.o=.d) $(TARGET_PCH:.h=.d)
953 MK_CLEANDEPS := $(join $(dir $(MK_CLEANFILTERED)), $(addprefix ., $(notdir $(MK_CLEANFILTERED))))
954
955 clean: $(MK_REGTESTS_CLEAN) $(SUBDIRS:%=%_clean)
956 $(HALFVERBOSEECHO) [CLEAN]
957 - $(RM) *.o $(MK_PCHCLEAN) $(MK_BASENAME).a $(MK_RESOURCE) \
958 $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(MK_CLEANFILES) $(MK_CLEANDEPS) $(MK_BASENAME).map \
959 junk.tmp base.tmp temp.exp $(MK_RC_BINARIES) $(MK_SPECDEF) $(MK_STUBS_SRC) \
960 $(MK_RES_TEMPS) $(MK_GENERATED_MAKEFILE) $(TARGET_CLEAN)
961
962 ifneq ($(TARGET_HEADERS),)
963 $(TARGET_OBJECTS): $(TARGET_HEADERS)
964 endif
965
966 # install and bootcd rules
967
968 ifeq ($(MK_IMPLIBONLY),yes)
969
970 # Don't install import libraries
971
972 forceinstall:
973
974 install:
975
976 bootcd:
977
978 else # MK_IMPLIBONLY
979
980
981 # Don't install static libraries
982 ifeq ($(MK_MODE),static)
983
984 forceinstall:
985
986 install:
987
988 bootcd:
989
990 else # MK_MODE
991
992 ifneq ($(MK_INSTALL),no)
993
994 install: forceinstall
995
996 else # MK_INSTALL
997
998 install:
999
1000 endif # MK_INSTALL
1001
1002 forceinstall: $(SUBDIRS:%=%_install) $(MK_FULLNAME)
1003 $(HALFVERBOSEECHO) [INSTALL] $(MK_FULLNAME) to $(MK_INSTALLDIR)/$(MK_INSTALL_FULLNAME)
1004 -$(CP) $(MK_FULLNAME) $(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_INSTALL_FULLNAME)
1005
1006 # Bootstrap files for the bootable CD
1007 ifeq ($(TARGET_BOOTSTRAP),yes)
1008
1009 ifneq ($(TARGET_BOOTSTRAP_NAME),)
1010 MK_BOOTSTRAP_NAME := $(TARGET_BOOTSTRAP_NAME)
1011 else # TARGET_BOOTSTRAP_NAME
1012 MK_BOOTSTRAP_NAME := $(MK_INSTALL_FULLNAME)
1013 endif # TARGET_BOOTSTRAP_NAME
1014
1015 bootcd: $(SUBDIRS:%=%_bootcd)
1016 - $(CP) $(MK_FULLNAME) $(BOOTCD_DIR)/reactos/$(MK_BOOTCDDIR)/$(MK_BOOTSTRAP_NAME)
1017
1018 else # TARGET_BOOTSTRAP
1019
1020 bootcd:
1021
1022 endif # TARGET_BOOTSTRAP
1023
1024 endif # MK_MODE
1025
1026 endif # MK_IMPLIBONLY
1027
1028 ifeq ($(TARGET_TYPE),winedll)
1029 Makefile.ros: Makefile.in Makefile.ros-template
1030 $(WINE2ROS) Makefile.in Makefile.ros-template Makefile.ros
1031
1032 $(MK_RC_BINARIES): $(TARGET_RC_BINSRC)
1033 $(BIN2RES) -f -o $@ $(TARGET_RC_BINSRC)
1034
1035 $(MK_RESOURCE): $(MK_RC_BINARIES)
1036
1037 MK_RES_TEMPS = $(MK_RESOURCE:.coff=.rci) $(MK_RESOURCE:.coff=.res)
1038 endif
1039
1040 REGTEST_TESTS = $(wildcard tests/tests/*.c)
1041
1042 $(REGTEST_TARGETS): $(REGTEST_TESTS) ./tests/stubs.tst
1043 $(REGTESTS) ./tests/tests ./tests/_regtests.c ./tests/Makefile.tests -e ./tests/_rtstub.c
1044 $(REGTESTS) -s ./tests/stubs.tst ./tests/_stubs.S ./tests/_hooks.c
1045
1046 clean_regtests:
1047 - $(MAKE) -C tests TARGET_REGTESTS=no clean
1048 - $(RM) ./tests/_rtstub.c ./tests/_hooks.c ./tests/_regtests.c ./tests/_stubs.S ./tests/Makefile.tests
1049
1050 clean_winetests:
1051 - $(MAKE) -C winetests clean
1052
1053 .PHONY: all depends implib clean install dist bootcd depends gen_regtests clean_regtests clean_winetests
1054
1055 ifneq ($(SUBDIRS),)
1056 $(SUBDIRS:%=%_all): %_all:
1057 $(MAKE) -C $* SUBDIRS= all
1058
1059 $(SUBDIRS:%=%_implib): %_implib:
1060 $(MAKE) -C $* SUBDIRS= implib
1061
1062 $(SUBDIRS:%=%_test): %_test:
1063 $(MAKE) -C $* SUBDIRS= test
1064
1065 $(SUBDIRS:%=%_clean): %_clean:
1066 $(MAKE) -C $* SUBDIRS= clean
1067
1068 $(SUBDIRS:%=%_install): %_install:
1069 $(MAKE) -C $* SUBDIRS= install
1070
1071 $(SUBDIRS:%=%_dist): %_dist:
1072 $(MAKE) -C $* SUBDIRS= dist
1073
1074 $(SUBDIRS:%=%_bootcd): %_bootcd:
1075 $(MAKE) -C $* SUBDIRS= bootcd
1076
1077 .PHONY: $(SUBDIRS:%=%_all) $(SUBDIRS:%=%_implib) $(SUBDIRS:%=%_test) \
1078 $(SUBDIRS:%=%_clean) $(SUBDIRS:%=%_install) $(SUBDIRS:%=%_dist) \
1079 $(SUBDIRS:%=%_bootcd)
1080 endif
1081
1082 ifeq ($(TARGET_REGTESTS),yes)
1083 test: all
1084 $(MAKE) -C tests run
1085 else
1086 test:
1087 -
1088 endif
1089
1090 ifeq ($(TARGET_TYPE),test)
1091 run: all
1092 @$(MK_CC) -nostdlib -o _runtest.exe regtests.a $(TARGET_LIBS) _stubs.o \
1093 $(SDK_PATH_LIB)/librtshared.a $(SDK_PATH_LIB)/libregtests.a $(SDK_PATH_LIB)/libpseh.a \
1094 _hooks.o -lgcc -lmsvcrt -lntdll
1095 @$(CP) $(REGTESTS_PATH)/regtests/regtests.dll regtests.dll
1096 @_runtest.exe
1097 @$(RM) regtests.dll
1098 @$(RM) _runtest.exe
1099 endif
1100
1101 %.o: %.c $(MK_PCHNAME)
1102 $(HALFVERBOSEECHO) [CC] $<
1103 $(MK_CC) $(TARGET_CFLAGS) -c $< -o $@
1104 %.o: %.cc $(MK_PCHNAME)
1105 $(HALFVERBOSEECHO) [CXX] $<
1106 $(CXX) $(TARGET_CPPFLAGS) -c $< -o $@
1107 %.o: %.cxx $(MK_PCHNAME)
1108 $(HALFVERBOSEECHO) [CXX] $<
1109 $(CXX) $(TARGET_CPPFLAGS) -c $< -o $@
1110 %.o: %.cpp $(MK_PCHNANE)
1111 $(HALFVERBOSEECHO) [CXX] $<
1112 $(CXX) $(TARGET_CPPFLAGS) -c $< -o $@
1113 %.o: %.S
1114 $(HALFVERBOSEECHO) [AS] $<
1115 $(AS) $(TARGET_ASFLAGS) -c $< -o $@
1116 %.o: %.s
1117 $(HALFVERBOSEECHO) [AS] $<
1118 $(AS) $(TARGET_ASFLAGS) -c $< -o $@
1119 %.o: %.asm
1120 $(HALFVERBOSEECHO) [NASM] $<
1121 $(NASM_CMD) $(TARGET_NFLAGS) $< -o $@
1122 ifeq ($(TARGET_TYPE),winedll)
1123 %.coff: %.rc
1124 $(HALFVERBOSEECHO) [RC] $<
1125 $(MK_CC) $(MK_PREPROC_FOR_RC_FLAGS) $< > $(<:.rc=.rci)
1126 $(WRC) $(<:.rc=.rci) $(<:.rc=.res)
1127 $(RM) $(<:.rc=.rci)
1128 $(RC) $(<:.rc=.res) -o $@
1129 $(RM) $(<:.rc=.res)
1130 else
1131 %.coff: %.rc
1132 $(HALFVERBOSEECHO) [RC] $<
1133 $(RC) $(TARGET_RCFLAGS) $< -o $@
1134 endif
1135 %.spec.def: %.spec
1136 $(HALFVERBOSEECHO) [DEF] $<
1137 $(WINEBUILD) $(DEFS) -o $@ --def $<
1138 %.drv.spec.def: %.spec
1139 $(HALFVERBOSEECHO) [DEF] $<
1140 $(WINEBUILD) $(DEFS) -o $@ --def $<
1141 %.stubs.c: %.spec
1142 $(HALFVERBOSEECHO) [STUBS] $<
1143 $(WINEBUILD) $(DEFS) -o $@ --pedll $<
1144 %.i: %.c
1145 $(HALFVERBOSEECHO) [CPP] $<
1146 $(MK_CC) $(TARGET_CFLAGS) -E $< > $@
1147 %.h.gch: %.h
1148 $(HALFVERBOSEECHO) [PCH] $<
1149 $(PCH_CC) $(CFLAGS) $<
1150 # rule for msvc conversion
1151 %.c: %_msvc.c
1152 $(HALFVERBOSEECHO) [MS2PS] $<
1153 $(subst /,$(SEP),$(MS2PS)) -try try -except except -finally finally < $< > $@
1154
1155 # Kill implicit rule
1156 .o:;
1157
1158 # Compatibility
1159 CFLAGS := $(TARGET_CFLAGS)
1160 NFLAGS := $(TARGET_NFLAGS)