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