source: trunk/make/process.mak@ 9090

Last change on this file since 9090 was 9090, checked in by bird, 23 years ago

-Implemented a 'needed' pass to make required tools like code generators etc.
-Made SUBDIRS and PRE/POSTMAKEFILES more customizable by adding _<rule>
overrides. This is good when you wanna skip a tree for a rule (=pass) or/and
just run do that rule (=pass) in a tree.
-Added check for TARGET_PRIVATE macro before installing anything.

File size: 39.6 KB
Line 
1# $Id: process.mak,v 1.21 2002-08-22 03:25:48 bird Exp $
2
3#
4# Unix-like tools for OS/2
5#
6# The common build process rules
7#
8# Note: this makefile is supposed to be included from the
9# current source path.
10#
11
12
13# -----------------------------------------------------------------------------
14# Assertions.
15# This makefile expects setup.mak and the specific setup to be included
16# already.
17# It also requires the TARGET_NAME to be specified in the makefile.
18# -----------------------------------------------------------------------------
19!if "$(MAKE_SETUP_INCLUDED)" != "YES"
20! ifndef MAKEVER
21! if [$(ECHO) $(CLRERR)Fatal error: You must include setup.mak before process.mak in the makefile.$(CLRRST)]
22! endif
23! error
24!else
25! error $(CLRERR)Fatal error: You must include setup.mak before process.mak in the makefile.$(CLRRST)
26!endif
27!endif
28!if "$(ENV_STATUS)" != "OK"
29! ifndef MAKEVER
30! if [$(ECHO) $(CLRERR)Fatal error: The environment is not valid. Bad setup.mak?$(CLRRST)]
31! endif
32! error
33! else
34! error $(CLRERR)Fatal error: The environment is not valid. Bad setup.mak?$(CLRRST)
35! endif
36!endif
37
38!if "$(TARGET_NAME)" == "" && "$(TARGET_MODE)" != "EMPTY"
39! ifndef MAKEVER
40! if [$(ECHO) $(CLRERR)Fatal error: TARGET_NAME is not defined! Should be set in the makefile.$(CLRRST)]
41! endif
42! error
43! else
44! error $(CLRERR)Fatal error: TARGET_NAME is not defined! Should be set in the makefile.$(CLRRST)
45! endif
46!endif
47
48!ifdef TARGET_MODE
49# Executable target mode.
50! if "$(TARGET_MODE)" != "EXE"
51# Dynamic Load Library target mode.
52! if "$(TARGET_MODE)" != "DLL"
53# Drive (/ system software) target mode.
54! if "$(TARGET_MODE)" != "SYS"
55# Installable File System Drive target mode. (Also called FSD, File System Driver.)
56! if "$(TARGET_MODE)" != "IFS"
57# Virtual Device Driver target mode.
58! if "$(TARGET_MODE)" != "VDD"
59# Object Library target mode.
60! if "$(TARGET_MODE)" != "LIB"
61# Object Library target mode - Special variant which is to be linked with a SYS target.
62! if "$(TARGET_MODE)" != "SYSLIB"
63# Object Library target mode - Special variant which is to be linked with an IFS target.
64! if "$(TARGET_MODE)" != "IFSLIB"
65# Dummy/Hub/TopLevel empty makefile. This has no target.
66! if "$(TARGET_MODE)" != "EMPTY"
67# Dependency only makefile. (typical for include directories)
68! if "$(TARGET_MODE)" != "DEPEND"
69# Testcase makefile.
70! if "$(TARGET_MODE)" != "TESTCASE"
71# Bad TARGET_MODE complain.
72! ifndef MAKEVER
73! if [$(ECHO) $(CLRERR)Fatal Error: Bad TARGET_MODE="$(TARGET_MODE)". Valid ones are: EXE, DLL, SYS, IFS, VDD, LIB, SYSLIB, IFSLIB, TESTCASE and EMPTY.$(CLRRST)]
74! endif
75! error
76! else
77! error $(CLRERR)Fatal Error: Bad TARGET_MODE="$(TARGET_MODE)". Valid ones are: EXE, DLL, SYS, IFS, VDD, LIB, SYSLIB, IFSLIB, TESTCASE and EMPTY.$(CLRRST)
78! endif
79! endif
80! endif
81! endif
82! endif
83! endif
84! endif
85! endif
86! endif
87! endif
88! endif
89! endif
90!endif
91
92
93# -----------------------------------------------------------------------------
94# Provide overridable defaults
95# -----------------------------------------------------------------------------
96
97# Default target mode is executable.
98!ifndef TARGET_MODE
99TARGET_MODE = EXE
100!endif
101
102# Default extension corresponds to the target mode.
103!ifndef TARGET_EXT
104! if "$(TARGET_MODE)" == "DLL"
105TARGET_EXT = $(EXT_DLL)
106! endif
107! if "$(TARGET_MODE)" == "SYS"
108TARGET_EXT = $(EXT_SYS)
109! endif
110! if "$(TARGET_MODE)" == "IFS"
111TARGET_EXT = $(EXT_IFS)
112! endif
113! if "$(TARGET_MODE)" == "VDD"
114TARGET_EXT = $(EXT_VDD)
115! endif
116! if "$(TARGET_MODE)" == "EXE"
117TARGET_EXT = $(EXT_EXE)
118! endif
119! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
120TARGET_EXT = $(EXT_LIB)
121! endif
122! if "$(TARGET_MODE)" == "EMPTY"
123TARGET_EXT = empty
124! endif
125! if "$(TARGET_MODE)" == "DEPEND"
126TARGET_EXT = depend
127! endif
128! if "$(TARGET_MODE)" == "TESTCASE"
129TARGET_EXT = testcase
130! endif
131! ifndef TARGET_EXT
132! ifndef MAKEVER
133! if [$(ECHO) $(CLRERR)Internal Error: TARGET_EXT not set. Probably invalid TARGET_MODE. (TARGET_MODE="$(TARGET_MODE)")$(CLRRST)]
134! endif
135! error
136! else
137! error $(CLRERR)Internal Error: TARGET_EXT not set. Probably invalid TARGET_MODE. (TARGET_MODE="$(TARGET_MODE)")$(CLRRST)
138! endif
139! endif
140!endif
141
142# Default target path. (where all the generated stuff for this target goes)
143!ifndef PATH_TARGET
144PATH_TARGET = $(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
145!endif
146
147# Default target file. (output)
148!ifndef TARGET
149! if "$(TARGET_MODE)" != "EMPTY"
150! if "$(TARGET_MODE)" != "TESTCASE"
151TARGET = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
152! else
153TARGET = testcase
154! endif
155! endif
156!endif
157
158# Default target .sym file. (output)
159!ifndef TARGET_SYM
160TARGET_SYM = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_SYM)
161!endif
162
163# Default object file. (output)
164!ifndef TARGET_OBJS
165TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
166!endif
167
168# Default libraries. (input)
169!ifndef TARGET_LIBS
170TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
171!endif
172
173# Default definition file. (input)
174!ifndef TARGET_DEF
175TARGET_DEF = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
176!endif
177
178# Default modified definition filename. (output)
179!ifndef TARGET_DEF_LINK
180TARGET_DEF_LINK = $(PATH_TARGET)\$(TARGET_NAME)_link.def
181!endif
182
183# Default definition file for generating the import library. (input)
184!ifndef TARGET_IDEF
185TARGET_IDEF = $(TARGET_DEF)
186!endif
187
188# Default map file. (output)
189!ifndef TARGET_MAP
190TARGET_MAP = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_MAP)
191!endif
192
193# Default link file. (output)
194!ifndef TARGET_LNK
195TARGET_LNK = $(PATH_TARGET)\$(TARGET_NAME).lnk
196!endif
197
198# Default import library file. (output)
199!ifndef TARGET_ILIB
200! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_ILIB_YES)" != ""
201TARGET_ILIB =$(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
202! endif
203!endif
204
205# Default public name. (output)
206!ifndef TARGET_PUBNAME
207TARGET_PUBNAME=
208! ifdef TARGET_PUBLIC
209! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
210TARGET_PUBNAME=$(PATH_LIB)\$(TARGET_NAME).$(TARGET_EXT)
211! endif
212! if "$(TARGET_MODE)" == "EXE"
213TARGET_PUBNAME=$(PATH_EXE)\$(TARGET_NAME).$(TARGET_EXT)
214! endif
215! if "$(TARGET_MODE)" == "DLL"
216TARGET_PUBNAME=$(PATH_DLL)\$(TARGET_NAME).$(TARGET_EXT)
217! endif
218! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
219TARGET_PUBNAME=$(PATH_SYS)\$(TARGET_NAME).$(TARGET_EXT)
220! endif
221! if "$(TARGET_MODE)" == "VDD"
222TARGET_PUBNAME=$(PATH_VDD)\$(TARGET_NAME).$(TARGET_EXT)
223! endif
224! endif
225!endif
226
227# Default depend filename.
228!ifndef TARGET_DEPEND
229TARGET_DEPEND = $(PATH_TARGET)\.depend
230!endif
231
232# Default makefile names.
233!ifndef BUILD_MAKEFILE
234BUILD_MAKEFILE = Makefile
235!endif
236
237# Default makefile name.
238!ifndef MAKEFILE
239MAKEFILE = $(BUILD_MAKEFILE)
240!endif
241
242# Ignore linker warnings for some target modes.
243!ifndef TARGET_IGNORE_LINKER_WARNINGS
244! if "$(TARGET_MODE)" == "DLL"
245TARGET_IGNORE_LINKER_WARNINGS = 1
246! endif
247!endif
248
249
250# Default stacksize
251# If 16bit: 8KB
252# Else (32bit): 64KB
253!ifndef TARGET_STACKSIZE
254! ifdef ENV_16BIT
255TARGET_STACKSIZE=0x2000
256! else
257TARGET_STACKSIZE=0x10000
258! endif
259!endif
260
261
262
263# -----------------------------------------------------------------------------
264# Tell user what we're building.
265# -----------------------------------------------------------------------------
266!ifndef BUILD_QUIET
267! if "$(TARGET)" != ""
268! ifndef MAKEVER
269! if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
270! endif
271! else
272$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)
273! endif
274! endif
275!endif
276
277
278# -----------------------------------------------------------------------------
279# Ensure the platform-specific target path exists
280# -----------------------------------------------------------------------------
281
282!if "$(TARGET_MODE)" != "EMPTY"
283! if "$(PATH_TARGET)" != ""
284! ifndef MAKEVER
285! if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
286! ifndef BUILD_QUIET
287! if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
288! endif
289! endif
290! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
291! if [$(ECHO) $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)]
292! endif
293! error
294! endif
295! endif
296! else
297! if %exist($(PATH_TARGET)) == 0
298! ifndef BUILD_QUIET
299$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
300! endif
301! else
302! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
303! error $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)
304! endif
305! endif
306! endif
307! endif
308!endif
309# not 100% sure about the != EMPTY stuff, but this is way faster.
310
311
312
313# -----------------------------------------------------------------------------
314# Common inference rules
315# -----------------------------------------------------------------------------
316.SUFFIXES:
317.SUFFIXES: .c .cpp .asm .$(EXT_OBJ) .$(EXT_RES) .rc .ii .s
318
319#
320# A workaround for SlickEdits inability to find the buggy files..
321# This makes the source filenames in the error listing have full path.
322# See setup.mak for compile command line.
323#
324_SRC = $<
325!ifdef SLKRUNS
326_SRC = $(PATH_CURRENT)\$<
327!endif
328
329
330# Assembling assembly source.
331.asm{$(PATH_TARGET)}.$(EXT_OBJ):
332 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
333 \
334! ifndef BUILD_VERBOSE
335 @ \
336! endif
337!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
338 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$@
339!else
340 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$@
341!endif
342
343.asm.$(EXT_OBJ):
344 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRRST)
345 \
346!ifndef BUILD_VERBOSE
347 @ \
348!endif
349!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
350 $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
351!else
352 $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
353!endif
354
355# C++ Compiler base line
356_CXX_BASELINE = $(CXX) \
357!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
358 $(CXX_FLAGS_EXE) \
359!endif
360!if "$(TARGET_MODE)" == "DLL"
361 $(CXX_FLAGS_DLL) \
362!endif
363!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
364 $(CXX_FLAGS_SYS) \
365!endif
366!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
367 $(CXX_FLAGS_IFS) \
368!endif
369
370# Compiling C++ source.
371.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
372 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
373 \
374!ifndef BUILD_VERBOSE
375 @ \
376!endif
377 $(TOOL_JOB_SUB) $(_CXX_BASELINE) \
378!if "$(CXX_LST_OUT)" != ""
379 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
380!endif
381 $(CXX_OBJ_OUT)$@ $(_SRC)
382
383.cpp.$(EXT_OBJ):
384 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
385 \
386!ifndef BUILD_VERBOSE
387 @ \
388!endif
389 $(_CXX_BASELINE) \
390!if "$(CXX_LST_OUT)" != ""
391 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
392!endif
393 $(CXX_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
394
395
396# Pre-Compiling C++ source.
397.cpp.ii:
398 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
399 \
400!ifndef BUILD_VERBOSE
401 @ \
402!endif
403 $(_CXX_BASELINE) \
404 $(CXX_PC_2_STDOUT) $(_SRC) > $@
405
406
407# Compiler C++ source to assembly.
408!if "$(CXX_AS_2_FILE)" != ""
409.cpp.s:
410 @$(ECHO) C++ To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
411 \
412!ifndef BUILD_VERBOSE
413 @ \
414!endif
415 $(_CXX_BASELINE) \
416 $(CXX_AS_2_FILE)$@ $(_SRC)
417!endif
418
419
420
421# C Compiler base line
422_CC_BASELINE = $(CC) \
423!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
424 $(CC_FLAGS_EXE) \
425!endif
426!if "$(TARGET_MODE)" == "DLL"
427 $(CC_FLAGS_DLL) \
428!endif
429!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
430 $(CC_FLAGS_SYS) \
431!endif
432!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
433 $(CC_FLAGS_IFS) \
434!endif
435
436# Compiling C source.
437.c{$(PATH_TARGET)}.$(EXT_OBJ):
438 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
439 \
440!ifndef BUILD_VERBOSE
441 @ \
442!endif
443 $(TOOL_JOB_SUB) $(_CC_BASELINE) \
444!if "$(CC_LST_OUT)" != ""
445 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
446!endif
447 $(CC_OBJ_OUT)$@ $(_SRC)
448
449.c.$(EXT_OBJ):
450 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRRST)
451 \
452!ifndef BUILD_VERBOSE
453 @ \
454!endif
455 $(_CC_BASELINE) \
456!if "$(CC_LST_OUT)" != ""
457 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
458!endif
459 $(CC_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
460
461
462# Pre-Compiling C source.
463.c.ii:
464 @$(ECHO) C PreCompiler $(CLRFIL)$(_SRC) $(CLRRST)
465 \
466!ifndef BUILD_VERBOSE
467 @ \
468!endif
469 $(_CC_BASELINE) \
470 $(CC_PC_2_STDOUT) $(_SRC) > $@
471
472
473# Compiler C source to assembly.
474!if "$(CC_AS_2_FILE)" != ""
475.c.s:
476 @$(ECHO) C To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
477 \
478!ifndef BUILD_VERBOSE
479 @ \
480!endif
481 $(_CC_BASELINE) \
482 $(CC_AS_2_FILE)$@ $(_SRC)
483!endif
484
485
486# Compiling resources.
487.rc{$(PATH_TARGET)}.res:
488 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
489 \
490!ifndef BUILD_VERBOSE
491 @ \
492!endif
493 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $(_SRC) $@
494
495.rc.res:
496 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
497 \
498!ifndef BUILD_VERBOSE
499 @ \
500!endif
501 $(RC) $(RC_FLAGS) $(_SRC) $(PATH_TARGET)\$(@F)
502
503
504
505
506
507# -----------------------------------------------------------------------------
508# The all rule - The default one, as it's the first rule in the file.
509# -----------------------------------------------------------------------------
510all: build
511
512
513
514# -----------------------------------------------------------------------------
515# The build rule - This runs all passes:
516# 1. Make Dependencies
517# 2. Make Needed Tools (stuff required in the next steps)
518# 3. Make Libraries (all kinds)
519# 4. Make Executables
520# 5. Make Miscellaneous Targets
521# 6. Make Install
522# Note: In order to load dependencies we'll do a forwarding after making them.
523# -----------------------------------------------------------------------------
524build: _build
525!if "$(MAKEFLAGS:I=_)" == "$(MAKEFLAGS)" # this is of course broken in nmake v5.0 for OS/2.
526 @$(ECHO)$(CLRMAK)[Successfully Built Everything!] $(CLRRST)
527!else
528 @$(ECHO)$(CLRMAK)[Built Everything! (Ignore option specified)] $(CLRRST)
529!endif
530
531# internal rule shared by rebuild and build.
532_build: _build_banner_dep dep
533!ifndef BUILD_QUIET
534 @$(ECHO) Restarting $(CLRFIL)$(MAKEFILE)$(CLRTXT) with new dependencies. $(CLRRST)
535!endif
536 \
537!ifndef BUILD_VERBOSE
538 @ \
539!endif
540 $(TOOL_MAKE) -f $(MAKEFILE) _build_new_dependencies_
541
542# internal rule used to reload dependencies.
543_build_new_dependencies_: \
544 _build_banner_needed needed \
545 _build_banner_lib lib \
546 _build_banner_executable executable \
547 _build_banner_miscellaneous miscellaneous \
548 _build_banner_install install
549
550# Banners for rebuild and build.
551_build_banner_clean:
552 @$(ECHO)$(CLRMAK)[Start Pass 0 - Make Clean] $(CLRRST)
553 @SET _BUILD_PASS=0
554_build_banner_dep:
555 @$(ECHO)$(CLRMAK)[Start Pass 1 - Make Dependencies] $(CLRRST)
556 @SET _BUILD_PASS=1
557_build_banner_needed:
558 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
559 @SET _BUILD_PASS=2
560_build_banner_lib:
561 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
562 @SET _BUILD_PASS=3
563_build_banner_executable:
564 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Executables] $(CLRRST)
565 @SET _BUILD_PASS=4
566_build_banner_miscellaneous:
567 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
568 @SET _BUILD_PASS=5
569_build_banner_install:
570 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Install] $(CLRRST)
571 @SET _BUILD_PASS=6
572
573
574
575# -----------------------------------------------------------------------------
576# The rebuild rule - Same as build but does a clean first (as Pass 0).
577# -----------------------------------------------------------------------------
578rebuild: \
579 _build_banner_clean clean \
580 _build
581!if "$(MAKEFLAGS:i=_)" == "$(MAKEFLAGS)"
582 @$(ECHO)$(CLRMAK)[Successfully Rebuilt Everything!] $(CLRRST)
583!else
584 @$(ECHO)$(CLRMAK)[Rebuilt Everything! (Ignore option specified)] $(CLRRST)
585!endif
586
587
588
589# -----------------------------------------------------------------------------
590# Pass 0 - The clean rule - Clean up output files.
591# The current setup doesn't clean the installed ones.
592# -----------------------------------------------------------------------------
593!if "$(TARGET_MODE)" != "TESTCASE"
594clean:
595 @$(ECHO) Cleaning... $(CLRRST)
596!if "$(PATH_TARGET)" != "" # paranoia
597 \
598! ifndef BUILD_VERBOSE
599 @ \
600! endif
601 $(TOOL_RM) \
602 $(PATH_TARGET)\*.$(EXT_OBJ) \
603 $(PATH_TARGET)\*.$(EXT_ILIB) \
604 $(PATH_TARGET)\*.$(EXT_EXE) \
605 $(PATH_TARGET)\*.$(EXT_DLL) \
606 $(PATH_TARGET)\*.$(EXT_RES)
607 \
608! ifndef BUILD_VERBOSE
609 @ \
610! endif
611 $(TOOL_RM) \
612 $(PATH_TARGET)\*.$(EXT_SYS) \
613 $(PATH_TARGET)\*.$(EXT_LIB) \
614 $(PATH_TARGET)\*.$(EXT_IFS) \
615 $(PATH_TARGET)\*.$(EXT_MAP) \
616 $(PATH_TARGET)\*.$(EXT_SYM)
617 \
618! ifndef BUILD_VERBOSE
619 @ \
620! endif
621 $(TOOL_RM) \
622 $(PATH_TARGET)\*.s \
623 $(PATH_TARGET)\*.lst \
624 $(PATH_TARGET)\*.lnk \
625 $(PATH_TARGET)\*.ii \
626 $(PATH_TARGET)\.depend"
627 \
628! ifndef BUILD_VERBOSE
629 @ \
630! endif
631 $(TOOL_RM) \
632 .\*.ii \
633 .\*.err \
634 .\.depend
635!endif
636!ifdef SUBDIRS_CLEAN
637 @$(TOOL_DODIRS) "$(SUBDIRS_CLEAN)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
638!else
639! ifdef SUBDIRS
640 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
641! endif
642!endif
643!ifdef PREMAKEFILES_CLEAN
644 @$(TOOL_DOMAKES) "$(PREMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
645!else
646! ifdef PREMAKEFILES
647 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
648! endif
649!endif
650!ifdef POSTMAKEFILES_CLEAN
651 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
652!else
653! ifdef POSTMAKEFILES
654 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
655! endif
656!endif
657
658!endif #!TESTCASE
659
660
661
662# -----------------------------------------------------------------------------
663# Pass 1 - The dep rule - Make dependencies.
664# -----------------------------------------------------------------------------
665dep:
666!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
667 @$(ECHO) Making dependencies... $(CLRRST)
668 \
669! ifndef BUILD_VERBOSE
670 @ \
671! endif
672 $(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
673! ifdef TARGET_NO_DEP
674 -x$(TARGET_NO_DEP: =;)\
675! endif
676 $(TOOL_DEP_FILES)
677!endif
678!ifdef SUBDIRS_DEP
679 @$(TOOL_DODIRS) "$(SUBDIRS_DEP)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
680!else
681! ifdef SUBDIRS
682 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
683! endif
684!endif
685!ifdef PREMAKEFILES_DEP
686 @$(TOOL_DOMAKES) "$(PREMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
687!else
688! ifdef PREMAKEFILES
689 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
690! endif
691!endif
692!ifdef POSTMAKEFILES_DEP
693 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
694!else
695! ifdef POSTMAKEFILES
696 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
697! endif
698!endif
699
700
701
702# -----------------------------------------------------------------------------
703# Pass 2 - The needed rule - Make need tools.
704# That is tools and stuff that is required for the next passes.
705# WARNING! These tools and stuff shouldn't rely on libraries and other
706# results of later passes.
707# -----------------------------------------------------------------------------
708!ifdef SUBDIRS_NEEDED
709_SUBDIRS_NEEDED = _subdir_needed
710$(_SUBDIRS_NEEDED):
711 @$(TOOL_DODIRS) "$(SUBDIRS_NEEDED)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
712!else
713! ifdef SUBDIRS
714_SUBDIRS_NEEDED = _subdir_needed
715$(_SUBDIRS_NEEDED):
716 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
717! endif
718!endif
719
720!ifdef PREMAKEFILES_NEEDED
721_PREMAKEFILES_NEEDED = _premakefiles_needed
722$(_PREMAKEFILES_NEEDED):
723 @$(TOOL_DOMAKES) "$(PREMAKEFILES_NEEDED)" $(TOOL_MAKE) needed
724!else
725! ifdef PREMAKEFILES
726_PREMAKEFILES_NEEDED = _premakefiles_needed
727$(_PREMAKEFILES_NEEDED):
728 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) needed
729! endif
730!endif
731
732!if "$(TARGET_NEEDED)" != ""
733needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED) target
734!else
735needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED)
736!endif
737!ifdef POSTMAKEFILES_NEEDED
738 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_NEEDED)" $(TOOL_MAKE) $@
739!else
740! ifdef POSTMAKEFILES
741 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
742! endif
743!endif
744
745
746
747# -----------------------------------------------------------------------------
748# Pass 3 - The lib rule - Make libraries.
749# -----------------------------------------------------------------------------
750!ifdef SUBDIRS_LIB
751_SUBDIRS_LIB = _subdir_lib
752$(_SUBDIRS_LIB):
753 @$(TOOL_DODIRS) "$(SUBDIRS_LIB)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
754!else
755! ifdef SUBDIRS
756_SUBDIRS_LIB = _subdir_lib
757$(_SUBDIRS_LIB):
758 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
759! endif
760!endif
761
762!ifdef PREMAKEFILES_LIB
763_PREMAKEFILES_LIB = _premakefiles_lib
764$(_PREMAKEFILES_LIB):
765 @$(TOOL_DOMAKES) "$(PREMAKEFILES_LIB)" $(TOOL_MAKE) lib
766!else
767! ifdef PREMAKEFILES
768_PREMAKEFILES_LIB = _premakefiles_lib
769$(_PREMAKEFILES_LIB):
770 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
771! endif
772!endif
773
774lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
775!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
776 $(TARGET) $(TARGET_PUBNAME) \
777!endif
778 $(TARGET_ILIB)
779!ifdef POSTMAKEFILES_LIB
780 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
781!else
782! ifdef POSTMAKEFILES
783 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
784! endif
785!endif
786
787
788
789# -----------------------------------------------------------------------------
790# Pass 4 - The executable rule - Build the executables.
791# -----------------------------------------------------------------------------
792!ifdef SUBDIRS_EXECUTABLE
793_SUBDIRS_EXECUTABLE = _subdir_executable
794$(_SUBDIRS_EXECUTABLE):
795 @$(TOOL_DODIRS) "$(SUBDIRS_EXECUTABLE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
796!else
797! ifdef SUBDIRS
798_SUBDIRS_EXECUTABLE = _subdir_executable
799$(_SUBDIRS_EXECUTABLE):
800 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
801! endif
802!endif
803
804!ifdef PREMAKEFILES_EXECUTABLE
805_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
806$(_PREMAKEFILES_EXECUTABLE):
807 @$(TOOL_DOMAKES) "$(PREMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) executable
808!else
809! ifdef PREMAKEFILES
810_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
811$(_PREMAKEFILES_EXECUTABLE):
812 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) executable
813! endif
814!endif
815
816executable: \
817!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && "$(TARGET_NEEDED)" == ""
818 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE) $(TARGET) $(TARGET_PUBNAME)
819! if "$(TARGET)" != ""
820 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET)$(CLRRST)
821! endif
822!else
823 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE)
824!endif
825!ifdef POSTMAKEFILES_EXECUTABLE
826 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) $@
827!else
828! ifdef POSTMAKEFILES
829 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
830! endif
831!endif
832
833
834
835# -----------------------------------------------------------------------------
836# Pass 5 - The miscellaneous rule - Makes other miscellaneous stuff like
837# documentations etc. This is experimental for the moment.
838# -----------------------------------------------------------------------------
839!ifdef SUBDIRS_MISC
840_SUBDIRS_MISC = _subdir_misc
841$(SUBDIRS_MISC):
842 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
843!else
844! ifdef SUBDIRS
845_SUBDIRS_MISC = _subdir_misc
846$(_SUBDIRS_MISC):
847 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
848! endif
849!endif
850
851!ifdef PREMAKEFILES_MISC
852_PREMAKEFILES_MISC = _premakefiles_misc
853$(PREMAKEFILES_MISC):
854 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) miscellaneous
855!else
856! ifdef PREMAKEFILES
857_PREMAKEFILES_MISC = _premakefiles_misc
858$(_PREMAKEFILES_MISC):
859 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) miscellaneous
860! endif
861!endif
862
863miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
864 $(TARGET_DOCS) $(TARGET_MISC)
865!if "$(TARGET_DOCS)$(TARGET_MISC)" != ""
866 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
867!endif
868!ifdef POSTMAKEFILES_MISC
869 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
870!else
871! ifdef POSTMAKEFILES
872 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
873! endif
874!endif
875
876
877
878# -----------------------------------------------------------------------------
879# Pass 6 - The install rule - Copies target to main binary directory.
880# Installation order is not concidered vital, so subdirectories and
881# pre-makefiles are processed after this directory. This might be changed.
882# -----------------------------------------------------------------------------
883install:
884!if "$(TARGET_PUBLIC)" == "" && "$(TARGET_PUBNAME)" == "" && "$(TARGET_PRIVATE)" == ""
885! if "$(TARGET_MODE)" == "EXE"
886 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_BIN)$(CLRRST)
887 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
888 @if not exist $(PATH_BIN) $(TOOL_CREATEPATH) $(PATH_BIN)
889 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_BIN)
890 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_BIN)
891! endif
892! if "$(TARGET_MODE)" == "DLL"
893 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_DLL)$(CLRRST)
894 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
895 @if not exist $(PATH_DLL) $(TOOL_CREATEPATH) $(PATH_DLL)
896 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_DLL)
897 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_DLL)
898! endif
899! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
900 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_SYS)$(CLRRST)
901 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
902 @if not exist $(PATH_SYS) $(TOOL_CREATEPATH) $(PATH_SYS)
903 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_SYS)
904 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_SYS)
905! endif
906!if 0 # these targets are either TARGET_PUBLIC or all private.
907! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
908 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_LIB)$(CLRRST)
909 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
910 @if not exist $(PATH_LIB) $(TOOL_CREATEPATH) $(PATH_LIB)
911 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_LIB)
912 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_LIB)
913! endif
914! endif
915!endif
916!if "$(TARGET_DOCS)" != ""
917 $(TOOL_COPY) $(TARGET_DOCS) $(PATH_DOC)
918!endif
919!ifdef SUBDIRS_INSTALL
920 @$(TOOL_DODIRS) "$(SUBDIRS_INSTALL)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
921!else
922! ifdef SUBDIRS
923 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
924! endif
925!endif
926!ifdef PREMAKEFILES_INSTALL
927 @$(TOOL_DOMAKES) "$(PREMAKEFILES_INSTALL)" $(TOOL_MAKE) $@
928!else
929! ifdef PREMAKEFILES
930 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
931! endif
932!endif
933!ifdef POSTMAKEFILES_INSTALL
934 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_INSTALL)" $(TOOL_MAKE) $@
935!else
936! ifdef POSTMAKEFILES
937 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
938! endif
939!endif
940
941
942
943# -----------------------------------------------------------------------------
944# Pass x - The testcase rule - Execute testcases when present.
945# Testcases are either a testcase.mak file or a testcase subdirectory.
946# -----------------------------------------------------------------------------
947!if "$(TARGET_MODE)" != "TESTCASE"
948!ifndef BUILD_OWN_TESTCASE_RULE
949
950!ifndef MAKEVER
951_TESTCASE_TST1 = [$(TOOL_EXISTS) testcase] == 0
952_TESTCASE_TST2 = [$(TOOL_EXISTS) testcase.mak] == 0
953!else
954_TESTCASE_TST1 = exists(testcase) != 0
955_TESTCASE_TST2 = exists(testcase.mak) != 0
956!endif
957
958testcase:
959 @$(ECHO) Executing testcases $(CLRRST)
960!if $(_TESTCASE_TST1)
961 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
962!endif
963!if $(_TESTCASE_TST2)
964 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
965!endif
966!ifdef SUBDIRS_TESTCASE
967 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
968!else
969! ifdef SUBDIRS
970 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
971! endif
972!endif
973!ifdef PREMAKEFILES_TESTCASE
974 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
975!else
976! ifdef PREMAKEFILES
977 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
978! endif
979!endif
980!ifdef POSTMAKEFILES_TESTCASE
981 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
982!else
983! ifdef POSTMAKEFILES
984 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
985! endif
986!endif
987
988!endif # BUILD_OWN_TESTCASE_RULE
989!endif #!TESTCASE
990
991
992
993# -----------------------------------------------------------------------------
994# The target rule - Build the target.
995# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
996# -----------------------------------------------------------------------------
997target: $(TARGET) $(TARGET_ILIB) $(TARGET_PUBNAME)
998 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
999
1000
1001
1002# -----------------------------------------------------------------------------
1003# The shell rule - Setup the correcte shell environment and start a shell.
1004# -----------------------------------------------------------------------------
1005shell:
1006 @$(ECHO) Creating work shell $(CLRRST)
1007 \
1008!ifndef BUILD_VERBOSE
1009 @ \
1010!endif
1011 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1012 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
1013
1014
1015
1016# -----------------------------------------------------------------------------
1017# The nothing rule - Rule for testing the makefile structure.
1018# -----------------------------------------------------------------------------
1019nothing:
1020 @$(ECHO) Doing nothing in $(MAKEFILE).
1021!ifdef SUBDIRS
1022 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1023!endif
1024!ifdef PREMAKEFILES
1025 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1026!endif
1027!ifdef POSTMAKEFILES
1028 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1029!endif
1030 @$(ECHO) Completed nothing in $(MAKEFILE).
1031
1032
1033
1034# -----------------------------------------------------------------------------
1035# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1036# -----------------------------------------------------------------------------
1037!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
1038$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS)
1039!if "$(TOOL_JOB_WAIT)" != ""
1040! ifndef BUILD_QUIET
1041 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1042! endif
1043 \
1044! ifndef BUILD_VERBOSE
1045 @ \
1046! endif
1047 $(TOOL_JOB_WAIT)
1048!endif
1049 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
1050 \
1051!ifndef BUILD_VERBOSE
1052 @ \
1053!endif
1054!ifdef TARGET_IGNORE_LINKER_WARNINGS
1055 -4 \
1056!endif
1057!if "$(TARGET_MODE)" == "EXE"
1058 $(LINK_CMD_EXE)
1059!endif
1060!if "$(TARGET_MODE)" == "DLL"
1061 $(LINK_CMD_DLL)
1062!endif
1063!if "$(TARGET_MODE)" == "SYS"
1064 $(LINK_CMD_SYS)
1065!endif
1066!if "$(TARGET_MODE)" == "IFS"
1067 $(LINK_CMD_IFS)
1068!endif
1069!if "$(TARGET_MODE)" == "VDD"
1070 $(LINK_CMD_VDD)
1071!endif
1072!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1073 @$(ECHO) Linking Resources $(CLRRST)
1074 \
1075! ifndef BUILD_VERBOSE
1076 @ \
1077! endif
1078 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
1079!endif
1080!if "$(TARGET_DLLRNAME)" != ""
1081 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
1082 \
1083! ifndef BUILD_VERBOSE
1084 @ \
1085! endif
1086 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1087!endif
1088!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
1089 \
1090! ifndef BUILD_VERBOSE
1091 @ \
1092! endif
1093 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1094!endif
1095
1096
1097#
1098# Linker parameter file.
1099#
1100$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1101!ifndef TOOL_DEFCONV
1102 @$(TOOL_ECHO) Creating Linker Input File $(CLRRST)<<$@
1103$(LINK_LNK1)
1104$(LINK_LNK2)
1105$(LINK_LNK3)
1106$(LINK_LNK4)
1107$(LINK_LNK5)
1108<<KEEP
1109!else
1110 @$(ECHO) Creating Linker Input File $(CLRRST) $@
1111 @$(TOOL_RM) "$@"
1112 \
1113! ifdef BUILD_VERBOSE
1114 @ \
1115! endif
1116 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $@ <<$(TARGET_LNK)2
1117#
1118# LINK_LNK[1-5]:
1119#
1120$(LINK_LNK1)
1121$(LINK_LNK2)
1122$(LINK_LNK3)
1123$(LINK_LNK4)
1124$(LINK_LNK5)
1125<<keep
1126!endif
1127!ifdef BUILD_VERBOSE
1128 @type $@
1129!endif
1130
1131
1132#
1133# Builddef modified definition file.
1134#
1135!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1136$(TARGET_DEF_LINK): $(TARGET_DEF)
1137! ifndef BUILD_QUIET
1138 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1139! endif
1140 \
1141! ifndef BUILD_VERBOSE
1142 @ \
1143! endif
1144 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$** $** $@
1145!endif
1146
1147!endif
1148
1149
1150# -----------------------------------------------------------------------------
1151# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
1152# -----------------------------------------------------------------------------
1153!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
1154$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
1155!if "$(TOOL_JOB_WAIT)" != ""
1156! ifndef BUILD_QUIET
1157 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1158! endif
1159 \
1160! ifndef BUILD_VERBOSE
1161 @ \
1162! endif
1163 $(TOOL_JOB_WAIT)
1164!endif
1165 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
1166!ifndef BUILD_VERBOSE
1167 @$(TOOL_RM) "$@"
1168 @$(AR_CMD)
1169!else
1170 $(TOOL_RM) "$@"
1171 $(AR_CMD)
1172!endif
1173
1174
1175#
1176# Lib parameter file.
1177#
1178$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1179 @$(TOOL_ECHO) Creating Lib Input File $(CLRRST)<<$@
1180$(AR_LNK1)
1181$(AR_LNK2)
1182$(AR_LNK3)
1183$(AR_LNK4)
1184$(AR_LNK5)
1185<<KEEP
1186!ifdef BUILD_VERBOSE
1187 @type $@
1188!endif
1189!endif
1190
1191
1192# -----------------------------------------------------------------------------
1193# Copy rule for public targets.
1194# Normally used for public libraries, but may be used for other purposes...
1195# -----------------------------------------------------------------------------
1196!if "$(TARGET_PUBNAME)" != ""
1197$(TARGET_PUBNAME): $(TARGET)
1198 @$(ECHO) Copying $(CLRFIL)$(TARGET)$(CLRTXT) to $(CLRFIL)$(@D)$(CLRRST)
1199 \
1200!ifndef BUILD_VERBOSE
1201 @if not exist $(@D) $(ECHO) Target public path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1202!endif
1203 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1204 \
1205!ifndef BUILD_VERBOSE
1206 @ \
1207!endif
1208 $(TOOL_COPY) $** $@
1209 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(@R).sym
1210!endif
1211
1212
1213
1214# -----------------------------------------------------------------------------
1215# The $(TARGET) rule - For DEPEND targets.
1216# -----------------------------------------------------------------------------
1217!if "$(TARGET_MODE)" == "DEPEND"
1218$(TARGET):
1219 @$(ECHO) .
1220!endif
1221
1222
1223
1224# -----------------------------------------------------------------------------
1225# The $(TARGET_ILIB) rule - Make import library.
1226# -----------------------------------------------------------------------------
1227!ifdef TARGET_ILIB
1228$(TARGET_ILIB): $(TARGET_IDEF)
1229 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
1230 \
1231!ifndef BUILD_VERBOSE
1232 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1233!endif
1234 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1235 \
1236!ifndef BUILD_VERBOSE
1237 @ \
1238!endif
1239 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
1240!endif
1241
1242
1243
1244# -----------------------------------------------------------------------------
1245# The .force rule - Force a remake of something everytime.
1246# -----------------------------------------------------------------------------
1247.force:
1248!ifndef BUILD_VERBOSE
1249 @$(ECHO) .
1250!else
1251 @$(ECHO) . (force) .
1252!endif
1253
1254
1255
1256# -----------------------------------------------------------------------------
1257# Read Dependencies.
1258# -----------------------------------------------------------------------------
1259!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1260!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
1261
1262#
1263# Read dependency file for current directory
1264#
1265!ifndef MAKEVER
1266! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1267! ifdef BUILD_VERBOSE
1268! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1269! endif
1270! endif
1271! include $(TARGET_DEPEND)
1272! else
1273#! ifndef NODEP
1274#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1275#! endif
1276#! endif
1277! endif
1278!else
1279! if %exists($(TARGET_DEPEND)) != 0
1280! ifdef BUILD_VERBOSE
1281$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1282! endif
1283! include $(TARGET_DEPEND)
1284! else
1285#! ifndef NODEP
1286#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1287#! endif
1288! endif
1289!endif
1290
1291
1292#
1293# Read global dependency files.
1294#
1295!ifdef BUILD_DEPEND1
1296! ifndef MAKEVER
1297! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1298! ifdef BUILD_VERBOSE
1299! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1300! endif
1301! endif
1302! include $(BUILD_DEPEND1)
1303! else
1304! ifndef NODEP
1305! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
1306! endif
1307! endif
1308! endif
1309! else
1310! if %exists($(BUILD_DEPEND1)) != 0
1311! ifdef BUILD_VERBOSE
1312$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1313! endif
1314! include $(BUILD_DEPEND1)
1315! else
1316! ifndef NODEP
1317$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1318! endif
1319! endif
1320! endif
1321!endif
1322
1323
1324!ifdef BUILD_DEPEND2
1325! ifndef MAKEVER
1326! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1327! ifdef BUILD_VERBOSE
1328! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1329! endif
1330! endif
1331! include $(BUILD_DEPEND2)
1332! else
1333! ifndef NODEP
1334! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1335! endif
1336! endif
1337! endif
1338! else
1339! if %exists($(BUILD_DEPEND2)) != 0
1340! ifdef BUILD_VERBOSE
1341$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1342! endif
1343! include $(BUILD_DEPEND2)
1344! else
1345! ifndef NODEP
1346$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1347! endif
1348! endif
1349! endif
1350!endif
1351
1352
1353!ifdef BUILD_DEPEND3
1354! ifndef MAKEVER
1355! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1356! ifdef BUILD_VERBOSE
1357! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1358! endif
1359! endif
1360! include $(BUILD_DEPEND3)
1361! else
1362! ifndef NODEP
1363! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1364! endif
1365! endif
1366! endif
1367! else
1368! if %exists($(BUILD_DEPEND3)) != 0
1369! ifdef BUILD_VERBOSE
1370$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1371! endif
1372! include $(BUILD_DEPEND3)
1373! else
1374! ifndef NODEP
1375$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1376! endif
1377! endif
1378! endif
1379!endif
1380
1381
1382!endif
1383
1384
1385#
1386# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1387#
1388!if "$(BUILD_MULTIJOBS)" != ""
1389! if [$(TOOL_JOB_UP)] != 0
1390! if "$(BUILD_QUITE)" == ""
1391! ifndef MAKEVER
1392! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1393! endif
1394! else
1395$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
1396! endif
1397! endif
1398! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
1399! ifndef MAKEVER
1400! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1401! endif
1402! error
1403!else
1404! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1405!endif
1406! endif
1407! endif
1408!endif
1409
1410!endif #!TESTCASE
Note: See TracBrowser for help on using the repository browser.