source: trunk/make/process.mak@ 10366

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

POST linking/stripping

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