source: trunk/make/process.mak@ 21687

Last change on this file since 21687 was 10493, checked in by bird, 22 years ago

InnoTek GCC.

File size: 54.1 KB
Line 
1# $Id: process.mak,v 1.40 2004-03-08 19:56:42 bird Exp $
2#
3# Generic Buildsystem
4#
5# The common build process rules
6#
7# Copyright (c) 2001-2002 knut st. osmundsen <bird@anduin.net>
8# Copyright (c) 2001 Patrick Haller
9#
10# This file is part of Generic Buildsystem.
11#
12
13
14# -----------------------------------------------------------------------------
15# Assertions.
16# This makefile expects setup.mak and the specific setup to be included
17# already.
18# It also requires the TARGET_NAME to be specified in the makefile.
19# -----------------------------------------------------------------------------
20!if "$(MAKE_SETUP_INCLUDED)" != "YES"
21! ifndef MAKEVER
22! if [$(ECHO) $(CLRERR)Fatal error: You must include setup.mak before process.mak in the makefile.$(CLRRST)]
23! endif
24! error
25!else
26! error $(CLRERR)Fatal error: You must include setup.mak before process.mak in the makefile.$(CLRRST)
27!endif
28!endif
29!if "$(ENV_STATUS)" != "OK"
30! ifndef MAKEVER
31! if [$(ECHO) $(CLRERR)Fatal error: The environment is not valid. Bad setup.mak?$(CLRRST)]
32! endif
33! error
34! else
35! error $(CLRERR)Fatal error: The environment is not valid. Bad setup.mak?$(CLRRST)
36! endif
37!endif
38
39!if "$(TARGET_NAME)" == "" && "$(TARGET_MODE)" != "EMPTY"
40! ifndef MAKEVER
41! if [$(ECHO) $(CLRERR)Fatal error: TARGET_NAME is not defined! Should be set in the makefile.$(CLRRST)]
42! endif
43! error
44! else
45! error $(CLRERR)Fatal error: TARGET_NAME is not defined! Should be set in the makefile.$(CLRRST)
46! endif
47!endif
48
49!ifdef TARGET_MODE
50# Executable target mode.
51! if "$(TARGET_MODE)" != "EXE"
52# Dynamic Load Library target mode.
53! if "$(TARGET_MODE)" != "DLL"
54# Drive (/ system software) target mode.
55! if "$(TARGET_MODE)" != "SYS"
56# Installable File System Drive target mode. (Also called FSD, File System Driver.)
57! if "$(TARGET_MODE)" != "IFS"
58# Virtual Device Driver target mode.
59! if "$(TARGET_MODE)" != "VDD"
60# Object Library target mode.
61! if "$(TARGET_MODE)" != "LIB"
62# Object Library target mode - Special variant which is to be linked with a SYS target.
63! if "$(TARGET_MODE)" != "SYSLIB"
64# Object Library target mode - Special variant which is to be linked with an IFS target.
65! if "$(TARGET_MODE)" != "IFSLIB"
66# Dummy/Hub/TopLevel empty makefile. This has no target.
67! if "$(TARGET_MODE)" != "EMPTY"
68# Dependency only makefile. (typical for include directories)
69! if "$(TARGET_MODE)" != "DEPEND"
70# Testcase makefile.
71! if "$(TARGET_MODE)" != "TESTCASE"
72# Bad TARGET_MODE complain.
73! ifndef MAKEVER
74! if [$(ECHO) $(CLRERR)Fatal Error: Bad TARGET_MODE="$(TARGET_MODE)". Valid ones are: EXE, DLL, SYS, IFS, VDD, LIB, SYSLIB, IFSLIB, DEPEND, TESTCASE and EMPTY.$(CLRRST)]
75! endif
76! error
77! else
78! error $(CLRERR)Fatal Error: Bad TARGET_MODE="$(TARGET_MODE)". Valid ones are: EXE, DLL, SYS, IFS, VDD, LIB, SYSLIB, IFSLIB, DEPEND, TESTCASE and EMPTY.$(CLRRST)
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!endif
92
93# stuff which has changed behavior.
94!if 1
95
96! ifdef TARGET_PUBNAME
97! if [$(ECHO) $(CLRERR)Fatal error: TARGET_PUBNAME isn't supported. The pubname stuff has changed!$(CLRRST)]
98! endif
99! error
100! endif
101
102! ifdef PATH_INCLUDE
103! if [$(ECHO) $(CLRERR)Fatal error: PATH_INCLUDE has changed name to PATH_INCLUDES!$(CLRRST)]
104! endif
105! error
106! endif
107
108!endif
109
110
111
112# -----------------------------------------------------------------------------
113# Provide overridable defaults
114# -----------------------------------------------------------------------------
115
116# Default target mode is executable.
117!ifndef TARGET_MODE
118! if "$(_BUILD_PROJECT)" != "Odin32"
119TARGET_MODE = EXE
120! else
121# Odin32 defaults.
122! ifndef CUSTOMBUILD
123TARGET_MODE = DLL
124! else
125TARGET_MODE = LIB
126! endif
127! endif
128!endif
129
130# Default extension corresponds to the target mode.
131!ifndef TARGET_EXT
132! if "$(TARGET_MODE)" == "DLL"
133TARGET_EXT = $(EXT_DLL)
134! endif
135! if "$(TARGET_MODE)" == "SYS"
136TARGET_EXT = $(EXT_SYS)
137! endif
138! if "$(TARGET_MODE)" == "IFS"
139TARGET_EXT = $(EXT_IFS)
140! endif
141! if "$(TARGET_MODE)" == "VDD"
142TARGET_EXT = $(EXT_VDD)
143! endif
144! if "$(TARGET_MODE)" == "EXE"
145TARGET_EXT = $(EXT_EXE)
146! endif
147! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
148TARGET_EXT = $(EXT_LIB)
149! endif
150! if "$(TARGET_MODE)" == "EMPTY"
151TARGET_EXT = empty
152! endif
153! if "$(TARGET_MODE)" == "DEPEND"
154TARGET_EXT = depend
155! endif
156! if "$(TARGET_MODE)" == "TESTCASE"
157TARGET_EXT = testcase
158! endif
159! ifndef TARGET_EXT
160! ifndef MAKEVER
161! if [$(ECHO) $(CLRERR)Internal Error: TARGET_EXT not set. Probably invalid TARGET_MODE. (TARGET_MODE="$(TARGET_MODE)")$(CLRRST)]
162! endif
163! error
164! else
165! error $(CLRERR)Internal Error: TARGET_EXT not set. Probably invalid TARGET_MODE. (TARGET_MODE="$(TARGET_MODE)")$(CLRRST)
166! endif
167! endif
168!endif
169
170# Default target path. (where all the generated stuff for this target goes)
171!ifndef PATH_TARGET
172!if "$(TARGET_SUB)" != ""
173PATH_TARGET = $(PATH_OBJ)\$(TARGET_SUB)\$(TARGET_NAME).$(TARGET_EXT)
174!else
175PATH_TARGET = $(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
176!endif
177!endif
178
179# Default target file. (output)
180!ifndef TARGET
181! if "$(TARGET_MODE)" != "EMPTY"
182! if "$(TARGET_MODE)" != "TESTCASE"
183TARGET = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
184! else
185TARGET = testcase
186! endif
187! endif
188!endif
189
190# Default target .sym file. (output)
191!ifndef TARGET_SYM
192TARGET_SYM = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_SYM)
193!endif
194
195# Default object file. (output)
196!ifndef TARGET_OBJS
197TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
198!endif
199
200# Default libraries. (input)
201!ifndef TARGET_LIBS
202TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
203!endif
204
205# Default definition file. (input)
206!ifndef TARGET_DEF
207TARGET_DEF = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
208!endif
209
210# Default modified definition filename. (output)
211!ifndef TARGET_DEF_LINK
212TARGET_DEF_LINK = $(PATH_TARGET)\$(TARGET_NAME)_link.def
213!endif
214
215# Default definition file for generating the import library. (input)
216!ifndef TARGET_IDEF
217! if "$(_BUILD_PROJECT)" != "Odin32"
218TARGET_IDEF = $(TARGET_DEF)
219! else
220! if defined(TARGET_IDEF_CONV) || "$(TARGET_IDEF_ORG)" != ""
221TARGET_IDEF = $(PATH_TARGET)\$(TARGET_NAME)_implib.def
222! ifndef TARGET_IDEF_ORG
223TARGET_IDEF_ORG = $(TARGET_DEF)
224! endif
225! else
226TARGET_IDEF = $(TARGET_DEF)
227TARGET_IDEF_ORG = $(TARGET_DEF)
228! endif
229! endif
230
231!endif
232
233# Default map file. (output)
234!ifndef TARGET_MAP
235TARGET_MAP = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_MAP)
236!endif
237
238# Default link file. (output)
239!ifndef TARGET_LNK
240TARGET_LNK = $(PATH_TARGET)\$(TARGET_NAME).lnk
241!endif
242
243# Default import library file. (output)
244!ifndef TARGET_ILIB
245! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_ILIB_YES)" != ""
246TARGET_ILIB = $(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
247! endif
248!endif
249
250# Default public base directory. (publish)
251!ifndef TARGET_PUB_BASE
252! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
253TARGET_PUB_BASE = $(PATH_LIB)
254! else
255TARGET_PUB_BASE = $(PATH_PUB)
256!endif
257!endif
258
259# Default public base directory for unstripped release version.
260!ifndef TARGET_PUB_BASE_DEB
261! if "$(BUILD_MODE)" == "RELEASE" && "$(TARGET_MODE:LIB=...)" == "$(TARGET_MODE)"
262! if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
263TARGET_PUB_BASE_DEB = $(PATH_PUB_DEB)
264! endif
265! endif
266!endif
267
268# Default sub directory.
269!ifndef TARGET_PUB_SUB
270! if "$(TARGET_SUB)" != ""
271TARGET_PUB_SUB = $(TARGET_SUB)
272! else
273! if "$(TARGET_MODE)" == "EXE"
274TARGET_PUB_SUB = $(PATH_SUB_BIN)
275! endif
276! if "$(TARGET_MODE)" == "DLL"
277TARGET_PUB_SUB = $(PATH_SUB_DLL)
278! endif
279! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
280TARGET_PUB_SUB = .
281! endif
282! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
283TARGET_PUB_SUB = $(PATH_SUB_SYS)
284! endif
285! if "$(TARGET_MODE)" == "VDD"
286TARGET_PUB_SUB = $(PATH_SUB_VDD)
287! endif
288! endif
289!endif
290
291# Default public directory.
292!ifndef TARGET_PUB_DIR
293TARGET_PUB_DIR = $(TARGET_PUB_BASE)\$(TARGET_PUB_SUB)
294!endif
295
296# Default unstripped public directory.
297!if !defined(TARGET_PUB_DIR_DEB) && "$(TARGET_PUB_BASE_DEB)" != ""
298TARGET_PUB_DIR_DEB = $(TARGET_PUB_BASE_DEB)\$(TARGET_PUB_SUB)
299!endif
300
301# Default public name.
302!ifndef TARGET_PUB_NAME
303TARGET_PUB_NAME = $(TARGET_NAME)
304!endif
305
306# Default public ext.
307!ifndef TARGET_PUB_EXT
308TARGET_PUB_EXT = $(TARGET_EXT)
309!endif
310
311# Default public full name.
312!ifndef TARGET_PUB
313TARGET_PUB = $(TARGET_PUB_DIR)\$(TARGET_PUB_NAME).$(TARGET_PUB_EXT)
314!endif
315
316# Default public full name of unstripped version.
317!if !defined(TARGET_PUB_DEB) && "$(TARGET_PUB_DIR_DEB)" != ""
318TARGET_PUB_DEB = $(TARGET_PUB_DIR_DEB)\$(TARGET_PUB_NAME).$(TARGET_PUB_EXT)
319!endif
320
321# Target publish no.2
322
323!if defined(TARGET_PUB2_BASE) || defined(TARGET_PUB2_BASE_DEB) || defined(TARGET_PUB2_SUB) \
324 || defined(TARGET_PUB2_DIR) || defined(TARGET_PUB2_DIR_DEB) || defined(TARGET_PUB2_NAME) \
325 || defined(TARGET_PUB2_EXT) || defined(TARGET_PUB2)
326
327# Default public base directory. (publish)
328! ifndef TARGET_PUB2_BASE
329! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
330TARGET_PUB2_BASE = $(PATH_LIB)
331! else
332TARGET_PUB2_BASE = $(PATH_PUB)
333! endif
334! endif
335
336# Default public base directory for unstripped release version.
337! ifndef TARGET_PUB2_BASE_DEB
338! if "$(BUILD_MODE)" == "RELEASE" && "$(TARGET_MODE:LIB=...)" == "$(TARGET_MODE)"
339! if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
340TARGET_PUB2_BASE_DEB = $(PATH_PUB2_DEB)
341! endif
342! endif
343! endif
344
345# Default sub directory.
346! ifndef TARGET_PUB2_SUB
347! if "$(TARGET_SUB)" ! = ""
348TARGET_PUB2_SUB = $(TARGET_SUB)
349! else
350! if "$(TARGET_MODE)" == "EXE"
351TARGET_PUB2_SUB = $(PATH_SUB_BIN)
352! endif
353! if "$(TARGET_MODE)" == "DLL"
354TARGET_PUB2_SUB = $(PATH_SUB_DLL)
355! endif
356! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
357TARGET_PUB2_SUB = .
358! endif
359! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
360TARGET_PUB2_SUB = $(PATH_SUB_SYS)
361! endif
362! if "$(TARGET_MODE)" == "VDD"
363TARGET_PUB2_SUB = $(PATH_SUB_VDD)
364! endif
365! endif
366! endif
367
368# Default public directory.
369! ifndef TARGET_PUB2_DIR
370TARGET_PUB2_DIR = $(TARGET_PUB2_BASE)\$(TARGET_PUB2_SUB)
371! endif
372
373# Default unstripped public directory.
374! if ! defined(TARGET_PUB2_DIR_DEB) && "$(TARGET_PUB2_BASE_DEB)" != ""
375TARGET_PUB2_DIR_DEB = $(TARGET_PUB2_BASE_DEB)\$(TARGET_PUB2_SUB)
376! endif
377
378# Default public name.
379! ifndef TARGET_PUB2_NAME
380TARGET_PUB2_NAME = $(TARGET_NAME)
381! endif
382
383# Default public ext.
384! ifndef TARGET_PUB2_EXT
385TARGET_PUB2_EXT = $(TARGET_EXT)
386! endif
387
388# Default public full name.
389! ifndef TARGET_PUB2
390TARGET_PUB2 = $(TARGET_PUB2_DIR)\$(TARGET_PUB2_NAME).$(TARGET_PUB2_EXT)
391! endif
392
393# Default public full name of unstripped version.
394! if !defined(TARGET_PUB2_DEB) && "$(TARGET_PUB2_DIR_DEB)" != ""
395TARGET_PUB2_DEB = $(TARGET_PUB2_DIR_DEB)\$(TARGET_PUB2_NAME).$(TARGET_PUB2_EXT)
396! endif
397
398!endif # pub2
399
400# Default public book dirs
401!ifndef TARGET_BOOK_PUB_BASE
402TARGET_BOOK_PUB_BASE = $(PATH_PUB)
403!endif
404!ifndef TARGET_BOOK_PUB_SUB
405TARGET_BOOK_PUB_SUB = $(PATH_SUB_BOOK)
406!endif
407!ifndef TARGET_BOOK_PUB_DIR
408TARGET_BOOK_PUB_DIR = $(TARGET_BOOK_PUB_BASE)\$(TARGET_BOOK_PUB_SUB)
409!endif
410
411# Default public help dirs
412!ifndef TARGET_HELP_PUB_BASE
413TARGET_HELP_PUB_BASE = $(PATH_PUB)
414!endif
415!ifndef TARGET_HELP_PUB_SUB
416TARGET_HELP_PUB_SUB = $(PATH_SUB_HELP)
417!endif
418!ifndef TARGET_HELP_PUB_DIR
419TARGET_HELP_PUB_DIR = $(TARGET_HELP_PUB_BASE)\$(TARGET_HELP_PUB_SUB)
420!endif
421
422# Default public docs dirs
423!ifndef TARGET_DOC_PUB_BASE
424TARGET_DOC_PUB_BASE = $(PATH_PUB)
425!endif
426!ifndef TARGET_DOC_PUB_SUB
427TARGET_DOC_PUB_SUB = $(PATH_SUB_DOC)
428!endif
429!ifndef TARGET_DOC_PUB_DIR
430TARGET_DOC_PUB_DIR = $(TARGET_DOC_PUB_BASE)\$(TARGET_DOC_PUB_SUB)
431!endif
432
433# Default depend filename.
434!ifndef TARGET_DEPEND
435TARGET_DEPEND = $(PATH_TARGET)\.depend
436!endif
437
438# Default makefile names.
439!ifndef BUILD_MAKEFILE
440BUILD_MAKEFILE = Makefile
441!endif
442
443# Default makefile name.
444!ifndef MAKEFILE
445MAKEFILE = $(BUILD_MAKEFILE)
446!endif
447
448# Ignore linker warnings for some target modes.
449!ifndef TARGET_IGNORE_LINKER_WARNINGS
450! if "$(TARGET_MODE)" == "DLL"
451TARGET_IGNORE_LINKER_WARNINGS = 1
452! else
453TARGET_IGNORE_LINKER_WARNINGS = 0
454! endif
455!endif
456
457
458# Default stacksize
459# If 16bit: 8KB
460# Else (32bit): 64KB
461!ifndef TARGET_STACKSIZE
462! ifdef ENV_16BIT
463TARGET_STACKSIZE=0x2000
464! else
465TARGET_STACKSIZE=0x10000
466! endif
467!endif
468
469
470
471# -----------------------------------------------------------------------------
472# Internal helper macros - don't mess!
473# -----------------------------------------------------------------------------
474
475# Helper for doing early publish of a target.
476!if defined(TARGET_NEEDED) || defined(TARGET_PUBLIC)
477_TARGET_EARLY_PUBLISH = publish_target
478!else
479_TARGET_EARLY_PUBLISH =
480!endif
481
482# The unstripped release name (internal!)
483_TARGET_DEB = $(TARGET).unstripped
484
485
486
487# -----------------------------------------------------------------------------
488# Tell user what we're building.
489# -----------------------------------------------------------------------------
490!ifndef BUILD_QUIET
491! if "$(TARGET)" != ""
492! ifndef MAKEVER
493! if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
494! endif
495! else
496$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)
497! endif
498! endif
499!endif
500
501
502# -----------------------------------------------------------------------------
503# Ensure the platform-specific target path exists
504# -----------------------------------------------------------------------------
505
506!if "$(TARGET_MODE)" != "EMPTY"
507! if "$(PATH_TARGET)" != ""
508! ifndef MAKEVER
509! if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
510! ifndef BUILD_QUIET
511! if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
512! endif
513! endif
514! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
515! if [$(ECHO) $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)]
516! endif
517! error
518! endif
519! endif
520! else
521! if %exist($(PATH_TARGET)) == 0
522! ifndef BUILD_QUIET
523$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
524! endif
525! else
526! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
527! error $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)
528! endif
529! endif
530! endif
531! endif
532!endif
533# not 100% sure about the != EMPTY stuff, but this is way faster.
534
535
536# -----------------------------------------------------------------------------
537# Make all targets 'unprecious'. (works only on nmake5)
538# -----------------------------------------------------------------------------
539.PRECIOUS: .force
540
541
542# -----------------------------------------------------------------------------
543# Common inference rules
544# -----------------------------------------------------------------------------
545.SUFFIXES:
546.SUFFIXES: .c .cpp .orc .asm .$(EXT_OBJ) .$(EXT_RES) .rc .ii .s .ipp .ipf .$(EXT_INF) .$(EXT_HLP)
547
548#
549# A workaround for SlickEdits inability to find the buggy files..
550# This makes the source filenames in the error listing have full path.
551# See setup.mak for compile command line.
552#
553#_SRC = $<
554#!ifdef SLKRUNS
555_SRC = $(PATH_CURRENT)\$(<F)
556#!endif
557_DST = $(PATH_TARGET)\$(@F)
558
559
560# Assembling assembly source.
561.asm{$(PATH_TARGET)}.$(EXT_OBJ):
562 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
563 \
564! ifndef BUILD_VERBOSE
565 @ \
566! endif
567!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
568! ifdef AS_CMD_SYS
569 $(TOOL_JOB_SUB) $(AS_CMD_SYS)
570! else
571 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
572! endif
573!else
574! ifdef AS_CMD
575 $(TOOL_JOB_SUB) $(AS_CMD)
576! else
577 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
578! endif
579!endif
580
581.asm.$(EXT_OBJ):
582 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRRST)
583 \
584!ifndef BUILD_VERBOSE
585 @ \
586!endif
587!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
588! ifdef AS_CMD_SYS
589 $(AS_CMD_SYS)
590! else
591 $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
592! endif
593!else
594! ifdef AS_CMD
595 $(AS_CMD)
596! else
597 $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
598! endif
599!endif
600
601# C++ Compiler base line
602_CXX_BASELINE = $(CXX) \
603!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
604 $(CXX_FLAGS_EXE) \
605!endif
606!if "$(TARGET_MODE)" == "DLL"
607 $(CXX_FLAGS_DLL) \
608!endif
609!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
610 $(CXX_FLAGS_SYS) \
611!endif
612!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
613 $(CXX_FLAGS_IFS) \
614!endif
615
616# Compiling C++ source.
617.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
618 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
619 \
620!ifndef BUILD_VERBOSE
621 @ \
622!endif
623 $(TOOL_JOB_SUB) $(_CXX_BASELINE) \
624!if "$(CXX_LST_OUT)" != ""
625 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
626!endif
627 $(CXX_OBJ_OUT)$(_DST) $(_SRC)
628
629.cpp.$(EXT_OBJ):
630 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
631 \
632!ifndef BUILD_VERBOSE
633 @ \
634!endif
635 $(_CXX_BASELINE) \
636!if "$(CXX_LST_OUT)" != ""
637 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
638!endif
639 $(CXX_OBJ_OUT)$(_DST) $(_SRC)
640
641
642# Pre-Compiling C++ source.
643.cpp.ii:
644 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
645 \
646!ifndef BUILD_VERBOSE
647 @ \
648!endif
649 $(_CXX_BASELINE) \
650 $(CXX_PC_2_STDOUT) $(_SRC) > $@
651
652
653# Compiler C++ source to assembly.
654!if "$(CXX_AS_2_FILE)" != ""
655.cpp.s:
656 @$(ECHO) C++ To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
657 \
658!ifndef BUILD_VERBOSE
659 @ \
660!endif
661 $(_CXX_BASELINE) \
662 $(CXX_AS_2_FILE)$@ $(_SRC)
663!endif
664
665
666
667# C Compiler base line
668_CC_BASELINE = $(CC) \
669!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
670 $(CC_FLAGS_EXE) \
671!endif
672!if "$(TARGET_MODE)" == "DLL"
673 $(CC_FLAGS_DLL) \
674!endif
675!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
676 $(CC_FLAGS_SYS) \
677!endif
678!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
679 $(CC_FLAGS_IFS) \
680!endif
681!if "$(TARGET_MODE)" == "VDD"
682 $(CC_FLAGS_VDD) \
683!endif
684
685# Compiling C source.
686.c{$(PATH_TARGET)}.$(EXT_OBJ):
687 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
688 \
689!ifndef BUILD_VERBOSE
690 @ \
691!endif
692 $(TOOL_JOB_SUB) $(_CC_BASELINE) \
693!if "$(CC_LST_OUT)" != ""
694 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
695!endif
696 $(CC_OBJ_OUT)$(_DST) $(_SRC)
697
698.c.$(EXT_OBJ):
699 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRRST)
700 \
701!ifndef BUILD_VERBOSE
702 @ \
703!endif
704 $(_CC_BASELINE) \
705!if "$(CC_LST_OUT)" != ""
706 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
707!endif
708 $(CC_OBJ_OUT)$(_DST) $(_SRC)
709
710
711# Pre-Compiling C source.
712.c.ii:
713 @$(ECHO) C PreCompiler $(CLRFIL)$(_SRC) $(CLRRST)
714 \
715!ifndef BUILD_VERBOSE
716 @ \
717!endif
718 $(_CC_BASELINE) \
719 $(CC_PC_2_STDOUT) $(_SRC) > $@
720
721
722# Compiler C source to assembly.
723!if "$(CC_AS_2_FILE)" != ""
724.c.s:
725 @$(ECHO) C To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
726 \
727!ifndef BUILD_VERBOSE
728 @ \
729!endif
730 $(_CC_BASELINE) \
731 $(CC_AS_2_FILE)$@ $(_SRC)
732!endif
733
734
735# Compiling resources.
736.rc{$(PATH_TARGET)}.res:
737 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
738 \
739!ifndef BUILD_VERBOSE
740 @ \
741!endif
742 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $(_SRC) $(RC_RES_OUT)$(_DST)
743
744.rc.res:
745 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
746 \
747!ifndef BUILD_VERBOSE
748 @ \
749!endif
750 $(RC) $(RC_FLAGS) $(_SRC) $(RC_RES_OUT)$(_DST)
751
752
753# Compiling Odin32 resources.
754.orc{$(PATH_TARGET)}.obj:
755 @$(ECHO) ORC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
756 \
757!ifndef BUILD_VERBOSE
758 @ \
759!endif
760 $(ORC) $(ORC_FLAGS) $(ORC_ASM_OUT)$(PATH_TARGET)\$(@B).asm $(_SRC)
761 \
762!ifndef BUILD_VERBOSE
763 @ \
764!endif
765 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(_DST)
766
767.orc.obj:
768 @$(ECHO) ORC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
769 \
770!ifndef BUILD_VERBOSE
771 @ \
772!endif
773 $(ORC) $(ORC_FLAGS) $(ORC_ASM_OUT)$(PATH_TARGET)\$(@B).asm $(_SRC)
774 \
775!ifndef BUILD_VERBOSE
776 @ \
777!endif
778 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(_DST)
779
780
781# Compiling INFs.
782.ipf{$(PATH_TARGET)}.$(EXT_INF):
783 @$(ECHO) BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
784 \
785!ifndef BUILD_VERBOSE
786 @ \
787!endif
788 $(INFC_CMD)
789
790.ipf.inf:
791 @$(ECHO) BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
792 \
793!ifndef BUILD_VERBOSE
794 @ \
795!endif
796 $(INFC_CMD)
797
798
799# Compiling INFs with pre-compiling
800.ipp{$(PATH_TARGET)}.$(EXT_INF):
801 @$(ECHO) CC Pre + BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
802!ifndef CC_PC_2_STRIPPED_STDOUT
803 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
804!endif
805 \
806!ifndef BUILD_VERBOSE
807 @ \
808!endif
809 $(INFC_CMD_PRE)
810
811.ipp.inf:
812 @$(ECHO) CC Pre + BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
813!ifndef CC_PC_2_STRIPPED_STDOUT
814 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
815!endif
816 \
817!ifndef BUILD_VERBOSE
818 @ \
819!endif
820 $(INFC_CMD_PRE)
821
822
823# Compiling HLPs
824.ipf{$(PATH_TARGET)}.$(EXT_HLP):
825 @$(ECHO) HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
826 \
827!ifndef BUILD_VERBOSE
828 @ \
829!endif
830 $(HLPC_CMD)
831
832.ipf.hlp:
833 @$(ECHO) HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
834 \
835!ifndef BUILD_VERBOSE
836 @ \
837!endif
838 $(HLPC_CMD)
839
840
841# Compiling HLPs with pre-compiling
842.ipp{$(PATH_TARGET)}.$(EXT_HLP):
843 @$(ECHO) CC Pre + HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
844!ifndef CC_PC_2_STRIPPED_STDOUT
845 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
846!endif
847 \
848!ifndef BUILD_VERBOSE
849 @ \
850!endif
851 $(HLPC_CMD_PRE)
852
853.ipp.hlp:
854 @$(ECHO) CC Pre + HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
855!ifndef CC_PC_2_STRIPPED_STDOUT
856 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
857!endif
858 \
859!ifndef BUILD_VERBOSE
860 @ \
861!endif
862 $(HLPC_CMD_PRE)
863
864
865
866# -----------------------------------------------------------------------------
867# The all rule - The default one, as it's the first rule in the file.
868# -----------------------------------------------------------------------------
869all: build
870
871
872
873# -----------------------------------------------------------------------------
874# The build rule - This runs all passes:
875# 1. Make Dependencies
876# 2. Make Needed Tools (stuff required in the next steps)
877# 3. Make Libraries (all kinds)
878# 4. Make Binaries (ie. executable files)
879# 5. Make Miscellaneous Targets
880# 6. Make Install
881# Note: In order to load dependencies we'll do a forwarding after making them.
882# -----------------------------------------------------------------------------
883build: _build
884!if "$(MAKEFLAGS:I=_)" == "$(MAKEFLAGS)" # this is of course broken in nmake v5.0 for OS/2.
885 @$(ECHO)$(CLRMAK)[Successfully Built Everything!] $(CLRRST)
886!else
887 @$(ECHO)$(CLRMAK)[Built Everything! (Ignore option specified)] $(CLRRST)
888!endif
889
890# internal rule shared by rebuild and build.
891_build: _build_banner_dep dep
892!ifndef BUILD_QUIET
893 @$(ECHO) Restarting $(CLRFIL)$(MAKEFILE)$(CLRTXT) with new dependencies. $(CLRRST)
894!endif
895 \
896!ifndef BUILD_VERBOSE
897 @ \
898!endif
899 $(TOOL_MAKE) -f $(MAKEFILE) _build_new_dependencies_
900
901# internal rule used to reload dependencies.
902_build_new_dependencies_: \
903 _build_banner_needed needed \
904 _build_banner_lib lib \
905 _build_banner_binary binary \
906 _build_banner_misc misc \
907 _build_banner_publish publish
908
909
910# Banners for rebuild and build.
911_build_banner_clean:
912 @$(ECHO)$(CLRMAK)[Start Pass 0 - Make Clean] $(CLRRST)
913 @SET _BUILD_PASS=0
914_build_banner_dep:
915 @$(ECHO)$(CLRMAK)[Start Pass 1 - Make Dependencies] $(CLRRST)
916 @SET _BUILD_PASS=1
917_build_banner_needed:
918 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
919 @SET _BUILD_PASS=2
920_build_banner_lib:
921 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
922 @SET _BUILD_PASS=3
923_build_banner_binary:
924 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Binaries] $(CLRRST)
925 @SET _BUILD_PASS=4
926_build_banner_misc:
927 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
928 @SET _BUILD_PASS=5
929_build_banner_publish:
930 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Public (i.e. Publish)] $(CLRRST)
931 @SET _BUILD_PASS=6
932
933
934
935# -----------------------------------------------------------------------------
936# The rebuild rule - Same as build but does a clean first (as Pass 0).
937# -----------------------------------------------------------------------------
938rebuild: \
939 _build_banner_clean clean \
940 _build
941!if "$(MAKEFLAGS:i=_)" == "$(MAKEFLAGS)"
942 @$(ECHO)$(CLRMAK)[Successfully Rebuilt Everything!] $(CLRRST)
943!else
944 @$(ECHO)$(CLRMAK)[Rebuilt Everything! (Ignore option specified)] $(CLRRST)
945!endif
946
947
948
949# -----------------------------------------------------------------------------
950# A number of shortcuts for lazy programmers.
951# -----------------------------------------------------------------------------
952pass1: build
953
954pass2: _build_new_dependencies_
955
956pass3: _build_banner_lib lib \
957 _build_banner_binary binary \
958 _build_banner_misc misc \
959 _build_banner_publish publish
960
961pass4: _build_banner_binary binary \
962 _build_banner_misc misc \
963 _build_banner_publish publish
964
965pass5: _build_banner_misc misc \
966 _build_banner_publish publish
967
968pass6: _build_banner_publish publish
969
970quick: _build_banner_lib lib \
971 _build_banner_binary binary \
972 _build_banner_publish publish
973
974
975
976# -----------------------------------------------------------------------------
977# Pass 0 - The clean rule - Clean up output files.
978# The current setup doesn't clean the published ones.
979# -----------------------------------------------------------------------------
980!if "$(TARGET_MODE)" != "TESTCASE"
981clean:
982 @$(ECHO) Cleaning... $(CLRRST)
983 \
984! ifndef BUILD_VERBOSE
985 @ \
986! endif
987 $(TOOL_RM) @<<
988"$(PATH_TARGET)\*.$(EXT_OBJ)"
989"$(PATH_TARGET)\*.$(EXT_ILIB)"
990"$(PATH_TARGET)\*.$(EXT_EXE)"
991"$(PATH_TARGET)\*.$(EXT_DLL)"
992"$(PATH_TARGET)\*.$(EXT_RES)"
993"$(PATH_TARGET)\*.$(EXT_SYS)"
994"$(PATH_TARGET)\*.$(EXT_LIB)"
995"$(PATH_TARGET)\*.$(EXT_IFS)"
996"$(PATH_TARGET)\*.$(EXT_MAP)"
997"$(PATH_TARGET)\*.$(EXT_SYM)"
998"$(PATH_TARGET)\*.$(EXT_DEF)"
999"$(PATH_TARGET)\*.s"
1000"$(PATH_TARGET)\*.lst"
1001"$(PATH_TARGET)\*.lnk"
1002"$(PATH_TARGET)\*.ii"
1003"$(PATH_TARGET)\.depend"
1004"$(TARGET_DEPEND)"
1005.\*.ii
1006.\*.err
1007.\.depend
1008<<
1009!ifdef SUBDIRS_CLEAN
1010 @$(TOOL_DODIRS) "$(SUBDIRS_CLEAN)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1011!else
1012! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_BINARY)$(SUBDIRS_MISC)" != ""
1013 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_BINARY) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1014! endif
1015!endif
1016!ifdef PREMAKEFILES_CLEAN
1017 @$(TOOL_DOMAKES) "$(PREMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
1018!else
1019! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_BINARY)$(PREMAKEFILES_MISC)" != ""
1020 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_BINARY) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1021! endif
1022!endif
1023!ifdef POSTMAKEFILES_CLEAN
1024 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
1025!else
1026! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_BINARY)$(POSTMAKEFILES_MISC)" != ""
1027 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_BINARY) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1028! endif
1029!endif
1030
1031!endif #!TESTCASE
1032
1033
1034
1035# -----------------------------------------------------------------------------
1036# Pass 1 - The dep rule - Make dependencies.
1037# -----------------------------------------------------------------------------
1038dep:
1039!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
1040 @$(ECHO) Making dependencies... $(CLRRST)
1041 \
1042! ifndef BUILD_VERBOSE
1043 @ \
1044! endif
1045 $(TOOL_DEP) \
1046! ifdef TARGET_NO_DEP
1047 -x$(TARGET_NO_DEP: =;)\
1048! endif
1049 @<<$(TARGET_DEPEND).rsp
1050$(TOOL_DEP_FLAGS)
1051-o$$(PATH_TARGET)
1052-d$(TARGET_DEPEND)
1053-srcadd AS:$$(MAKE_INCLUDE_AS_SETUP)
1054-srcadd AS:$$(MAKE_INCLUDE_AS_OPT)
1055-srcadd RC:$$(MAKE_INCLUDE_RC_SETUP)
1056-srcadd ORC:$$(MAKE_INCLUDE_ORC_SETUP)
1057-srcadd CX:$$(MAKE_INCLUDE_SETUP)
1058-srcadd CX:$$(MAKE_INCLUDE_CX_OPT)
1059-srcadd IPF:$$(MAKE_INCLUDE_IPFC)
1060-srcadd IPP:$$(MAKE_INCLUDE_IPFC)
1061-srcadd IPP:$$(MAKE_INCLUDE_SETUP)
1062-srcadd IPP:$$(MAKE_INCLUDE_CX_OPT)
1063$(TOOL_DEP_FILES)
1064<<KEEP
1065!ifdef BUILD_VERBOSE
1066 @type $(TARGET_DEPEND).rsp
1067!endif
1068!ifdef BUILD_VERBOSE2
1069 $(ECHO) Dependcy file: $(CLRRST)
1070 @type $(TARGET_DEPEND)
1071!endif
1072!endif
1073!ifdef SUBDIRS_DEP
1074 @$(TOOL_DODIRS) "$(SUBDIRS_DEP)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1075!else
1076! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_BINARY)$(SUBDIRS_MISC)" != ""
1077 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_BINARY) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1078! endif
1079!endif
1080!ifdef PREMAKEFILES_DEP
1081 @$(TOOL_DOMAKES) "$(PREMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
1082!else
1083! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_BINARY)$(PREMAKEFILES_MISC)" != ""
1084 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_BINARY) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1085! endif
1086!endif
1087!ifdef POSTMAKEFILES_DEP
1088 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
1089!else
1090! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_BINARY)$(POSTMAKEFILES_MISC)" != ""
1091 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_BINARY) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1092! endif
1093!endif
1094
1095
1096
1097# -----------------------------------------------------------------------------
1098# Pass 2 - The needed rule - Make need tools.
1099# That is tools and stuff that is required for the next passes.
1100# WARNING! These tools and stuff shouldn't rely on libraries and other
1101# results of later passes.
1102# -----------------------------------------------------------------------------
1103!ifdef SUBDIRS_NEEDED
1104_SUBDIRS_NEEDED = _subdir_needed
1105$(_SUBDIRS_NEEDED):
1106 @$(TOOL_DODIRS) "$(SUBDIRS_NEEDED)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
1107!else
1108! ifdef SUBDIRS
1109_SUBDIRS_NEEDED = _subdir_needed
1110$(_SUBDIRS_NEEDED):
1111 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
1112! endif
1113!endif
1114
1115!ifdef PREMAKEFILES_NEEDED
1116_PREMAKEFILES_NEEDED = _premakefiles_needed
1117$(_PREMAKEFILES_NEEDED):
1118 @$(TOOL_DOMAKES) "$(PREMAKEFILES_NEEDED)" $(TOOL_MAKE) needed
1119!else
1120! ifdef PREMAKEFILES
1121_PREMAKEFILES_NEEDED = _premakefiles_needed
1122$(_PREMAKEFILES_NEEDED):
1123 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) needed
1124! endif
1125!endif
1126
1127!ifdef TARGET_NEEDED
1128needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED) target
1129!else
1130needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED)
1131!endif
1132!ifdef POSTMAKEFILES_NEEDED
1133 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_NEEDED)" $(TOOL_MAKE) $@
1134!else
1135! ifdef POSTMAKEFILES
1136 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1137! endif
1138!endif
1139
1140
1141
1142# -----------------------------------------------------------------------------
1143# Pass 3 - The lib rule - Make libraries.
1144# -----------------------------------------------------------------------------
1145!ifdef SUBDIRS_LIB
1146_SUBDIRS_LIB = _subdir_lib
1147$(_SUBDIRS_LIB):
1148 @$(TOOL_DODIRS) "$(SUBDIRS_LIB)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
1149!else
1150! ifdef SUBDIRS
1151_SUBDIRS_LIB = _subdir_lib
1152$(_SUBDIRS_LIB):
1153 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
1154! endif
1155!endif
1156
1157!ifdef PREMAKEFILES_LIB
1158_PREMAKEFILES_LIB = _premakefiles_lib
1159$(_PREMAKEFILES_LIB):
1160 @$(TOOL_DOMAKES) "$(PREMAKEFILES_LIB)" $(TOOL_MAKE) lib
1161!else
1162! ifdef PREMAKEFILES
1163_PREMAKEFILES_LIB = _premakefiles_lib
1164$(_PREMAKEFILES_LIB):
1165 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
1166! endif
1167!endif
1168
1169lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
1170!if !defined(TARGET_NEEDED) && ("$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB")
1171 $(TARGET) $(_TARGET_EARLY_PUBLISH) \
1172!endif
1173 $(TARGET_ILIB)
1174!ifdef POSTMAKEFILES_LIB
1175 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
1176!else
1177! ifdef POSTMAKEFILES
1178 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1179! endif
1180!endif
1181
1182
1183
1184# -----------------------------------------------------------------------------
1185# Pass 4 - The binary rule - Build the binary.
1186# -----------------------------------------------------------------------------
1187!ifdef SUBDIRS_BINARY
1188_SUBDIRS_BINARY = _subdir_binary
1189$(_SUBDIRS_BINARY):
1190 @$(TOOL_DODIRS) "$(SUBDIRS_BINARY)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) binary
1191!else
1192! ifdef SUBDIRS
1193_SUBDIRS_BINARY = _subdir_binary
1194$(_SUBDIRS_BINARY):
1195 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) binary
1196! endif
1197!endif
1198
1199!ifdef PREMAKEFILES_BINARY
1200_PREMAKEFILES_BINARY = _premakefiles_binary
1201$(_PREMAKEFILES_BINARY):
1202 @$(TOOL_DOMAKES) "$(PREMAKEFILES_BINARY)" $(TOOL_MAKE) binary
1203!else
1204! ifdef PREMAKEFILES
1205_PREMAKEFILES_BINARY = _premakefiles_binary
1206$(_PREMAKEFILES_BINARY):
1207 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) binary
1208! endif
1209!endif
1210
1211binary executable: \
1212!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && !defined(TARGET_NEEDED)
1213 $(_SUBDIRS_BINARY) $(_PREMAKEFILES_BINARY) $(TARGET) $(_TARGET_EARLY_PUBLISH) $(OTHERS)
1214!else
1215 $(_SUBDIRS_BINARY) $(_PREMAKEFILES_BINARY)
1216!endif
1217!ifdef POSTMAKEFILES_BINARY
1218 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_BINARY)" $(TOOL_MAKE) $@
1219!else
1220! ifdef POSTMAKEFILES
1221 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1222! endif
1223!endif
1224
1225
1226
1227# -----------------------------------------------------------------------------
1228# Pass 5 - The misc(ellaneous) rule - Makes miscellaneous stuff like
1229# help, documentations etc. This is experimental for the moment.
1230# -----------------------------------------------------------------------------
1231!ifdef SUBDIRS_MISC
1232_SUBDIRS_MISC = _subdir_misc
1233$(_SUBDIRS_MISC):
1234 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) misc
1235!else
1236! ifdef SUBDIRS
1237_SUBDIRS_MISC = _subdir_misc
1238$(_SUBDIRS_MISC):
1239 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) misc
1240! endif
1241!endif
1242
1243!ifdef PREMAKEFILES_MISC
1244_PREMAKEFILES_MISC = _premakefiles_misc
1245$(PREMAKEFILES_MISC):
1246 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) misc
1247!else
1248! ifdef PREMAKEFILES
1249_PREMAKEFILES_MISC = _premakefiles_misc
1250$(_PREMAKEFILES_MISC):
1251 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) misc
1252! endif
1253!endif
1254
1255misc miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
1256 $(TARGET_BOOKS) $(TARGET_HELPS) $(TARGET_DOCS) $(TARGET_MISC)
1257!if "$(TARGET_BOOKS)$(TARGET_HELPS)$(TARGET_DOCS)$(TARGET_MISC)" != ""
1258 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_BOOKS) $(TARGET_HELPS) $(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
1259!endif
1260!ifdef POSTMAKEFILES_MISC
1261 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
1262!else
1263! ifdef POSTMAKEFILES
1264 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1265! endif
1266!endif
1267
1268
1269
1270# -----------------------------------------------------------------------------
1271# Pass 6 - The publish rule - Copies target to main binary directory.
1272# Installation order is not concidered vital, so subdirectories and
1273# pre-makefiles are processed after this directory.
1274# However, this order might be changed!
1275# -----------------------------------------------------------------------------
1276!if "$(_TARGET_EARLY_PUBLISH)" != ""
1277publish:
1278!else
1279publish: publish_target
1280!endif
1281!ifdef SUBDIRS_PUBLISH
1282 @$(TOOL_DODIRS) "$(SUBDIRS_PUBLISH)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1283!else
1284! ifdef SUBDIRS
1285 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1286! endif
1287!endif
1288!ifdef PREMAKEFILES_PUBLISH
1289 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1290!else
1291! ifdef PREMAKEFILES
1292 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1293! endif
1294!endif
1295!ifdef POSTMAKEFILES_PUBLISH
1296 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1297!else
1298! ifdef POSTMAKEFILES
1299 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1300! endif
1301!endif
1302
1303
1304#
1305# Publish rule which doesn't go down into subdirs and submakes.
1306# This one is invoked when a target is 'needed' or early published.
1307#
1308publish_target:
1309!if ( "$(_TARGET_EARLY_PUBLISH)" != "" || "$(TARGET_MODE:LIB=cute)" == "$(TARGET_MODE)" ) && "$(TARGET_PRIVATE)" == ""
1310! if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1311 @$(ECHO) Publishing $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR)$(CLRRST)
1312 @if not exist "$(TARGET)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1313 @if not exist "$(TARGET_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR)
1314 @if exist "$(TARGET)" $(TOOL_COPY) "$(TARGET)" "$(TARGET_PUB)"
1315 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR)"
1316! ifdef PUBLISH_MAP
1317 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB_DIR)"
1318! endif
1319! if "$(TARGET_PUB_DEB)" != ""
1320 @$(ECHO) Publishing unstripped $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR_DEB)$(CLRRST)
1321 @if not exist "$(_TARGET_DEB)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(_TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1322 @if not exist "$(TARGET_PUB_DIR_DEB)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR_DEB)
1323 @if exist "$(_TARGET_DEB)" $(TOOL_COPY) "$(_TARGET_DEB)" "$(TARGET_PUB_DEB)"
1324 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR_DEB)"
1325! ifdef PUBLISH_MAP
1326 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB_DIR_DEB)"
1327! endif
1328! endif
1329! if "$(TARGET_PUB2)" != ""
1330 @$(ECHO) Publishing $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB2_DIR)$(CLRRST)
1331 @if not exist "$(TARGET)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1332 @if not exist "$(TARGET_PUB2_DIR)" $(TOOL_CREATEPATH) $(TARGET_PUB2_DIR)
1333 @if exist "$(TARGET)" $(TOOL_COPY) "$(TARGET)" "$(TARGET_PUB2)"
1334 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB2_DIR)"
1335! ifdef PUBLISH_MAP
1336 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB2_DIR)"
1337! endif
1338! if "$(TARGET_PUB2_DEB)" != ""
1339 @$(ECHO) Publishing unstripped $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB2_DIR_DEB)$(CLRRST)
1340 @if not exist "$(_TARGET_DEB)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(_TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1341 @if not exist "$(TARGET_PUB2_DIR_DEB)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR_DEB)
1342 @if exist "$(_TARGET_DEB)" $(TOOL_COPY) "$(_TARGET_DEB)" "$(TARGET_PUB2_DEB)"
1343 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB2_DIR_DEB)"
1344! ifdef PUBLISH_MAP
1345 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB2_DIR_DEB)"
1346! endif
1347! endif
1348! endif
1349! endif
1350!endif
1351!if "$(TARGET_BOOKS)" != ""
1352 @$(ECHO) Publishing Book(s) $(CLRFIL)$(TARGET_BOOKS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_BOOK_PUB_DIR)$(CLRRST)
1353 @if not exist "$(TARGET_BOOK_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_BOOK_PUB_DIR)
1354 @$(TOOL_COPY) $(TARGET_BOOKS) $(TARGET_BOOK_PUB_DIR)
1355!endif
1356!if "$(TARGET_HELPS)" != ""
1357 @$(ECHO) Publishing Help file(s) $(CLRFIL)$(TARGET_HELPS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_HELP_PUB_DIR)$(CLRRST)
1358 @if not exist "$(TARGET_HELP_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_HELP_PUB_DIR)
1359 @$(TOOL_COPY) $(TARGET_HELPS) $(TARGET_HELP_PUB_DIR)
1360!endif
1361!if "$(TARGET_DOCS)" != ""
1362 @$(ECHO) Publishing Doc(s) $(CLRFIL)$(TARGET_DOCS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_DOC_PUB_DIR)$(CLRRST)
1363 @if not exist "$(TARGET_DOC_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_DOC_PUB_DIR)
1364 @$(TOOL_COPY) $(TARGET_DOCS) $(TARGET_DOC_PUB_DIR)
1365!endif
1366
1367
1368
1369# -----------------------------------------------------------------------------
1370# Pass x - The testcase rule - Execute testcases when present.
1371# Testcases are either a testcase.mak file or a testcase subdirectory.
1372# -----------------------------------------------------------------------------
1373!if "$(TARGET_MODE)" != "TESTCASE"
1374!ifndef BUILD_OWN_TESTCASE_RULE
1375
1376!ifndef MAKEVER
1377_TESTCASE_TST1 = [$(TOOL_EXISTS) testcase] == 0
1378_TESTCASE_TST2 = [$(TOOL_EXISTS) testcase.mak] == 0
1379!else
1380_TESTCASE_TST1 = exists(testcase) != 0
1381_TESTCASE_TST2 = exists(testcase.mak) != 0
1382!endif
1383
1384testcase:
1385 @$(ECHO) Executing testcases $(CLRRST)
1386!if $(_TESTCASE_TST1)
1387 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1388!endif
1389!if $(_TESTCASE_TST2)
1390 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
1391!endif
1392!ifdef SUBDIRS_TESTCASE
1393 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1394!else
1395! ifdef SUBDIRS
1396 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1397! endif
1398!endif
1399!ifdef PREMAKEFILES_TESTCASE
1400 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1401!else
1402! ifdef PREMAKEFILES
1403 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1404! endif
1405!endif
1406!ifdef POSTMAKEFILES_TESTCASE
1407 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1408!else
1409! ifdef POSTMAKEFILES
1410 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1411! endif
1412!endif
1413
1414!endif # BUILD_OWN_TESTCASE_RULE
1415!endif #!TESTCASE
1416
1417
1418# -----------------------------------------------------------------------------
1419# Pass x - The packing rule - traverse subdirs etc.
1420# -----------------------------------------------------------------------------
1421!ifdef SUBDIRS_PACKING
1422_SUBDIRS_PACKING = _subdir_packing
1423$(_SUBDIRS_PACKING):
1424 @$(TOOL_DODIRS) "$(SUBDIRS_PACKING)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1425!else
1426! ifdef SUBDIRS
1427_SUBDIRS_PACKING = _subdir_packing
1428$(_SUBDIRS_PACKING):
1429 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1430! endif
1431!endif
1432
1433!ifdef PREMAKEFILES_PACKING
1434_PREMAKEFILES_PACKING = _premakefiles_packing
1435$(PREMAKEFILES_PACKING):
1436 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PACKING)" $(TOOL_MAKE) packing
1437!else
1438! ifdef PREMAKEFILES
1439_PREMAKEFILES_PACKING = _premakefiles_packing
1440$(_PREMAKEFILES_PACKING):
1441 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) packing
1442! endif
1443!endif
1444
1445!if "$(RULE_PACKING)" == "packing"
1446_packing: \
1447!else
1448packing: \
1449!endif
1450 $(_SUBDIRS_PACKING) $(_PREMAKEFILES_PACKING) $(RULE_PACKING)
1451!ifdef POSTMAKEFILES_PACKING
1452 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PACKING)" $(TOOL_MAKE) $@
1453!else
1454! ifdef POSTMAKEFILES
1455 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1456! endif
1457!endif
1458 $(ECHO) .$(CLRRST)
1459
1460
1461
1462# -----------------------------------------------------------------------------
1463# The target rule - Build the target.
1464# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
1465# -----------------------------------------------------------------------------
1466target: $(TARGET) $(TARGET_ILIB) $(_TARGET_EARLY_PUBLISH) $(OTHERS)
1467!if "$(TARGET)$(TARGET_ILIB)" != ""
1468 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
1469!else
1470 @$(ECHO) .$(CLRRST)
1471!endif
1472
1473
1474
1475# -----------------------------------------------------------------------------
1476# Others (experimental)
1477# -----------------------------------------------------------------------------
1478others: $(OTHERS)
1479!if "$(OTHERS)" != ""
1480 @$(ECHO) Successfully Built $(OTHERS)$(CLRRST)
1481!else
1482 @$(ECHO) .$(CLRRST)
1483!endif
1484
1485
1486
1487# -----------------------------------------------------------------------------
1488# The shell rule - Setup the correcte shell environment and start a shell.
1489# -----------------------------------------------------------------------------
1490shell:
1491 @$(ECHO) Creating work shell $(CLRRST)
1492 \
1493!ifndef BUILD_VERBOSE
1494 @ \
1495!endif
1496 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1497 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
1498
1499
1500
1501# -----------------------------------------------------------------------------
1502# The nothing rule - Rule for testing the makefile structure.
1503# -----------------------------------------------------------------------------
1504nothing:
1505 @$(ECHO) Doing nothing in $(MAKEFILE).
1506!ifdef SUBDIRS
1507 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1508!endif
1509!ifdef PREMAKEFILES
1510 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1511!endif
1512!ifdef POSTMAKEFILES
1513 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1514!endif
1515 @$(ECHO) Completed nothing in $(MAKEFILE).
1516
1517
1518
1519# -----------------------------------------------------------------------------
1520# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1521# -----------------------------------------------------------------------------
1522!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
1523$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF) $(TARGET_DEPS) $(TARGET_LIBS) \
1524 $(MAKEFILE) $(MAKE_INCLUDE_SETUP) $(MAKE_INCLUDE_LD_SETUP) $(MAKE_INCLUDE_LD_OPT) $(PATH_ROOT)\$(BUILD_SETUP_MAK) $(MAKE_INCLUDE_PROCESS) $(PATH_MAKE)\setup.tools.mk
1525!if "$(TOOL_JOB_WAIT)" != ""
1526! ifndef BUILD_QUIET
1527 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1528! endif
1529 \
1530! ifndef BUILD_VERBOSE
1531 @ \
1532! endif
1533 $(TOOL_JOB_WAIT)
1534!endif
1535!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1536! ifndef BUILD_QUIET
1537 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1538! endif
1539 \
1540! ifndef BUILD_VERBOSE
1541 @ \
1542! endif
1543 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$(TARGET_DEF) $(TARGET_DEF) $(TARGET_DEF_LINK)
1544!endif
1545!ifndef TOOL_DEFCONV
1546 @$(TOOL_ECHOTXT) Creating Linker Input File $(CLRRST)<<$(TARGET_LNK)
1547$(LINK_LNK1)
1548$(LINK_LNK2)
1549$(LINK_LNK3)
1550$(LINK_LNK4)
1551$(LINK_LNK5)
1552<<KEEP
1553!else
1554 @$(ECHO) Creating Linker Input File $(CLRRST) $(TARGET_LNK)
1555 @$(TOOL_RM) "$(TARGET_LNK)"
1556 \
1557! ifndef BUILD_VERBOSE
1558 @ \
1559! endif
1560 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $(TARGET_LNK) <<$(TARGET_LNK)2
1561$(LINK_LNK1)
1562$(LINK_LNK2)
1563$(LINK_LNK3)
1564$(LINK_LNK4)
1565$(LINK_LNK5)
1566<<keep
1567!endif
1568!ifdef BUILD_VERBOSE
1569 @type $(TARGET_LNK)
1570!endif
1571 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
1572 \
1573!ifndef BUILD_VERBOSE
1574 @ \
1575!endif
1576!if $(TARGET_IGNORE_LINKER_WARNINGS)
1577 -4 \
1578!endif
1579!if "$(TARGET_MODE)" == "EXE"
1580 $(LINK_CMD_EXE)
1581!endif
1582!if "$(TARGET_MODE)" == "DLL"
1583 $(LINK_CMD_DLL)
1584!endif
1585!if "$(TARGET_MODE)" == "SYS"
1586 $(LINK_CMD_SYS)
1587!endif
1588!if "$(TARGET_MODE)" == "IFS"
1589 $(LINK_CMD_IFS)
1590!endif
1591!if "$(TARGET_MODE)" == "VDD"
1592 $(LINK_CMD_VDD)
1593!endif
1594!if "$(TARGET_POSTLINKING_CMD)" != ""
1595 @$(ECHO) Executing custom postlinking step...$(CLRRST)
1596 $(TARGET_POSTLINKING_CMD)
1597!endif
1598!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1599 @$(ECHO) Linking Resources $(CLRRST)
1600 \
1601! ifndef BUILD_VERBOSE
1602 @ \
1603! endif
1604 $(RL) $(RL_FLAGS) $(TARGET_RES) $(RL_EXE_OUT)$@
1605!endif
1606!if "$(TARGET_DLLRNAME)" != ""
1607 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
1608 \
1609! ifndef BUILD_VERBOSE
1610 @ \
1611! endif
1612 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1613!endif
1614!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
1615 \
1616! ifndef BUILD_VERBOSE
1617 @ \
1618! endif
1619 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1620!endif
1621!if "$(BUILD_MODE)" == "RELEASE"
1622 \
1623! ifndef BUILD_VERBOSE
1624 @ \
1625! endif
1626 $(TOOL_COPY) "$@" "$(_TARGET_DEB)"
1627! if "$(TOOL_STRIP)" != ""
1628 \
1629! ifndef BUILD_VERBOSE
1630 @ \
1631! endif
1632 $(TOOL_STRIP) $@
1633! endif
1634!endif
1635!if "$(TARGET_POSTSTRIP_CMD)" != ""
1636 @$(ECHO) Executing custom poststrip step...$(CLRRST)
1637 $(TARGET_POSTSTRIP_CMD)
1638!endif
1639
1640!endif
1641
1642
1643# -----------------------------------------------------------------------------
1644# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
1645# -----------------------------------------------------------------------------
1646!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
1647$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
1648!if "$(TOOL_JOB_WAIT)" != ""
1649! ifndef BUILD_QUIET
1650 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1651! endif
1652 \
1653! ifndef BUILD_VERBOSE
1654 @ \
1655! endif
1656 $(TOOL_JOB_WAIT)
1657!endif
1658 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
1659!ifndef BUILD_VERBOSE
1660 @$(TOOL_RM) "$@"
1661 @$(AR_CMD)
1662!else
1663 $(TOOL_RM) "$@"
1664 $(AR_CMD)
1665!endif
1666
1667
1668#
1669# Lib parameter file.
1670#
1671$(TARGET_LNK): $(MAKEFILE) $(MAKE_INCLUDE_SETUP) $(MAKE_INCLUDE_AR_SETUP) $(PATH_ROOT)\$(BUILD_SETUP_MAK)
1672 @$(TOOL_ECHOTXT) Creating Lib Input File $(CLRRST)<<$@
1673$(AR_LNK1)
1674$(AR_LNK2)
1675$(AR_LNK3)
1676$(AR_LNK4)
1677$(AR_LNK5)
1678<<KEEP
1679!ifdef BUILD_VERBOSE
1680 @type $@
1681!endif
1682!endif
1683
1684
1685# -----------------------------------------------------------------------------
1686# The $(TARGET) rule - For DEPEND targets.
1687# -----------------------------------------------------------------------------
1688!if "$(TARGET_MODE)" == "DEPEND"
1689$(TARGET):
1690 @$(ECHO) .
1691!endif
1692
1693
1694
1695# -----------------------------------------------------------------------------
1696# The $(TARGET_ILIB) rule - Make import library.
1697# -----------------------------------------------------------------------------
1698!ifdef TARGET_ILIB
1699$(TARGET_ILIB): $(TARGET_IDEF) $(MAKEFILE) $(MAKE_INCLUDE_SETUP) $(MAKE_INCLUDE_AR_SETUP) $(PATH_MAKE)\setup.tools.mk
1700 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
1701 \
1702!ifndef BUILD_VERBOSE
1703 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1704!endif
1705 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1706 \
1707!ifndef BUILD_VERBOSE
1708 @ \
1709!endif
1710 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
1711
1712
1713#
1714# Conversion rule for converting the .def file before passing along to implib.
1715#
1716! if "$(TARGET_IDEF_ORG)" != "" && "$(TARGET_IDEF_ORG)" != "$(TARGET_IDEF)"
1717$(TARGET_IDEF): $(TARGET_IDEF_ORG)
1718 @$(ECHO) Making Import Definition File $(CLRFIL)$@ $(CLRRST)
1719 \
1720!ifndef BUILD_VERBOSE
1721 @if not exist $(@D) $(ECHO) Target .def path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1722!endif
1723 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1724 \
1725!ifndef BUILD_VERBOSE
1726 @ \
1727!endif
1728 $(TOOL_IDEFCONV) $(TOOL_IDEFCONV_FLAGS) $(TARGET_IDEF_ORG) $@
1729! endif
1730
1731!endif
1732
1733
1734
1735# -----------------------------------------------------------------------------
1736# The .force rule - Force a remake of something everytime.
1737# -----------------------------------------------------------------------------
1738.force:
1739!ifndef BUILD_VERBOSE
1740 @$(ECHO) .
1741!else
1742 @$(ECHO) . (force) .
1743!endif
1744
1745
1746
1747# -----------------------------------------------------------------------------
1748# Read Dependencies.
1749# -----------------------------------------------------------------------------
1750!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1751!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
1752
1753#
1754# Read dependency file for current directory
1755#
1756!ifndef MAKEVER
1757! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1758! ifdef BUILD_VERBOSE
1759! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1760! endif
1761! endif
1762! include $(TARGET_DEPEND)
1763! else
1764#! ifndef NODEP
1765#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1766#! endif
1767#! endif
1768! endif
1769!else
1770! if %exists($(TARGET_DEPEND)) != 0
1771! ifdef BUILD_VERBOSE
1772$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1773! endif
1774! include $(TARGET_DEPEND)
1775! else
1776#! ifndef NODEP
1777#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1778#! endif
1779! endif
1780!endif
1781
1782
1783#
1784# Read global dependency files.
1785#
1786!ifdef BUILD_DEPEND1
1787! ifndef MAKEVER
1788! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1789! ifdef BUILD_VERBOSE
1790! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1791! endif
1792! endif
1793! include $(BUILD_DEPEND1)
1794! else
1795! ifndef NODEP
1796! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
1797! endif
1798! endif
1799! endif
1800! else
1801! if %exists($(BUILD_DEPEND1)) != 0
1802! ifdef BUILD_VERBOSE
1803$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1804! endif
1805! include $(BUILD_DEPEND1)
1806! else
1807! ifndef NODEP
1808$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1809! endif
1810! endif
1811! endif
1812!endif
1813
1814
1815!ifdef BUILD_DEPEND2
1816! ifndef MAKEVER
1817! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1818! ifdef BUILD_VERBOSE
1819! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1820! endif
1821! endif
1822! include $(BUILD_DEPEND2)
1823! else
1824! ifndef NODEP
1825! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1826! endif
1827! endif
1828! endif
1829! else
1830! if %exists($(BUILD_DEPEND2)) != 0
1831! ifdef BUILD_VERBOSE
1832$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1833! endif
1834! include $(BUILD_DEPEND2)
1835! else
1836! ifndef NODEP
1837$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1838! endif
1839! endif
1840! endif
1841!endif
1842
1843
1844!ifdef BUILD_DEPEND3
1845! ifndef MAKEVER
1846! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1847! ifdef BUILD_VERBOSE
1848! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1849! endif
1850! endif
1851! include $(BUILD_DEPEND3)
1852! else
1853! ifndef NODEP
1854! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1855! endif
1856! endif
1857! endif
1858! else
1859! if %exists($(BUILD_DEPEND3)) != 0
1860! ifdef BUILD_VERBOSE
1861$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1862! endif
1863! include $(BUILD_DEPEND3)
1864! else
1865! ifndef NODEP
1866$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1867! endif
1868! endif
1869! endif
1870!endif
1871
1872
1873!endif
1874
1875
1876#
1877# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1878#
1879!if "$(BUILD_MULTIJOBS)" != ""
1880! if [$(TOOL_JOB_UP)] != 0
1881! if "$(BUILD_QUITE)" == ""
1882! ifndef MAKEVER
1883! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1884! endif
1885! else
1886$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
1887! endif
1888! endif
1889! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
1890! ifndef MAKEVER
1891! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1892! endif
1893! error
1894!else
1895! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1896!endif
1897! endif
1898! endif
1899!endif
1900
1901!endif #!TESTCASE
1902
1903
1904#
1905# Include system library dependency stubs.
1906#
1907!include $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)libs.mk
1908
1909
1910#
1911# Check if TARGET_ALWAYS needs to be forced built.
1912#
1913!if "$(TARGET_ALWAYS)" != ""
1914! ifndef BUILD_FORCED_BUILD_TEST
1915! if [$(TOOL_MAKE) BUILD_FORCED_BUILD_TEST=1 -f $(MAKEFILE) -q $(TARGET) $(TARGET_ILIB) >nul 2>nul] != 0
1916$(TARGET_ALWAYS): .force
1917! endif
1918! endif
1919!endif
1920
Note: See TracBrowser for help on using the repository browser.