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