source: trunk/make/process.mak@ 10438

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

PUB2

File size: 54.0 KB
Line 
1# $Id: process.mak,v 1.39 2004-02-02 22:26:57 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! endif
453!endif
454
455
456# Default stacksize
457# If 16bit: 8KB
458# Else (32bit): 64KB
459!ifndef TARGET_STACKSIZE
460! ifdef ENV_16BIT
461TARGET_STACKSIZE=0x2000
462! else
463TARGET_STACKSIZE=0x10000
464! endif
465!endif
466
467
468
469# -----------------------------------------------------------------------------
470# Internal helper macros - don't mess!
471# -----------------------------------------------------------------------------
472
473# Helper for doing early publish of a target.
474!if defined(TARGET_NEEDED) || defined(TARGET_PUBLIC)
475_TARGET_EARLY_PUBLISH = publish_target
476!else
477_TARGET_EARLY_PUBLISH =
478!endif
479
480# The unstripped release name (internal!)
481_TARGET_DEB = $(TARGET).unstripped
482
483
484
485# -----------------------------------------------------------------------------
486# Tell user what we're building.
487# -----------------------------------------------------------------------------
488!ifndef BUILD_QUIET
489! if "$(TARGET)" != ""
490! ifndef MAKEVER
491! if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
492! endif
493! else
494$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)
495! endif
496! endif
497!endif
498
499
500# -----------------------------------------------------------------------------
501# Ensure the platform-specific target path exists
502# -----------------------------------------------------------------------------
503
504!if "$(TARGET_MODE)" != "EMPTY"
505! if "$(PATH_TARGET)" != ""
506! ifndef MAKEVER
507! if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
508! ifndef BUILD_QUIET
509! if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
510! endif
511! endif
512! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
513! if [$(ECHO) $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)]
514! endif
515! error
516! endif
517! endif
518! else
519! if %exist($(PATH_TARGET)) == 0
520! ifndef BUILD_QUIET
521$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
522! endif
523! else
524! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
525! error $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)
526! endif
527! endif
528! endif
529! endif
530!endif
531# not 100% sure about the != EMPTY stuff, but this is way faster.
532
533
534# -----------------------------------------------------------------------------
535# Make all targets 'unprecious'. (works only on nmake5)
536# -----------------------------------------------------------------------------
537.PRECIOUS: .force
538
539
540# -----------------------------------------------------------------------------
541# Common inference rules
542# -----------------------------------------------------------------------------
543.SUFFIXES:
544.SUFFIXES: .c .cpp .orc .asm .$(EXT_OBJ) .$(EXT_RES) .rc .ii .s .ipp .ipf .$(EXT_INF) .$(EXT_HLP)
545
546#
547# A workaround for SlickEdits inability to find the buggy files..
548# This makes the source filenames in the error listing have full path.
549# See setup.mak for compile command line.
550#
551#_SRC = $<
552#!ifdef SLKRUNS
553_SRC = $(PATH_CURRENT)\$(<F)
554#!endif
555_DST = $(PATH_TARGET)\$(@F)
556
557
558# Assembling assembly source.
559.asm{$(PATH_TARGET)}.$(EXT_OBJ):
560 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
561 \
562! ifndef BUILD_VERBOSE
563 @ \
564! endif
565!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
566! ifdef AS_CMD_SYS
567 $(TOOL_JOB_SUB) $(AS_CMD_SYS)
568! else
569 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
570! endif
571!else
572! ifdef AS_CMD
573 $(TOOL_JOB_SUB) $(AS_CMD)
574! else
575 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
576! endif
577!endif
578
579.asm.$(EXT_OBJ):
580 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRRST)
581 \
582!ifndef BUILD_VERBOSE
583 @ \
584!endif
585!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
586! ifdef AS_CMD_SYS
587 $(AS_CMD_SYS)
588! else
589 $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
590! endif
591!else
592! ifdef AS_CMD
593 $(AS_CMD)
594! else
595 $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
596! endif
597!endif
598
599# C++ Compiler base line
600_CXX_BASELINE = $(CXX) \
601!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
602 $(CXX_FLAGS_EXE) \
603!endif
604!if "$(TARGET_MODE)" == "DLL"
605 $(CXX_FLAGS_DLL) \
606!endif
607!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
608 $(CXX_FLAGS_SYS) \
609!endif
610!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
611 $(CXX_FLAGS_IFS) \
612!endif
613
614# Compiling C++ source.
615.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
616 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
617 \
618!ifndef BUILD_VERBOSE
619 @ \
620!endif
621 $(TOOL_JOB_SUB) $(_CXX_BASELINE) \
622!if "$(CXX_LST_OUT)" != ""
623 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
624!endif
625 $(CXX_OBJ_OUT)$(_DST) $(_SRC)
626
627.cpp.$(EXT_OBJ):
628 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
629 \
630!ifndef BUILD_VERBOSE
631 @ \
632!endif
633 $(_CXX_BASELINE) \
634!if "$(CXX_LST_OUT)" != ""
635 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
636!endif
637 $(CXX_OBJ_OUT)$(_DST) $(_SRC)
638
639
640# Pre-Compiling C++ source.
641.cpp.ii:
642 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
643 \
644!ifndef BUILD_VERBOSE
645 @ \
646!endif
647 $(_CXX_BASELINE) \
648 $(CXX_PC_2_STDOUT) $(_SRC) > $@
649
650
651# Compiler C++ source to assembly.
652!if "$(CXX_AS_2_FILE)" != ""
653.cpp.s:
654 @$(ECHO) C++ To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
655 \
656!ifndef BUILD_VERBOSE
657 @ \
658!endif
659 $(_CXX_BASELINE) \
660 $(CXX_AS_2_FILE)$@ $(_SRC)
661!endif
662
663
664
665# C Compiler base line
666_CC_BASELINE = $(CC) \
667!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
668 $(CC_FLAGS_EXE) \
669!endif
670!if "$(TARGET_MODE)" == "DLL"
671 $(CC_FLAGS_DLL) \
672!endif
673!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
674 $(CC_FLAGS_SYS) \
675!endif
676!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
677 $(CC_FLAGS_IFS) \
678!endif
679!if "$(TARGET_MODE)" == "VDD"
680 $(CC_FLAGS_VDD) \
681!endif
682
683# Compiling C source.
684.c{$(PATH_TARGET)}.$(EXT_OBJ):
685 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
686 \
687!ifndef BUILD_VERBOSE
688 @ \
689!endif
690 $(TOOL_JOB_SUB) $(_CC_BASELINE) \
691!if "$(CC_LST_OUT)" != ""
692 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
693!endif
694 $(CC_OBJ_OUT)$(_DST) $(_SRC)
695
696.c.$(EXT_OBJ):
697 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRRST)
698 \
699!ifndef BUILD_VERBOSE
700 @ \
701!endif
702 $(_CC_BASELINE) \
703!if "$(CC_LST_OUT)" != ""
704 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
705!endif
706 $(CC_OBJ_OUT)$(_DST) $(_SRC)
707
708
709# Pre-Compiling C source.
710.c.ii:
711 @$(ECHO) C PreCompiler $(CLRFIL)$(_SRC) $(CLRRST)
712 \
713!ifndef BUILD_VERBOSE
714 @ \
715!endif
716 $(_CC_BASELINE) \
717 $(CC_PC_2_STDOUT) $(_SRC) > $@
718
719
720# Compiler C source to assembly.
721!if "$(CC_AS_2_FILE)" != ""
722.c.s:
723 @$(ECHO) C To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
724 \
725!ifndef BUILD_VERBOSE
726 @ \
727!endif
728 $(_CC_BASELINE) \
729 $(CC_AS_2_FILE)$@ $(_SRC)
730!endif
731
732
733# Compiling resources.
734.rc{$(PATH_TARGET)}.res:
735 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
736 \
737!ifndef BUILD_VERBOSE
738 @ \
739!endif
740 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $(_SRC) $(RC_RES_OUT)$(_DST)
741
742.rc.res:
743 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
744 \
745!ifndef BUILD_VERBOSE
746 @ \
747!endif
748 $(RC) $(RC_FLAGS) $(_SRC) $(RC_RES_OUT)$(_DST)
749
750
751# Compiling Odin32 resources.
752.orc{$(PATH_TARGET)}.obj:
753 @$(ECHO) ORC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
754 \
755!ifndef BUILD_VERBOSE
756 @ \
757!endif
758 $(ORC) $(ORC_FLAGS) $(ORC_ASM_OUT)$(PATH_TARGET)\$(@B).asm $(_SRC)
759 \
760!ifndef BUILD_VERBOSE
761 @ \
762!endif
763 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(_DST)
764
765.orc.obj:
766 @$(ECHO) ORC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
767 \
768!ifndef BUILD_VERBOSE
769 @ \
770!endif
771 $(ORC) $(ORC_FLAGS) $(ORC_ASM_OUT)$(PATH_TARGET)\$(@B).asm $(_SRC)
772 \
773!ifndef BUILD_VERBOSE
774 @ \
775!endif
776 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(_DST)
777
778
779# Compiling INFs.
780.ipf{$(PATH_TARGET)}.$(EXT_INF):
781 @$(ECHO) BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
782 \
783!ifndef BUILD_VERBOSE
784 @ \
785!endif
786 $(INFC_CMD)
787
788.ipf.inf:
789 @$(ECHO) BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
790 \
791!ifndef BUILD_VERBOSE
792 @ \
793!endif
794 $(INFC_CMD)
795
796
797# Compiling INFs with pre-compiling
798.ipp{$(PATH_TARGET)}.$(EXT_INF):
799 @$(ECHO) CC Pre + BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
800!ifndef CC_PC_2_STRIPPED_STDOUT
801 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
802!endif
803 \
804!ifndef BUILD_VERBOSE
805 @ \
806!endif
807 $(INFC_CMD_PRE)
808
809.ipp.inf:
810 @$(ECHO) CC Pre + BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
811!ifndef CC_PC_2_STRIPPED_STDOUT
812 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
813!endif
814 \
815!ifndef BUILD_VERBOSE
816 @ \
817!endif
818 $(INFC_CMD_PRE)
819
820
821# Compiling HLPs
822.ipf{$(PATH_TARGET)}.$(EXT_HLP):
823 @$(ECHO) HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
824 \
825!ifndef BUILD_VERBOSE
826 @ \
827!endif
828 $(HLPC_CMD)
829
830.ipf.hlp:
831 @$(ECHO) HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
832 \
833!ifndef BUILD_VERBOSE
834 @ \
835!endif
836 $(HLPC_CMD)
837
838
839# Compiling HLPs with pre-compiling
840.ipp{$(PATH_TARGET)}.$(EXT_HLP):
841 @$(ECHO) CC Pre + HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
842!ifndef CC_PC_2_STRIPPED_STDOUT
843 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
844!endif
845 \
846!ifndef BUILD_VERBOSE
847 @ \
848!endif
849 $(HLPC_CMD_PRE)
850
851.ipp.hlp:
852 @$(ECHO) CC Pre + HELP Compiler $(CLRFIL)$(_SRC)$(CLRRST)
853!ifndef CC_PC_2_STRIPPED_STDOUT
854 $(TOOL_ECHO) $(CLRERR)fatal error: CC_PC_2_STRIPPED_STDOUT isn't supported on this compiler. $(CLRRST) && false
855!endif
856 \
857!ifndef BUILD_VERBOSE
858 @ \
859!endif
860 $(HLPC_CMD_PRE)
861
862
863
864# -----------------------------------------------------------------------------
865# The all rule - The default one, as it's the first rule in the file.
866# -----------------------------------------------------------------------------
867all: build
868
869
870
871# -----------------------------------------------------------------------------
872# The build rule - This runs all passes:
873# 1. Make Dependencies
874# 2. Make Needed Tools (stuff required in the next steps)
875# 3. Make Libraries (all kinds)
876# 4. Make Binaries (ie. executable files)
877# 5. Make Miscellaneous Targets
878# 6. Make Install
879# Note: In order to load dependencies we'll do a forwarding after making them.
880# -----------------------------------------------------------------------------
881build: _build
882!if "$(MAKEFLAGS:I=_)" == "$(MAKEFLAGS)" # this is of course broken in nmake v5.0 for OS/2.
883 @$(ECHO)$(CLRMAK)[Successfully Built Everything!] $(CLRRST)
884!else
885 @$(ECHO)$(CLRMAK)[Built Everything! (Ignore option specified)] $(CLRRST)
886!endif
887
888# internal rule shared by rebuild and build.
889_build: _build_banner_dep dep
890!ifndef BUILD_QUIET
891 @$(ECHO) Restarting $(CLRFIL)$(MAKEFILE)$(CLRTXT) with new dependencies. $(CLRRST)
892!endif
893 \
894!ifndef BUILD_VERBOSE
895 @ \
896!endif
897 $(TOOL_MAKE) -f $(MAKEFILE) _build_new_dependencies_
898
899# internal rule used to reload dependencies.
900_build_new_dependencies_: \
901 _build_banner_needed needed \
902 _build_banner_lib lib \
903 _build_banner_binary binary \
904 _build_banner_misc misc \
905 _build_banner_publish publish
906
907
908# Banners for rebuild and build.
909_build_banner_clean:
910 @$(ECHO)$(CLRMAK)[Start Pass 0 - Make Clean] $(CLRRST)
911 @SET _BUILD_PASS=0
912_build_banner_dep:
913 @$(ECHO)$(CLRMAK)[Start Pass 1 - Make Dependencies] $(CLRRST)
914 @SET _BUILD_PASS=1
915_build_banner_needed:
916 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
917 @SET _BUILD_PASS=2
918_build_banner_lib:
919 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
920 @SET _BUILD_PASS=3
921_build_banner_binary:
922 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Binaries] $(CLRRST)
923 @SET _BUILD_PASS=4
924_build_banner_misc:
925 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
926 @SET _BUILD_PASS=5
927_build_banner_publish:
928 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Public (i.e. Publish)] $(CLRRST)
929 @SET _BUILD_PASS=6
930
931
932
933# -----------------------------------------------------------------------------
934# The rebuild rule - Same as build but does a clean first (as Pass 0).
935# -----------------------------------------------------------------------------
936rebuild: \
937 _build_banner_clean clean \
938 _build
939!if "$(MAKEFLAGS:i=_)" == "$(MAKEFLAGS)"
940 @$(ECHO)$(CLRMAK)[Successfully Rebuilt Everything!] $(CLRRST)
941!else
942 @$(ECHO)$(CLRMAK)[Rebuilt Everything! (Ignore option specified)] $(CLRRST)
943!endif
944
945
946
947# -----------------------------------------------------------------------------
948# A number of shortcuts for lazy programmers.
949# -----------------------------------------------------------------------------
950pass1: build
951
952pass2: _build_new_dependencies_
953
954pass3: _build_banner_lib lib \
955 _build_banner_binary binary \
956 _build_banner_misc misc \
957 _build_banner_publish publish
958
959pass4: _build_banner_binary binary \
960 _build_banner_misc misc \
961 _build_banner_publish publish
962
963pass5: _build_banner_misc misc \
964 _build_banner_publish publish
965
966pass6: _build_banner_publish publish
967
968quick: _build_banner_lib lib \
969 _build_banner_binary binary \
970 _build_banner_publish publish
971
972
973
974# -----------------------------------------------------------------------------
975# Pass 0 - The clean rule - Clean up output files.
976# The current setup doesn't clean the published ones.
977# -----------------------------------------------------------------------------
978!if "$(TARGET_MODE)" != "TESTCASE"
979clean:
980 @$(ECHO) Cleaning... $(CLRRST)
981 \
982! ifndef BUILD_VERBOSE
983 @ \
984! endif
985 $(TOOL_RM) @<<
986"$(PATH_TARGET)\*.$(EXT_OBJ)"
987"$(PATH_TARGET)\*.$(EXT_ILIB)"
988"$(PATH_TARGET)\*.$(EXT_EXE)"
989"$(PATH_TARGET)\*.$(EXT_DLL)"
990"$(PATH_TARGET)\*.$(EXT_RES)"
991"$(PATH_TARGET)\*.$(EXT_SYS)"
992"$(PATH_TARGET)\*.$(EXT_LIB)"
993"$(PATH_TARGET)\*.$(EXT_IFS)"
994"$(PATH_TARGET)\*.$(EXT_MAP)"
995"$(PATH_TARGET)\*.$(EXT_SYM)"
996"$(PATH_TARGET)\*.$(EXT_DEF)"
997"$(PATH_TARGET)\*.s"
998"$(PATH_TARGET)\*.lst"
999"$(PATH_TARGET)\*.lnk"
1000"$(PATH_TARGET)\*.ii"
1001"$(PATH_TARGET)\.depend"
1002"$(TARGET_DEPEND)"
1003.\*.ii
1004.\*.err
1005.\.depend
1006<<
1007!ifdef SUBDIRS_CLEAN
1008 @$(TOOL_DODIRS) "$(SUBDIRS_CLEAN)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1009!else
1010! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_BINARY)$(SUBDIRS_MISC)" != ""
1011 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_BINARY) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1012! endif
1013!endif
1014!ifdef PREMAKEFILES_CLEAN
1015 @$(TOOL_DOMAKES) "$(PREMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
1016!else
1017! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_BINARY)$(PREMAKEFILES_MISC)" != ""
1018 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_BINARY) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1019! endif
1020!endif
1021!ifdef POSTMAKEFILES_CLEAN
1022 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
1023!else
1024! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_BINARY)$(POSTMAKEFILES_MISC)" != ""
1025 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_BINARY) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1026! endif
1027!endif
1028
1029!endif #!TESTCASE
1030
1031
1032
1033# -----------------------------------------------------------------------------
1034# Pass 1 - The dep rule - Make dependencies.
1035# -----------------------------------------------------------------------------
1036dep:
1037!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
1038 @$(ECHO) Making dependencies... $(CLRRST)
1039 \
1040! ifndef BUILD_VERBOSE
1041 @ \
1042! endif
1043 $(TOOL_DEP) \
1044! ifdef TARGET_NO_DEP
1045 -x$(TARGET_NO_DEP: =;)\
1046! endif
1047 @<<$(TARGET_DEPEND).rsp
1048$(TOOL_DEP_FLAGS)
1049-o$$(PATH_TARGET)
1050-d$(TARGET_DEPEND)
1051-srcadd AS:$$(MAKE_INCLUDE_AS_SETUP)
1052-srcadd AS:$$(MAKE_INCLUDE_AS_OPT)
1053-srcadd RC:$$(MAKE_INCLUDE_RC_SETUP)
1054-srcadd ORC:$$(MAKE_INCLUDE_ORC_SETUP)
1055-srcadd CX:$$(MAKE_INCLUDE_SETUP)
1056-srcadd CX:$$(MAKE_INCLUDE_CX_OPT)
1057-srcadd IPF:$$(MAKE_INCLUDE_IPFC)
1058-srcadd IPP:$$(MAKE_INCLUDE_IPFC)
1059-srcadd IPP:$$(MAKE_INCLUDE_SETUP)
1060-srcadd IPP:$$(MAKE_INCLUDE_CX_OPT)
1061$(TOOL_DEP_FILES)
1062<<KEEP
1063!ifdef BUILD_VERBOSE
1064 @type $(TARGET_DEPEND).rsp
1065!endif
1066!ifdef BUILD_VERBOSE2
1067 $(ECHO) Dependcy file: $(CLRRST)
1068 @type $(TARGET_DEPEND)
1069!endif
1070!endif
1071!ifdef SUBDIRS_DEP
1072 @$(TOOL_DODIRS) "$(SUBDIRS_DEP)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1073!else
1074! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_BINARY)$(SUBDIRS_MISC)" != ""
1075 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_BINARY) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
1076! endif
1077!endif
1078!ifdef PREMAKEFILES_DEP
1079 @$(TOOL_DOMAKES) "$(PREMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
1080!else
1081! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_BINARY)$(PREMAKEFILES_MISC)" != ""
1082 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_BINARY) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1083! endif
1084!endif
1085!ifdef POSTMAKEFILES_DEP
1086 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
1087!else
1088! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_BINARY)$(POSTMAKEFILES_MISC)" != ""
1089 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_BINARY) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
1090! endif
1091!endif
1092
1093
1094
1095# -----------------------------------------------------------------------------
1096# Pass 2 - The needed rule - Make need tools.
1097# That is tools and stuff that is required for the next passes.
1098# WARNING! These tools and stuff shouldn't rely on libraries and other
1099# results of later passes.
1100# -----------------------------------------------------------------------------
1101!ifdef SUBDIRS_NEEDED
1102_SUBDIRS_NEEDED = _subdir_needed
1103$(_SUBDIRS_NEEDED):
1104 @$(TOOL_DODIRS) "$(SUBDIRS_NEEDED)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
1105!else
1106! ifdef SUBDIRS
1107_SUBDIRS_NEEDED = _subdir_needed
1108$(_SUBDIRS_NEEDED):
1109 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
1110! endif
1111!endif
1112
1113!ifdef PREMAKEFILES_NEEDED
1114_PREMAKEFILES_NEEDED = _premakefiles_needed
1115$(_PREMAKEFILES_NEEDED):
1116 @$(TOOL_DOMAKES) "$(PREMAKEFILES_NEEDED)" $(TOOL_MAKE) needed
1117!else
1118! ifdef PREMAKEFILES
1119_PREMAKEFILES_NEEDED = _premakefiles_needed
1120$(_PREMAKEFILES_NEEDED):
1121 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) needed
1122! endif
1123!endif
1124
1125!ifdef TARGET_NEEDED
1126needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED) target
1127!else
1128needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED)
1129!endif
1130!ifdef POSTMAKEFILES_NEEDED
1131 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_NEEDED)" $(TOOL_MAKE) $@
1132!else
1133! ifdef POSTMAKEFILES
1134 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1135! endif
1136!endif
1137
1138
1139
1140# -----------------------------------------------------------------------------
1141# Pass 3 - The lib rule - Make libraries.
1142# -----------------------------------------------------------------------------
1143!ifdef SUBDIRS_LIB
1144_SUBDIRS_LIB = _subdir_lib
1145$(_SUBDIRS_LIB):
1146 @$(TOOL_DODIRS) "$(SUBDIRS_LIB)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
1147!else
1148! ifdef SUBDIRS
1149_SUBDIRS_LIB = _subdir_lib
1150$(_SUBDIRS_LIB):
1151 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
1152! endif
1153!endif
1154
1155!ifdef PREMAKEFILES_LIB
1156_PREMAKEFILES_LIB = _premakefiles_lib
1157$(_PREMAKEFILES_LIB):
1158 @$(TOOL_DOMAKES) "$(PREMAKEFILES_LIB)" $(TOOL_MAKE) lib
1159!else
1160! ifdef PREMAKEFILES
1161_PREMAKEFILES_LIB = _premakefiles_lib
1162$(_PREMAKEFILES_LIB):
1163 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
1164! endif
1165!endif
1166
1167lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
1168!if !defined(TARGET_NEEDED) && ("$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB")
1169 $(TARGET) $(_TARGET_EARLY_PUBLISH) \
1170!endif
1171 $(TARGET_ILIB)
1172!ifdef POSTMAKEFILES_LIB
1173 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
1174!else
1175! ifdef POSTMAKEFILES
1176 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1177! endif
1178!endif
1179
1180
1181
1182# -----------------------------------------------------------------------------
1183# Pass 4 - The binary rule - Build the binary.
1184# -----------------------------------------------------------------------------
1185!ifdef SUBDIRS_BINARY
1186_SUBDIRS_BINARY = _subdir_binary
1187$(_SUBDIRS_BINARY):
1188 @$(TOOL_DODIRS) "$(SUBDIRS_BINARY)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) binary
1189!else
1190! ifdef SUBDIRS
1191_SUBDIRS_BINARY = _subdir_binary
1192$(_SUBDIRS_BINARY):
1193 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) binary
1194! endif
1195!endif
1196
1197!ifdef PREMAKEFILES_BINARY
1198_PREMAKEFILES_BINARY = _premakefiles_binary
1199$(_PREMAKEFILES_BINARY):
1200 @$(TOOL_DOMAKES) "$(PREMAKEFILES_BINARY)" $(TOOL_MAKE) binary
1201!else
1202! ifdef PREMAKEFILES
1203_PREMAKEFILES_BINARY = _premakefiles_binary
1204$(_PREMAKEFILES_BINARY):
1205 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) binary
1206! endif
1207!endif
1208
1209binary executable: \
1210!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && !defined(TARGET_NEEDED)
1211 $(_SUBDIRS_BINARY) $(_PREMAKEFILES_BINARY) $(TARGET) $(_TARGET_EARLY_PUBLISH) $(OTHERS)
1212!else
1213 $(_SUBDIRS_BINARY) $(_PREMAKEFILES_BINARY)
1214!endif
1215!ifdef POSTMAKEFILES_BINARY
1216 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_BINARY)" $(TOOL_MAKE) $@
1217!else
1218! ifdef POSTMAKEFILES
1219 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1220! endif
1221!endif
1222
1223
1224
1225# -----------------------------------------------------------------------------
1226# Pass 5 - The misc(ellaneous) rule - Makes miscellaneous stuff like
1227# help, documentations etc. This is experimental for the moment.
1228# -----------------------------------------------------------------------------
1229!ifdef SUBDIRS_MISC
1230_SUBDIRS_MISC = _subdir_misc
1231$(_SUBDIRS_MISC):
1232 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) misc
1233!else
1234! ifdef SUBDIRS
1235_SUBDIRS_MISC = _subdir_misc
1236$(_SUBDIRS_MISC):
1237 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) misc
1238! endif
1239!endif
1240
1241!ifdef PREMAKEFILES_MISC
1242_PREMAKEFILES_MISC = _premakefiles_misc
1243$(PREMAKEFILES_MISC):
1244 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) misc
1245!else
1246! ifdef PREMAKEFILES
1247_PREMAKEFILES_MISC = _premakefiles_misc
1248$(_PREMAKEFILES_MISC):
1249 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) misc
1250! endif
1251!endif
1252
1253misc miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
1254 $(TARGET_BOOKS) $(TARGET_HELPS) $(TARGET_DOCS) $(TARGET_MISC)
1255!if "$(TARGET_BOOKS)$(TARGET_HELPS)$(TARGET_DOCS)$(TARGET_MISC)" != ""
1256 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_BOOKS) $(TARGET_HELPS) $(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
1257!endif
1258!ifdef POSTMAKEFILES_MISC
1259 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
1260!else
1261! ifdef POSTMAKEFILES
1262 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1263! endif
1264!endif
1265
1266
1267
1268# -----------------------------------------------------------------------------
1269# Pass 6 - The publish rule - Copies target to main binary directory.
1270# Installation order is not concidered vital, so subdirectories and
1271# pre-makefiles are processed after this directory.
1272# However, this order might be changed!
1273# -----------------------------------------------------------------------------
1274!if "$(_TARGET_EARLY_PUBLISH)" != ""
1275publish:
1276!else
1277publish: publish_target
1278!endif
1279!ifdef SUBDIRS_PUBLISH
1280 @$(TOOL_DODIRS) "$(SUBDIRS_PUBLISH)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1281!else
1282! ifdef SUBDIRS
1283 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1284! endif
1285!endif
1286!ifdef PREMAKEFILES_PUBLISH
1287 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1288!else
1289! ifdef PREMAKEFILES
1290 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1291! endif
1292!endif
1293!ifdef POSTMAKEFILES_PUBLISH
1294 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1295!else
1296! ifdef POSTMAKEFILES
1297 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1298! endif
1299!endif
1300
1301
1302#
1303# Publish rule which doesn't go down into subdirs and submakes.
1304# This one is invoked when a target is 'needed' or early published.
1305#
1306publish_target:
1307!if ( "$(_TARGET_EARLY_PUBLISH)" != "" || "$(TARGET_MODE:LIB=cute)" == "$(TARGET_MODE)" ) && "$(TARGET_PRIVATE)" == ""
1308! if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1309 @$(ECHO) Publishing $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR)$(CLRRST)
1310 @if not exist "$(TARGET)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1311 @if not exist "$(TARGET_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR)
1312 @if exist "$(TARGET)" $(TOOL_COPY) "$(TARGET)" "$(TARGET_PUB)"
1313 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR)"
1314! ifdef PUBLISH_MAP
1315 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB_DIR)"
1316! endif
1317! if "$(TARGET_PUB_DEB)" != ""
1318 @$(ECHO) Publishing unstripped $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR_DEB)$(CLRRST)
1319 @if not exist "$(_TARGET_DEB)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(_TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1320 @if not exist "$(TARGET_PUB_DIR_DEB)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR_DEB)
1321 @if exist "$(_TARGET_DEB)" $(TOOL_COPY) "$(_TARGET_DEB)" "$(TARGET_PUB_DEB)"
1322 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR_DEB)"
1323! ifdef PUBLISH_MAP
1324 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB_DIR_DEB)"
1325! endif
1326! endif
1327! if "$(TARGET_PUB2)" != ""
1328 @$(ECHO) Publishing $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB2_DIR)$(CLRRST)
1329 @if not exist "$(TARGET)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1330 @if not exist "$(TARGET_PUB2_DIR)" $(TOOL_CREATEPATH) $(TARGET_PUB2_DIR)
1331 @if exist "$(TARGET)" $(TOOL_COPY) "$(TARGET)" "$(TARGET_PUB2)"
1332 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB2_DIR)"
1333! ifdef PUBLISH_MAP
1334 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB2_DIR)"
1335! endif
1336! if "$(TARGET_PUB2_DEB)" != ""
1337 @$(ECHO) Publishing unstripped $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB2_DIR_DEB)$(CLRRST)
1338 @if not exist "$(_TARGET_DEB)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(_TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1339 @if not exist "$(TARGET_PUB2_DIR_DEB)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR_DEB)
1340 @if exist "$(_TARGET_DEB)" $(TOOL_COPY) "$(_TARGET_DEB)" "$(TARGET_PUB2_DEB)"
1341 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB2_DIR_DEB)"
1342! ifdef PUBLISH_MAP
1343 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB2_DIR_DEB)"
1344! endif
1345! endif
1346! endif
1347! endif
1348!endif
1349!if "$(TARGET_BOOKS)" != ""
1350 @$(ECHO) Publishing Book(s) $(CLRFIL)$(TARGET_BOOKS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_BOOK_PUB_DIR)$(CLRRST)
1351 @if not exist "$(TARGET_BOOK_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_BOOK_PUB_DIR)
1352 @$(TOOL_COPY) $(TARGET_BOOKS) $(TARGET_BOOK_PUB_DIR)
1353!endif
1354!if "$(TARGET_HELPS)" != ""
1355 @$(ECHO) Publishing Help file(s) $(CLRFIL)$(TARGET_HELPS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_HELP_PUB_DIR)$(CLRRST)
1356 @if not exist "$(TARGET_HELP_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_HELP_PUB_DIR)
1357 @$(TOOL_COPY) $(TARGET_HELPS) $(TARGET_HELP_PUB_DIR)
1358!endif
1359!if "$(TARGET_DOCS)" != ""
1360 @$(ECHO) Publishing Doc(s) $(CLRFIL)$(TARGET_DOCS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_DOC_PUB_DIR)$(CLRRST)
1361 @if not exist "$(TARGET_DOC_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_DOC_PUB_DIR)
1362 @$(TOOL_COPY) $(TARGET_DOCS) $(TARGET_DOC_PUB_DIR)
1363!endif
1364
1365
1366
1367# -----------------------------------------------------------------------------
1368# Pass x - The testcase rule - Execute testcases when present.
1369# Testcases are either a testcase.mak file or a testcase subdirectory.
1370# -----------------------------------------------------------------------------
1371!if "$(TARGET_MODE)" != "TESTCASE"
1372!ifndef BUILD_OWN_TESTCASE_RULE
1373
1374!ifndef MAKEVER
1375_TESTCASE_TST1 = [$(TOOL_EXISTS) testcase] == 0
1376_TESTCASE_TST2 = [$(TOOL_EXISTS) testcase.mak] == 0
1377!else
1378_TESTCASE_TST1 = exists(testcase) != 0
1379_TESTCASE_TST2 = exists(testcase.mak) != 0
1380!endif
1381
1382testcase:
1383 @$(ECHO) Executing testcases $(CLRRST)
1384!if $(_TESTCASE_TST1)
1385 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1386!endif
1387!if $(_TESTCASE_TST2)
1388 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
1389!endif
1390!ifdef SUBDIRS_TESTCASE
1391 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1392!else
1393! ifdef SUBDIRS
1394 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1395! endif
1396!endif
1397!ifdef PREMAKEFILES_TESTCASE
1398 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1399!else
1400! ifdef PREMAKEFILES
1401 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1402! endif
1403!endif
1404!ifdef POSTMAKEFILES_TESTCASE
1405 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1406!else
1407! ifdef POSTMAKEFILES
1408 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1409! endif
1410!endif
1411
1412!endif # BUILD_OWN_TESTCASE_RULE
1413!endif #!TESTCASE
1414
1415
1416# -----------------------------------------------------------------------------
1417# Pass x - The packing rule - traverse subdirs etc.
1418# -----------------------------------------------------------------------------
1419!ifdef SUBDIRS_PACKING
1420_SUBDIRS_PACKING = _subdir_packing
1421$(_SUBDIRS_PACKING):
1422 @$(TOOL_DODIRS) "$(SUBDIRS_PACKING)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1423!else
1424! ifdef SUBDIRS
1425_SUBDIRS_PACKING = _subdir_packing
1426$(_SUBDIRS_PACKING):
1427 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1428! endif
1429!endif
1430
1431!ifdef PREMAKEFILES_PACKING
1432_PREMAKEFILES_PACKING = _premakefiles_packing
1433$(PREMAKEFILES_PACKING):
1434 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PACKING)" $(TOOL_MAKE) packing
1435!else
1436! ifdef PREMAKEFILES
1437_PREMAKEFILES_PACKING = _premakefiles_packing
1438$(_PREMAKEFILES_PACKING):
1439 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) packing
1440! endif
1441!endif
1442
1443!if "$(RULE_PACKING)" == "packing"
1444_packing: \
1445!else
1446packing: \
1447!endif
1448 $(_SUBDIRS_PACKING) $(_PREMAKEFILES_PACKING) $(RULE_PACKING)
1449!ifdef POSTMAKEFILES_PACKING
1450 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PACKING)" $(TOOL_MAKE) $@
1451!else
1452! ifdef POSTMAKEFILES
1453 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1454! endif
1455!endif
1456 $(ECHO) .$(CLRRST)
1457
1458
1459
1460# -----------------------------------------------------------------------------
1461# The target rule - Build the target.
1462# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
1463# -----------------------------------------------------------------------------
1464target: $(TARGET) $(TARGET_ILIB) $(_TARGET_EARLY_PUBLISH) $(OTHERS)
1465!if "$(TARGET)$(TARGET_ILIB)" != ""
1466 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
1467!else
1468 @$(ECHO) .$(CLRRST)
1469!endif
1470
1471
1472
1473# -----------------------------------------------------------------------------
1474# Others (experimental)
1475# -----------------------------------------------------------------------------
1476others: $(OTHERS)
1477!if "$(OTHERS)" != ""
1478 @$(ECHO) Successfully Built $(OTHERS)$(CLRRST)
1479!else
1480 @$(ECHO) .$(CLRRST)
1481!endif
1482
1483
1484
1485# -----------------------------------------------------------------------------
1486# The shell rule - Setup the correcte shell environment and start a shell.
1487# -----------------------------------------------------------------------------
1488shell:
1489 @$(ECHO) Creating work shell $(CLRRST)
1490 \
1491!ifndef BUILD_VERBOSE
1492 @ \
1493!endif
1494 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1495 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
1496
1497
1498
1499# -----------------------------------------------------------------------------
1500# The nothing rule - Rule for testing the makefile structure.
1501# -----------------------------------------------------------------------------
1502nothing:
1503 @$(ECHO) Doing nothing in $(MAKEFILE).
1504!ifdef SUBDIRS
1505 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1506!endif
1507!ifdef PREMAKEFILES
1508 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1509!endif
1510!ifdef POSTMAKEFILES
1511 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1512!endif
1513 @$(ECHO) Completed nothing in $(MAKEFILE).
1514
1515
1516
1517# -----------------------------------------------------------------------------
1518# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1519# -----------------------------------------------------------------------------
1520!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
1521$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF) $(TARGET_DEPS) $(TARGET_LIBS) \
1522 $(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
1523!if "$(TOOL_JOB_WAIT)" != ""
1524! ifndef BUILD_QUIET
1525 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1526! endif
1527 \
1528! ifndef BUILD_VERBOSE
1529 @ \
1530! endif
1531 $(TOOL_JOB_WAIT)
1532!endif
1533!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1534! ifndef BUILD_QUIET
1535 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1536! endif
1537 \
1538! ifndef BUILD_VERBOSE
1539 @ \
1540! endif
1541 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$(TARGET_DEF) $(TARGET_DEF) $(TARGET_DEF_LINK)
1542!endif
1543!ifndef TOOL_DEFCONV
1544 @$(TOOL_ECHOTXT) Creating Linker Input File $(CLRRST)<<$(TARGET_LNK)
1545$(LINK_LNK1)
1546$(LINK_LNK2)
1547$(LINK_LNK3)
1548$(LINK_LNK4)
1549$(LINK_LNK5)
1550<<KEEP
1551!else
1552 @$(ECHO) Creating Linker Input File $(CLRRST) $(TARGET_LNK)
1553 @$(TOOL_RM) "$(TARGET_LNK)"
1554 \
1555! ifndef BUILD_VERBOSE
1556 @ \
1557! endif
1558 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $(TARGET_LNK) <<$(TARGET_LNK)2
1559$(LINK_LNK1)
1560$(LINK_LNK2)
1561$(LINK_LNK3)
1562$(LINK_LNK4)
1563$(LINK_LNK5)
1564<<keep
1565!endif
1566!ifdef BUILD_VERBOSE
1567 @type $(TARGET_LNK)
1568!endif
1569 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
1570 \
1571!ifndef BUILD_VERBOSE
1572 @ \
1573!endif
1574!ifdef TARGET_IGNORE_LINKER_WARNINGS
1575 -4 \
1576!endif
1577!if "$(TARGET_MODE)" == "EXE"
1578 $(LINK_CMD_EXE)
1579!endif
1580!if "$(TARGET_MODE)" == "DLL"
1581 $(LINK_CMD_DLL)
1582!endif
1583!if "$(TARGET_MODE)" == "SYS"
1584 $(LINK_CMD_SYS)
1585!endif
1586!if "$(TARGET_MODE)" == "IFS"
1587 $(LINK_CMD_IFS)
1588!endif
1589!if "$(TARGET_MODE)" == "VDD"
1590 $(LINK_CMD_VDD)
1591!endif
1592!if "$(TARGET_POSTLINKING_CMD)" != ""
1593 @$(ECHO) Executing custom postlinking step...$(CLRRST)
1594 $(TARGET_POSTLINKING_CMD)
1595!endif
1596!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1597 @$(ECHO) Linking Resources $(CLRRST)
1598 \
1599! ifndef BUILD_VERBOSE
1600 @ \
1601! endif
1602 $(RL) $(RL_FLAGS) $(TARGET_RES) $(RL_EXE_OUT)$@
1603!endif
1604!if "$(TARGET_DLLRNAME)" != ""
1605 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
1606 \
1607! ifndef BUILD_VERBOSE
1608 @ \
1609! endif
1610 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1611!endif
1612!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
1613 \
1614! ifndef BUILD_VERBOSE
1615 @ \
1616! endif
1617 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1618!endif
1619!if "$(BUILD_MODE)" == "RELEASE"
1620 \
1621! ifndef BUILD_VERBOSE
1622 @ \
1623! endif
1624 $(TOOL_COPY) "$@" "$(_TARGET_DEB)"
1625! if "$(TOOL_STRIP)" != ""
1626 \
1627! ifndef BUILD_VERBOSE
1628 @ \
1629! endif
1630 $(TOOL_STRIP) $@
1631! endif
1632!endif
1633!if "$(TARGET_POSTSTRIP_CMD)" != ""
1634 @$(ECHO) Executing custom poststrip step...$(CLRRST)
1635 $(TARGET_POSTSTRIP_CMD)
1636!endif
1637
1638!endif
1639
1640
1641# -----------------------------------------------------------------------------
1642# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
1643# -----------------------------------------------------------------------------
1644!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
1645$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
1646!if "$(TOOL_JOB_WAIT)" != ""
1647! ifndef BUILD_QUIET
1648 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1649! endif
1650 \
1651! ifndef BUILD_VERBOSE
1652 @ \
1653! endif
1654 $(TOOL_JOB_WAIT)
1655!endif
1656 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
1657!ifndef BUILD_VERBOSE
1658 @$(TOOL_RM) "$@"
1659 @$(AR_CMD)
1660!else
1661 $(TOOL_RM) "$@"
1662 $(AR_CMD)
1663!endif
1664
1665
1666#
1667# Lib parameter file.
1668#
1669$(TARGET_LNK): $(MAKEFILE) $(MAKE_INCLUDE_SETUP) $(MAKE_INCLUDE_AR_SETUP) $(PATH_ROOT)\$(BUILD_SETUP_MAK)
1670 @$(TOOL_ECHOTXT) Creating Lib Input File $(CLRRST)<<$@
1671$(AR_LNK1)
1672$(AR_LNK2)
1673$(AR_LNK3)
1674$(AR_LNK4)
1675$(AR_LNK5)
1676<<KEEP
1677!ifdef BUILD_VERBOSE
1678 @type $@
1679!endif
1680!endif
1681
1682
1683# -----------------------------------------------------------------------------
1684# The $(TARGET) rule - For DEPEND targets.
1685# -----------------------------------------------------------------------------
1686!if "$(TARGET_MODE)" == "DEPEND"
1687$(TARGET):
1688 @$(ECHO) .
1689!endif
1690
1691
1692
1693# -----------------------------------------------------------------------------
1694# The $(TARGET_ILIB) rule - Make import library.
1695# -----------------------------------------------------------------------------
1696!ifdef TARGET_ILIB
1697$(TARGET_ILIB): $(TARGET_IDEF) $(MAKEFILE) $(MAKE_INCLUDE_SETUP) $(MAKE_INCLUDE_AR_SETUP) $(PATH_MAKE)\setup.tools.mk
1698 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
1699 \
1700!ifndef BUILD_VERBOSE
1701 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1702!endif
1703 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1704 \
1705!ifndef BUILD_VERBOSE
1706 @ \
1707!endif
1708 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
1709
1710
1711#
1712# Conversion rule for converting the .def file before passing along to implib.
1713#
1714! if "$(TARGET_IDEF_ORG)" != "" && "$(TARGET_IDEF_ORG)" != "$(TARGET_IDEF)"
1715$(TARGET_IDEF): $(TARGET_IDEF_ORG)
1716 @$(ECHO) Making Import Definition File $(CLRFIL)$@ $(CLRRST)
1717 \
1718!ifndef BUILD_VERBOSE
1719 @if not exist $(@D) $(ECHO) Target .def path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1720!endif
1721 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1722 \
1723!ifndef BUILD_VERBOSE
1724 @ \
1725!endif
1726 $(TOOL_IDEFCONV) $(TOOL_IDEFCONV_FLAGS) $(TARGET_IDEF_ORG) $@
1727! endif
1728
1729!endif
1730
1731
1732
1733# -----------------------------------------------------------------------------
1734# The .force rule - Force a remake of something everytime.
1735# -----------------------------------------------------------------------------
1736.force:
1737!ifndef BUILD_VERBOSE
1738 @$(ECHO) .
1739!else
1740 @$(ECHO) . (force) .
1741!endif
1742
1743
1744
1745# -----------------------------------------------------------------------------
1746# Read Dependencies.
1747# -----------------------------------------------------------------------------
1748!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1749!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
1750
1751#
1752# Read dependency file for current directory
1753#
1754!ifndef MAKEVER
1755! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1756! ifdef BUILD_VERBOSE
1757! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1758! endif
1759! endif
1760! include $(TARGET_DEPEND)
1761! else
1762#! ifndef NODEP
1763#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1764#! endif
1765#! endif
1766! endif
1767!else
1768! if %exists($(TARGET_DEPEND)) != 0
1769! ifdef BUILD_VERBOSE
1770$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1771! endif
1772! include $(TARGET_DEPEND)
1773! else
1774#! ifndef NODEP
1775#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1776#! endif
1777! endif
1778!endif
1779
1780
1781#
1782# Read global dependency files.
1783#
1784!ifdef BUILD_DEPEND1
1785! ifndef MAKEVER
1786! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1787! ifdef BUILD_VERBOSE
1788! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1789! endif
1790! endif
1791! include $(BUILD_DEPEND1)
1792! else
1793! ifndef NODEP
1794! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
1795! endif
1796! endif
1797! endif
1798! else
1799! if %exists($(BUILD_DEPEND1)) != 0
1800! ifdef BUILD_VERBOSE
1801$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1802! endif
1803! include $(BUILD_DEPEND1)
1804! else
1805! ifndef NODEP
1806$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1807! endif
1808! endif
1809! endif
1810!endif
1811
1812
1813!ifdef BUILD_DEPEND2
1814! ifndef MAKEVER
1815! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1816! ifdef BUILD_VERBOSE
1817! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1818! endif
1819! endif
1820! include $(BUILD_DEPEND2)
1821! else
1822! ifndef NODEP
1823! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1824! endif
1825! endif
1826! endif
1827! else
1828! if %exists($(BUILD_DEPEND2)) != 0
1829! ifdef BUILD_VERBOSE
1830$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1831! endif
1832! include $(BUILD_DEPEND2)
1833! else
1834! ifndef NODEP
1835$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1836! endif
1837! endif
1838! endif
1839!endif
1840
1841
1842!ifdef BUILD_DEPEND3
1843! ifndef MAKEVER
1844! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1845! ifdef BUILD_VERBOSE
1846! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1847! endif
1848! endif
1849! include $(BUILD_DEPEND3)
1850! else
1851! ifndef NODEP
1852! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1853! endif
1854! endif
1855! endif
1856! else
1857! if %exists($(BUILD_DEPEND3)) != 0
1858! ifdef BUILD_VERBOSE
1859$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1860! endif
1861! include $(BUILD_DEPEND3)
1862! else
1863! ifndef NODEP
1864$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1865! endif
1866! endif
1867! endif
1868!endif
1869
1870
1871!endif
1872
1873
1874#
1875# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1876#
1877!if "$(BUILD_MULTIJOBS)" != ""
1878! if [$(TOOL_JOB_UP)] != 0
1879! if "$(BUILD_QUITE)" == ""
1880! ifndef MAKEVER
1881! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1882! endif
1883! else
1884$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
1885! endif
1886! endif
1887! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
1888! ifndef MAKEVER
1889! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1890! endif
1891! error
1892!else
1893! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1894!endif
1895! endif
1896! endif
1897!endif
1898
1899!endif #!TESTCASE
1900
1901
1902#
1903# Include system library dependency stubs.
1904#
1905!include $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)libs.mk
1906
1907
1908#
1909# Check if TARGET_ALWAYS needs to be forced built.
1910#
1911!if "$(TARGET_ALWAYS)" != ""
1912! ifndef BUILD_FORCED_BUILD_TEST
1913! if [$(TOOL_MAKE) BUILD_FORCED_BUILD_TEST=1 -f $(MAKEFILE) -q $(TARGET) $(TARGET_ILIB) >nul 2>nul] != 0
1914$(TARGET_ALWAYS): .force
1915! endif
1916! endif
1917!endif
1918
Note: See TracBrowser for help on using the repository browser.