source: trunk/make/process.mak@ 10155

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

Win32 support - kind of working...

File size: 50.1 KB
RevLine 
[10155]1# $Id: process.mak,v 1.37 2003-06-30 13:19:49 bird Exp $
[8197]2#
[9280]3# Generic Buildsystem
[8197]4#
5# The common build process rules
6#
[9280]7# Copyright (c) 2001-2002 knut st. osmundsen <bird@anduin.net>
8# Copyright (c) 2001 Patrick Haller
[8197]9#
[9280]10# This file is part of Generic Buildsystem.
11#
[8197]12
13
[8253]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# -----------------------------------------------------------------------------
[8714]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)
[8197]27!endif
[8714]28!endif
[8253]29!if "$(ENV_STATUS)" != "OK"
[8714]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)
[8423]36! endif
[8253]37!endif
[8197]38
[8423]39!if "$(TARGET_NAME)" == "" && "$(TARGET_MODE)" != "EMPTY"
[8714]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)
[8423]46! endif
[8253]47!endif
48
[8290]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.
[8423]55! if "$(TARGET_MODE)" != "SYS"
[8290]56# Installable File System Drive target mode. (Also called FSD, File System Driver.)
[8423]57! if "$(TARGET_MODE)" != "IFS"
[8290]58# Virtual Device Driver target mode.
[8423]59! if "$(TARGET_MODE)" != "VDD"
[8290]60# Object Library target mode.
[8423]61! if "$(TARGET_MODE)" != "LIB"
[8290]62# Object Library target mode - Special variant which is to be linked with a SYS target.
[8423]63! if "$(TARGET_MODE)" != "SYSLIB"
[8290]64# Object Library target mode - Special variant which is to be linked with an IFS target.
[8423]65! if "$(TARGET_MODE)" != "IFSLIB"
[8290]66# Dummy/Hub/TopLevel empty makefile. This has no target.
[8423]67! if "$(TARGET_MODE)" != "EMPTY"
[9028]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
[9127]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)]
[9028]75! endif
76! error
77! else
[9127]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)
[8714]79! endif
80! endif
[8290]81! endif
82! endif
83! endif
84! endif
85! endif
86! endif
87! endif
88! endif
89! endif
90! endif
91!endif
92
[9127]93# stuff which has changed behavior.
94!if 1
[8290]95
[9127]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
[8253]112# -----------------------------------------------------------------------------
113# Provide overridable defaults
114# -----------------------------------------------------------------------------
115
116# Default target mode is executable.
117!ifndef TARGET_MODE
[9135]118! if "$(_BUILD_PROJECT)" != "Odin32"
[8253]119TARGET_MODE = EXE
[9116]120! else
121# Odin32 defaults.
122! ifndef CUSTOMBUILD
123TARGET_MODE = DLL
124! else
125TARGET_MODE = LIB
126! endif
127! endif
[8253]128!endif
129
130# Default extension corresponds to the target mode.
131!ifndef TARGET_EXT
[8423]132! if "$(TARGET_MODE)" == "DLL"
[8253]133TARGET_EXT = $(EXT_DLL)
134! endif
135! if "$(TARGET_MODE)" == "SYS"
136TARGET_EXT = $(EXT_SYS)
137! endif
[8290]138! if "$(TARGET_MODE)" == "IFS"
139TARGET_EXT = $(EXT_IFS)
140! endif
141! if "$(TARGET_MODE)" == "VDD"
142TARGET_EXT = $(EXT_VDD)
143! endif
[8253]144! if "$(TARGET_MODE)" == "EXE"
145TARGET_EXT = $(EXT_EXE)
146! endif
[8290]147! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
[8253]148TARGET_EXT = $(EXT_LIB)
149! endif
150! if "$(TARGET_MODE)" == "EMPTY"
151TARGET_EXT = empty
152! endif
[9028]153! if "$(TARGET_MODE)" == "DEPEND"
154TARGET_EXT = depend
155! endif
[8714]156! if "$(TARGET_MODE)" == "TESTCASE"
157TARGET_EXT = testcase
158! endif
[8253]159! ifndef TARGET_EXT
[8714]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)
[8423]166! endif
[8253]167! endif
168!endif
169
170# Default target path. (where all the generated stuff for this target goes)
171!ifndef PATH_TARGET
[9127]172!if "$(TARGET_SUB)" != ""
173PATH_TARGET = $(PATH_OBJ)\$(TARGET_SUB)\$(TARGET_NAME).$(TARGET_EXT)
174!else
[8253]175PATH_TARGET = $(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
176!endif
[9127]177!endif
[8253]178
179# Default target file. (output)
[8197]180!ifndef TARGET
[8270]181! if "$(TARGET_MODE)" != "EMPTY"
[8714]182! if "$(TARGET_MODE)" != "TESTCASE"
[8253]183TARGET = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
[8714]184! else
185TARGET = testcase
186! endif
[8270]187! endif
[8197]188!endif
189
[8333]190# Default target .sym file. (output)
191!ifndef TARGET_SYM
192TARGET_SYM = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_SYM)
193!endif
[8270]194
[8253]195# Default object file. (output)
[8197]196!ifndef TARGET_OBJS
[8253]197TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
[8197]198!endif
199
[8253]200# Default libraries. (input)
[8197]201!ifndef TARGET_LIBS
[8253]202TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
[8197]203!endif
204
[8253]205# Default definition file. (input)
[8197]206!ifndef TARGET_DEF
[8253]207TARGET_DEF = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
[8197]208!endif
209
[8333]210# Default modified definition filename. (output)
211!ifndef TARGET_DEF_LINK
212TARGET_DEF_LINK = $(PATH_TARGET)\$(TARGET_NAME)_link.def
213!endif
214
[8253]215# Default definition file for generating the import library. (input)
[8197]216!ifndef TARGET_IDEF
[9135]217! if "$(_BUILD_PROJECT)" != "Odin32"
[8253]218TARGET_IDEF = $(TARGET_DEF)
[9116]219! else
[9135]220! if defined(TARGET_IDEF_CONV) || "$(TARGET_IDEF_ORG)" != ""
[9116]221TARGET_IDEF = $(PATH_TARGET)\$(TARGET_NAME)_implib.def
[9135]222! ifndef TARGET_IDEF_ORG
[9116]223TARGET_IDEF_ORG = $(TARGET_DEF)
[9135]224! endif
[9116]225! else
226TARGET_IDEF = $(TARGET_DEF)
227TARGET_IDEF_ORG = $(TARGET_DEF)
228! endif
229! endif
[9135]230
[8197]231!endif
232
[8253]233# Default map file. (output)
[8197]234!ifndef TARGET_MAP
[8333]235TARGET_MAP = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_MAP)
[8197]236!endif
237
[8253]238# Default link file. (output)
[8197]239!ifndef TARGET_LNK
[8253]240TARGET_LNK = $(PATH_TARGET)\$(TARGET_NAME).lnk
[8197]241!endif
242
[8253]243# Default import library file. (output)
244!ifndef TARGET_ILIB
[9090]245! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_ILIB_YES)" != ""
[9127]246TARGET_ILIB = $(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
[8253]247! endif
[8197]248!endif
249
[9127]250# Default public base directory. (publish)
251!ifndef TARGET_PUB_BASE
[9224]252! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
253TARGET_PUB_BASE = $(PATH_LIB)
254! else
[9127]255TARGET_PUB_BASE = $(PATH_PUB)
256!endif
[9224]257!endif
[9127]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)
[8290]264! endif
[9127]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
[8290]273! if "$(TARGET_MODE)" == "EXE"
[9127]274TARGET_PUB_SUB = $(PATH_SUB_BIN)
[8290]275! endif
[8423]276! if "$(TARGET_MODE)" == "DLL"
[9127]277TARGET_PUB_SUB = $(PATH_SUB_DLL)
[8290]278! endif
[9127]279! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
[9224]280TARGET_PUB_SUB = .
[9127]281! endif
[8290]282! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
[9127]283TARGET_PUB_SUB = $(PATH_SUB_SYS)
[8290]284! endif
285! if "$(TARGET_MODE)" == "VDD"
[9127]286TARGET_PUB_SUB = $(PATH_SUB_VDD)
[8290]287! endif
[8253]288! endif
[8197]289!endif
[8253]290
[9127]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
[9275]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
[8253]354# Default depend filename.
355!ifndef TARGET_DEPEND
356TARGET_DEPEND = $(PATH_TARGET)\.depend
[8197]357!endif
358
[8423]359# Default makefile names.
360!ifndef BUILD_MAKEFILE
361BUILD_MAKEFILE = Makefile
362!endif
363
[8253]364# Default makefile name.
365!ifndef MAKEFILE
[8423]366MAKEFILE = $(BUILD_MAKEFILE)
[8197]367!endif
368
[8253]369# Ignore linker warnings for some target modes.
370!ifndef TARGET_IGNORE_LINKER_WARNINGS
[8423]371! if "$(TARGET_MODE)" == "DLL"
[8253]372TARGET_IGNORE_LINKER_WARNINGS = 1
373! endif
[8197]374!endif
375
376
[8253]377# Default stacksize
[8355]378# If 16bit: 8KB
379# Else (32bit): 64KB
[8197]380!ifndef TARGET_STACKSIZE
[8355]381! ifdef ENV_16BIT
[8197]382TARGET_STACKSIZE=0x2000
383! else
384TARGET_STACKSIZE=0x10000
385! endif
386!endif
387
[8253]388
389
390# -----------------------------------------------------------------------------
[9127]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# -----------------------------------------------------------------------------
[8253]407# Tell user what we're building.
408# -----------------------------------------------------------------------------
409!ifndef BUILD_QUIET
[9044]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)
[8714]416! endif
417! endif
[8197]418!endif
419
420
[8253]421# -----------------------------------------------------------------------------
422# Ensure the platform-specific target path exists
423# -----------------------------------------------------------------------------
424
425!if "$(TARGET_MODE)" != "EMPTY"
426! if "$(PATH_TARGET)" != ""
[8714]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
[8253]432! endif
[8714]433! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
434! if [$(ECHO) $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)]
435! endif
436! error
437! endif
[8253]438! endif
[8714]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)
[8423]443! endif
[8714]444! else
445! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
446! error $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)
447! endif
[8253]448! endif
[8197]449! endif
450! endif
451!endif
[8253]452# not 100% sure about the != EMPTY stuff, but this is way faster.
[8197]453
454
[9135]455# -----------------------------------------------------------------------------
456# Make all targets 'unprecious'. (works only on nmake5)
457# -----------------------------------------------------------------------------
458.PRECIOUS: .force
[8197]459
[9135]460
[8253]461# -----------------------------------------------------------------------------
462# Common inference rules
463# -----------------------------------------------------------------------------
[8197]464.SUFFIXES:
[9275]465.SUFFIXES: .c .cpp .orc .asm .$(EXT_OBJ) .$(EXT_RES) .rc .ii .s .ipp .ipf .$(EXT_INF) .$(EXT_HLP)
[8197]466
[8714]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#
[9904]472#_SRC = $<
473#!ifdef SLKRUNS
[9919]474_SRC = $(PATH_CURRENT)\$(<F)
[9904]475#!endif
[9165]476_DST = $(PATH_TARGET)\$(@F)
[8197]477
[8714]478
[8197]479# Assembling assembly source.
480.asm{$(PATH_TARGET)}.$(EXT_OBJ):
[8714]481 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
482 \
[8423]483! ifndef BUILD_VERBOSE
[8290]484 @ \
[8423]485! endif
[8213]486!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
[9165]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
[8197]492!else
[9165]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
[8197]498!endif
499
500.asm.$(EXT_OBJ):
[8714]501 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRRST)
502 \
[8290]503!ifndef BUILD_VERBOSE
504 @ \
505!endif
[8213]506!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
[9165]507! ifdef AS_CMD_SYS
508 $(AS_CMD_SYS)
509! else
510 $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
511! endif
[8197]512!else
[9165]513! ifdef AS_CMD
514 $(AS_CMD)
515! else
516 $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(_DST)
517! endif
[8197]518!endif
519
[8714]520# C++ Compiler base line
521_CXX_BASELINE = $(CXX) \
[8290]522!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]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
[8213]531!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
532 $(CXX_FLAGS_IFS) \
533!endif
[8714]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) \
[8253]543!if "$(CXX_LST_OUT)" != ""
[8213]544 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
545!endif
[9165]546 $(CXX_OBJ_OUT)$(_DST) $(_SRC)
[8197]547
548.cpp.$(EXT_OBJ):
[8714]549 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
550 \
[8290]551!ifndef BUILD_VERBOSE
552 @ \
553!endif
[8714]554 $(_CXX_BASELINE) \
[8253]555!if "$(CXX_LST_OUT)" != ""
[8213]556 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
557!endif
[9165]558 $(CXX_OBJ_OUT)$(_DST) $(_SRC)
[8197]559
560
561# Pre-Compiling C++ source.
[8714]562.cpp.ii:
563 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
564 \
[8290]565!ifndef BUILD_VERBOSE
566 @ \
567!endif
[8714]568 $(_CXX_BASELINE) \
569 $(CXX_PC_2_STDOUT) $(_SRC) > $@
[8197]570
571
[8714]572# Compiler C++ source to assembly.
573!if "$(CXX_AS_2_FILE)" != ""
574.cpp.s:
575 @$(ECHO) C++ To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
576 \
[8290]577!ifndef BUILD_VERBOSE
578 @ \
579!endif
[8714]580 $(_CXX_BASELINE) \
581 $(CXX_AS_2_FILE)$@ $(_SRC)
582!endif
583
584
585
586# C Compiler base line
587_CC_BASELINE = $(CC) \
[8290]588!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]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
[8213]597!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
598 $(CC_FLAGS_IFS) \
599!endif
[10155]600!if "$(TARGET_MODE)" == "VDD"
601 $(CC_FLAGS_VDD) \
602!endif
[8714]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) \
[8253]612!if "$(CC_LST_OUT)" != ""
[8213]613 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
614!endif
[9165]615 $(CC_OBJ_OUT)$(_DST) $(_SRC)
[8197]616
617.c.$(EXT_OBJ):
[8714]618 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRRST)
619 \
[8290]620!ifndef BUILD_VERBOSE
621 @ \
622!endif
[8714]623 $(_CC_BASELINE) \
[8253]624!if "$(CC_LST_OUT)" != ""
[8213]625 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
626!endif
[9165]627 $(CC_OBJ_OUT)$(_DST) $(_SRC)
[8197]628
629
630# Pre-Compiling C source.
[8714]631.c.ii:
632 @$(ECHO) C PreCompiler $(CLRFIL)$(_SRC) $(CLRRST)
633 \
[8290]634!ifndef BUILD_VERBOSE
635 @ \
636!endif
[8714]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 @ \
[8197]648!endif
[8714]649 $(_CC_BASELINE) \
650 $(CC_AS_2_FILE)$@ $(_SRC)
[8197]651!endif
652
653
654# Compiling resources.
655.rc{$(PATH_TARGET)}.res:
[8714]656 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
657 \
[8290]658!ifndef BUILD_VERBOSE
659 @ \
660!endif
[10155]661 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $(_SRC) $(RC_RES_OUT)$(_DST)
[8197]662
663.rc.res:
[8714]664 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
665 \
[8290]666!ifndef BUILD_VERBOSE
667 @ \
668!endif
[10155]669 $(RC) $(RC_FLAGS) $(_SRC) $(RC_RES_OUT)$(_DST)
[8197]670
671
[9116]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
[9165]684 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(_DST)
[8253]685
[9116]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
[9165]697 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(_DST)
[8253]698
699
[9275]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)
[9116]708
[9275]709.ipf.inf:
710 @$(ECHO) BOOK Compiler $(CLRFIL)$(_SRC)$(CLRRST)
711 \
712!ifndef BUILD_VERBOSE
713 @ \
714!endif
715 $(INFC_CMD)
[9116]716
717
[9275]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
[8253]785# -----------------------------------------------------------------------------
786# The all rule - The default one, as it's the first rule in the file.
787# -----------------------------------------------------------------------------
[8197]788all: build
789
790
[8253]791
792# -----------------------------------------------------------------------------
[9031]793# The build rule - This runs all passes:
794# 1. Make Dependencies
[9090]795# 2. Make Needed Tools (stuff required in the next steps)
796# 3. Make Libraries (all kinds)
[9275]797# 4. Make Binaries (ie. executable files)
[9090]798# 5. Make Miscellaneous Targets
799# 6. Make Install
[9031]800# Note: In order to load dependencies we'll do a forwarding after making them.
[8253]801# -----------------------------------------------------------------------------
[9031]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_: \
[9090]822 _build_banner_needed needed \
[9031]823 _build_banner_lib lib \
[9275]824 _build_banner_binary binary \
825 _build_banner_misc misc \
[9127]826 _build_banner_publish publish
[9031]827
[9228]828
[9031]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
[9090]836_build_banner_needed:
837 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
838 @SET _BUILD_PASS=2
[9031]839_build_banner_lib:
[9090]840 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
841 @SET _BUILD_PASS=3
[9275]842_build_banner_binary:
843 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Binaries] $(CLRRST)
[9090]844 @SET _BUILD_PASS=4
[9275]845_build_banner_misc:
[9090]846 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
847 @SET _BUILD_PASS=5
[9127]848_build_banner_publish:
849 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Public (i.e. Publish)] $(CLRRST)
[9090]850 @SET _BUILD_PASS=6
[9031]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# -----------------------------------------------------------------------------
[9228]869# A number of shortcuts for lazy programmers.
870# -----------------------------------------------------------------------------
871pass1: build
872
873pass2: _build_new_dependencies_
874
875pass3: _build_banner_lib lib \
[9275]876 _build_banner_binary binary \
877 _build_banner_misc misc \
[9228]878 _build_banner_publish publish
879
[9275]880pass4: _build_banner_binary binary \
881 _build_banner_misc misc \
[9228]882 _build_banner_publish publish
883
[9275]884pass5: _build_banner_misc misc \
[9228]885 _build_banner_publish publish
886
887pass6: _build_banner_publish publish
888
889quick: _build_banner_lib lib \
[9275]890 _build_banner_binary binary \
[9228]891 _build_banner_publish publish
892
893
894
895# -----------------------------------------------------------------------------
[9031]896# Pass 0 - The clean rule - Clean up output files.
[9127]897# The current setup doesn't clean the published ones.
[9031]898# -----------------------------------------------------------------------------
899!if "$(TARGET_MODE)" != "TESTCASE"
900clean:
901 @$(ECHO) Cleaning... $(CLRRST)
902 \
903! ifndef BUILD_VERBOSE
904 @ \
905! endif
[9116]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<<
[9090]928!ifdef SUBDIRS_CLEAN
929 @$(TOOL_DODIRS) "$(SUBDIRS_CLEAN)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
930!else
[9275]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 $@
[9090]933! endif
[8197]934!endif
[9090]935!ifdef PREMAKEFILES_CLEAN
936 @$(TOOL_DOMAKES) "$(PREMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
937!else
[9275]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 $@
[9090]940! endif
[9031]941!endif
[9090]942!ifdef POSTMAKEFILES_CLEAN
943 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
944!else
[9275]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 $@
[9090]947! endif
[9031]948!endif
[9090]949
[9031]950!endif #!TESTCASE
[8197]951
[9031]952
953
954# -----------------------------------------------------------------------------
955# Pass 1 - The dep rule - Make dependencies.
956# -----------------------------------------------------------------------------
957dep:
[9044]958!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
[9031]959 @$(ECHO) Making dependencies... $(CLRRST)
960 \
[9044]961! ifndef BUILD_VERBOSE
[9031]962 @ \
[9044]963! endif
[9240]964 $(TOOL_DEP) \
[9031]965! ifdef TARGET_NO_DEP
966 -x$(TARGET_NO_DEP: =;)\
967! endif
[9240]968 @<<
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)
[9281]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)
[9240]982$(TOOL_DEP_FILES)
983<<
[9281]984!ifdef BUILD_VERBOSE2
985 $(ECHO) Dependcy file: $(CLRRST)
986 @type $(TARGET_DEPEND)
[9031]987!endif
[9281]988!endif
[9090]989!ifdef SUBDIRS_DEP
990 @$(TOOL_DODIRS) "$(SUBDIRS_DEP)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
991!else
[9275]992! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_BINARY)$(SUBDIRS_MISC)" != ""
993 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_BINARY) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
[9090]994! endif
[9031]995!endif
[9090]996!ifdef PREMAKEFILES_DEP
997 @$(TOOL_DOMAKES) "$(PREMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
998!else
[9275]999! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_BINARY)$(PREMAKEFILES_MISC)" != ""
1000 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_BINARY) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
[9090]1001! endif
[8197]1002!endif
[9090]1003!ifdef POSTMAKEFILES_DEP
1004 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
1005!else
[9275]1006! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_BINARY)$(POSTMAKEFILES_MISC)" != ""
1007 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_BINARY) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
[9090]1008! endif
[8197]1009!endif
1010
1011
[8253]1012
1013# -----------------------------------------------------------------------------
[9090]1014# Pass 2 - The needed rule - Make need tools.
1015# That is tools and stuff that is required for the next passes.
1016# WARNING! These tools and stuff shouldn't rely on libraries and other
1017# results of later passes.
[8253]1018# -----------------------------------------------------------------------------
[9090]1019!ifdef SUBDIRS_NEEDED
1020_SUBDIRS_NEEDED = _subdir_needed
1021$(_SUBDIRS_NEEDED):
1022 @$(TOOL_DODIRS) "$(SUBDIRS_NEEDED)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
1023!else
1024! ifdef SUBDIRS
1025_SUBDIRS_NEEDED = _subdir_needed
1026$(_SUBDIRS_NEEDED):
1027 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
1028! endif
1029!endif
1030
1031!ifdef PREMAKEFILES_NEEDED
1032_PREMAKEFILES_NEEDED = _premakefiles_needed
1033$(_PREMAKEFILES_NEEDED):
1034 @$(TOOL_DOMAKES) "$(PREMAKEFILES_NEEDED)" $(TOOL_MAKE) needed
1035!else
1036! ifdef PREMAKEFILES
1037_PREMAKEFILES_NEEDED = _premakefiles_needed
1038$(_PREMAKEFILES_NEEDED):
1039 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) needed
1040! endif
1041!endif
1042
[9127]1043!ifdef TARGET_NEEDED
[9090]1044needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED) target
1045!else
1046needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED)
1047!endif
1048!ifdef POSTMAKEFILES_NEEDED
1049 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_NEEDED)" $(TOOL_MAKE) $@
1050!else
1051! ifdef POSTMAKEFILES
1052 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1053! endif
1054!endif
1055
1056
1057
1058# -----------------------------------------------------------------------------
1059# Pass 3 - The lib rule - Make libraries.
1060# -----------------------------------------------------------------------------
1061!ifdef SUBDIRS_LIB
1062_SUBDIRS_LIB = _subdir_lib
1063$(_SUBDIRS_LIB):
1064 @$(TOOL_DODIRS) "$(SUBDIRS_LIB)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
1065!else
1066! ifdef SUBDIRS
1067_SUBDIRS_LIB = _subdir_lib
1068$(_SUBDIRS_LIB):
[8423]1069 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
[9090]1070! endif
[8197]1071!endif
1072
[9090]1073!ifdef PREMAKEFILES_LIB
1074_PREMAKEFILES_LIB = _premakefiles_lib
1075$(_PREMAKEFILES_LIB):
1076 @$(TOOL_DOMAKES) "$(PREMAKEFILES_LIB)" $(TOOL_MAKE) lib
1077!else
1078! ifdef PREMAKEFILES
1079_PREMAKEFILES_LIB = _premakefiles_lib
1080$(_PREMAKEFILES_LIB):
[8197]1081 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
[9090]1082! endif
[8197]1083!endif
1084
[9090]1085lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
[9127]1086!if !defined(TARGET_NEEDED) && ("$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB")
1087 $(TARGET) $(_TARGET_EARLY_PUBLISH) \
[9031]1088!endif
1089 $(TARGET_ILIB)
[9090]1090!ifdef POSTMAKEFILES_LIB
1091 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
1092!else
1093! ifdef POSTMAKEFILES
[9031]1094 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]1095! endif
[9031]1096!endif
1097
1098
1099
1100# -----------------------------------------------------------------------------
[9275]1101# Pass 4 - The binary rule - Build the binary.
[9031]1102# -----------------------------------------------------------------------------
[9275]1103!ifdef SUBDIRS_BINARY
1104_SUBDIRS_BINARY = _subdir_binary
1105$(_SUBDIRS_BINARY):
1106 @$(TOOL_DODIRS) "$(SUBDIRS_BINARY)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) binary
[9090]1107!else
1108! ifdef SUBDIRS
[9275]1109_SUBDIRS_BINARY = _subdir_binary
1110$(_SUBDIRS_BINARY):
1111 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) binary
[9090]1112! endif
[9031]1113!endif
1114
[9275]1115!ifdef PREMAKEFILES_BINARY
1116_PREMAKEFILES_BINARY = _premakefiles_binary
1117$(_PREMAKEFILES_BINARY):
1118 @$(TOOL_DOMAKES) "$(PREMAKEFILES_BINARY)" $(TOOL_MAKE) binary
[9090]1119!else
1120! ifdef PREMAKEFILES
[9275]1121_PREMAKEFILES_BINARY = _premakefiles_binary
1122$(_PREMAKEFILES_BINARY):
1123 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) binary
[9090]1124! endif
[9031]1125!endif
1126
[9275]1127binary executable: \
[9127]1128!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && !defined(TARGET_NEEDED)
[9904]1129 $(_SUBDIRS_BINARY) $(_PREMAKEFILES_BINARY) $(TARGET) $(_TARGET_EARLY_PUBLISH) $(OTHERS)
[8290]1130!else
[9275]1131 $(_SUBDIRS_BINARY) $(_PREMAKEFILES_BINARY)
[8290]1132!endif
[9275]1133!ifdef POSTMAKEFILES_BINARY
1134 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_BINARY)" $(TOOL_MAKE) $@
[9090]1135!else
1136! ifdef POSTMAKEFILES
[8197]1137 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]1138! endif
[8197]1139!endif
1140
1141
[8253]1142
1143# -----------------------------------------------------------------------------
[9275]1144# Pass 5 - The misc(ellaneous) rule - Makes miscellaneous stuff like
1145# help, documentations etc. This is experimental for the moment.
[9031]1146# -----------------------------------------------------------------------------
[9090]1147!ifdef SUBDIRS_MISC
1148_SUBDIRS_MISC = _subdir_misc
[9178]1149$(_SUBDIRS_MISC):
[9275]1150 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) misc
[9090]1151!else
1152! ifdef SUBDIRS
1153_SUBDIRS_MISC = _subdir_misc
1154$(_SUBDIRS_MISC):
[9275]1155 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) misc
[9090]1156! endif
[9031]1157!endif
1158
[9090]1159!ifdef PREMAKEFILES_MISC
1160_PREMAKEFILES_MISC = _premakefiles_misc
[9031]1161$(PREMAKEFILES_MISC):
[9275]1162 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) misc
[9090]1163!else
1164! ifdef PREMAKEFILES
1165_PREMAKEFILES_MISC = _premakefiles_misc
1166$(_PREMAKEFILES_MISC):
[9275]1167 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) misc
[9090]1168! endif
[9031]1169!endif
1170
[9275]1171misc miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
1172 $(TARGET_BOOKS) $(TARGET_HELPS) $(TARGET_DOCS) $(TARGET_MISC)
1173!if "$(TARGET_BOOKS)$(TARGET_HELPS)$(TARGET_DOCS)$(TARGET_MISC)" != ""
1174 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_BOOKS) $(TARGET_HELPS) $(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
[9090]1175!endif
1176!ifdef POSTMAKEFILES_MISC
1177 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
[9031]1178!else
[9090]1179! ifdef POSTMAKEFILES
[9031]1180 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]1181! endif
[9031]1182!endif
1183
1184
1185
1186# -----------------------------------------------------------------------------
[9127]1187# Pass 6 - The publish rule - Copies target to main binary directory.
[8253]1188# Installation order is not concidered vital, so subdirectories and
[9127]1189# pre-makefiles are processed after this directory.
1190# However, this order might be changed!
[8253]1191# -----------------------------------------------------------------------------
[9127]1192!if "$(_TARGET_EARLY_PUBLISH)" != ""
1193publish:
1194!else
1195publish: publish_target
[8197]1196!endif
[9127]1197!ifdef SUBDIRS_PUBLISH
1198 @$(TOOL_DODIRS) "$(SUBDIRS_PUBLISH)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[9090]1199!else
1200! ifdef SUBDIRS
[8423]1201 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[9090]1202! endif
[8197]1203!endif
[9127]1204!ifdef PREMAKEFILES_PUBLISH
1205 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
[9090]1206!else
1207! ifdef PREMAKEFILES
[8197]1208 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
[9090]1209! endif
[8197]1210!endif
[9127]1211!ifdef POSTMAKEFILES_PUBLISH
1212 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
[9090]1213!else
1214! ifdef POSTMAKEFILES
[8197]1215 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]1216! endif
[8197]1217!endif
1218
[9135]1219
[9127]1220#
1221# Publish rule which doesn't go down into subdirs and submakes.
1222# This one is invoked when a target is 'needed' or early published.
1223#
1224publish_target:
1225!if "$(_TARGET_EARLY_PUBLISH)" != "" || "$(TARGET_MODE:LIB=cute)" == "$(TARGET_MODE)"
1226! if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
[9919]1227 @$(ECHO) Publishing $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR)$(CLRRST)
[9127]1228 @if not exist "$(TARGET)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1229 @if not exist "$(TARGET_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR)
1230 @if exist "$(TARGET)" $(TOOL_COPY) "$(TARGET)" "$(TARGET_PUB)"
1231 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR)"
[9919]1232! ifdef PUBLISH_MAP
1233 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB_DIR)"
1234! endif
[9127]1235! if "$(TARGET_PUB_DEB)" != ""
1236 @$(ECHO) Publishing unstripped $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR_DEB)$(CLRRST)
1237 @if not exist "$(_TARGET_DEB)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(_TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1238 @if not exist "$(TARGET_PUB_DIR_DEB)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR_DEB)
1239 @if exist "$(_TARGET_DEB)" $(TOOL_COPY) "$(_TARGET_DEB)" "$(TARGET_PUB_DEB)"
1240 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR_DEB)"
[9919]1241! ifdef PUBLISH_MAP
1242 @if exist "$(TARGET_MAP)" $(TOOL_COPY) "$(TARGET_MAP)" "$(TARGET_PUB_DIR_DEB)"
1243! endif
[9127]1244! endif
1245! endif
1246!endif
[9275]1247!if "$(TARGET_BOOKS)" != ""
1248 @$(ECHO) Publishing Book(s) $(CLRFIL)$(TARGET_BOOKS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_BOOK_PUB_DIR)$(CLRRST)
1249 @if not exist "$(TARGET_BOOK_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_BOOK_PUB_DIR)
1250 @$(TOOL_COPY) $(TARGET_BOOKS) $(TARGET_BOOK_PUB_DIR)
1251!endif
1252!if "$(TARGET_HELPS)" != ""
1253 @$(ECHO) Publishing Help file(s) $(CLRFIL)$(TARGET_HELPS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_HELP_PUB_DIR)$(CLRRST)
1254 @if not exist "$(TARGET_HELP_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_HELP_PUB_DIR)
1255 @$(TOOL_COPY) $(TARGET_HELPS) $(TARGET_HELP_PUB_DIR)
1256!endif
[9127]1257!if "$(TARGET_DOCS)" != ""
[9275]1258 @$(ECHO) Publishing Doc(s) $(CLRFIL)$(TARGET_DOCS)$(CLRTXT) to directory $(CLRFIL)$(TARGET_DOC_PUB_DIR)$(CLRRST)
1259 @if not exist "$(TARGET_DOC_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_DOC_PUB_DIR)
1260 @$(TOOL_COPY) $(TARGET_DOCS) $(TARGET_DOC_PUB_DIR)
[9127]1261!endif
[8197]1262
[8253]1263
[9127]1264
[9031]1265# -----------------------------------------------------------------------------
1266# Pass x - The testcase rule - Execute testcases when present.
1267# Testcases are either a testcase.mak file or a testcase subdirectory.
1268# -----------------------------------------------------------------------------
[8714]1269!if "$(TARGET_MODE)" != "TESTCASE"
1270!ifndef BUILD_OWN_TESTCASE_RULE
[9090]1271
[8714]1272!ifndef MAKEVER
1273_TESTCASE_TST1 = [$(TOOL_EXISTS) testcase] == 0
1274_TESTCASE_TST2 = [$(TOOL_EXISTS) testcase.mak] == 0
1275!else
1276_TESTCASE_TST1 = exists(testcase) != 0
1277_TESTCASE_TST2 = exists(testcase.mak) != 0
1278!endif
[9031]1279
[8290]1280testcase:
[9031]1281 @$(ECHO) Executing testcases $(CLRRST)
[8714]1282!if $(_TESTCASE_TST1)
[8423]1283 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]1284!endif
[8714]1285!if $(_TESTCASE_TST2)
[8197]1286 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
1287!endif
[9090]1288!ifdef SUBDIRS_TESTCASE
1289 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1290!else
1291! ifdef SUBDIRS
[8423]1292 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[9090]1293! endif
[8197]1294!endif
[9090]1295!ifdef PREMAKEFILES_TESTCASE
1296 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1297!else
1298! ifdef PREMAKEFILES
[8197]1299 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
[9090]1300! endif
[8197]1301!endif
[9090]1302!ifdef POSTMAKEFILES_TESTCASE
1303 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1304!else
1305! ifdef POSTMAKEFILES
[8197]1306 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]1307! endif
[8197]1308!endif
[9090]1309
1310!endif # BUILD_OWN_TESTCASE_RULE
[8714]1311!endif #!TESTCASE
[8197]1312
1313
[9178]1314# -----------------------------------------------------------------------------
1315# Pass x - The packing rule - traverse subdirs etc.
1316# -----------------------------------------------------------------------------
1317!ifdef SUBDIRS_PACKING
1318_SUBDIRS_PACKING = _subdir_packing
1319$(_SUBDIRS_PACKING):
1320 @$(TOOL_DODIRS) "$(SUBDIRS_PACKING)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1321!else
1322! ifdef SUBDIRS
1323_SUBDIRS_PACKING = _subdir_packing
1324$(_SUBDIRS_PACKING):
1325 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1326! endif
1327!endif
[8253]1328
[9178]1329!ifdef PREMAKEFILES_PACKING
1330_PREMAKEFILES_PACKING = _premakefiles_packing
1331$(PREMAKEFILES_PACKING):
1332 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PACKING)" $(TOOL_MAKE) packing
1333!else
1334! ifdef PREMAKEFILES
1335_PREMAKEFILES_PACKING = _premakefiles_packing
1336$(_PREMAKEFILES_PACKING):
1337 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) packing
1338! endif
1339!endif
1340
1341!if "$(RULE_PACKING)" == "packing"
1342_packing: \
1343!else
1344packing: \
1345!endif
1346 $(_SUBDIRS_PACKING) $(_PREMAKEFILES_PACKING) $(RULE_PACKING)
1347!ifdef POSTMAKEFILES_PACKING
1348 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PACKING)" $(TOOL_MAKE) $@
1349!else
1350! ifdef POSTMAKEFILES
1351 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1352! endif
1353!endif
1354 $(ECHO) .$(CLRRST)
1355
1356
1357
[8253]1358# -----------------------------------------------------------------------------
[9031]1359# The target rule - Build the target.
[9090]1360# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
[8298]1361# -----------------------------------------------------------------------------
[9904]1362target: $(TARGET) $(TARGET_ILIB) $(_TARGET_EARLY_PUBLISH) $(OTHERS)
[9127]1363!if "$(TARGET)$(TARGET_ILIB)" != ""
[9031]1364 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
[9127]1365!else
1366 @$(ECHO) .$(CLRRST)
1367!endif
[8197]1368
1369
[8253]1370
1371# -----------------------------------------------------------------------------
[9904]1372# Others (experimental)
1373# -----------------------------------------------------------------------------
1374others: $(OTHERS)
1375!if "$(OTHERS)" != ""
1376 @$(ECHO) Successfully Built $(OTHERS)$(CLRRST)
1377!else
1378 @$(ECHO) .$(CLRRST)
1379!endif
1380
1381
1382
1383# -----------------------------------------------------------------------------
[9031]1384# The shell rule - Setup the correcte shell environment and start a shell.
[8253]1385# -----------------------------------------------------------------------------
[9031]1386shell:
1387 @$(ECHO) Creating work shell $(CLRRST)
1388 \
1389!ifndef BUILD_VERBOSE
1390 @ \
[8197]1391!endif
[9031]1392 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1393 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
[8714]1394
1395
1396
1397# -----------------------------------------------------------------------------
1398# The nothing rule - Rule for testing the makefile structure.
1399# -----------------------------------------------------------------------------
1400nothing:
[9031]1401 @$(ECHO) Doing nothing in $(MAKEFILE).
[8714]1402!ifdef SUBDIRS
[8423]1403 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]1404!endif
1405!ifdef PREMAKEFILES
1406 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1407!endif
1408!ifdef POSTMAKEFILES
1409 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1410!endif
[8714]1411 @$(ECHO) Completed nothing in $(MAKEFILE).
[8197]1412
1413
[8253]1414
1415# -----------------------------------------------------------------------------
1416# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1417# -----------------------------------------------------------------------------
[8423]1418!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
[9240]1419$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF) $(TARGET_DEPS) $(TARGET_LIBS) \
1420 $(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
[8423]1421!if "$(TOOL_JOB_WAIT)" != ""
1422! ifndef BUILD_QUIET
[8714]1423 @$(ECHO) Waiting for jobs to complete $(CLRRST)
[8423]1424! endif
[8714]1425 \
[8423]1426! ifndef BUILD_VERBOSE
[8714]1427 @ \
[8423]1428! endif
[8714]1429 $(TOOL_JOB_WAIT)
[8423]1430!endif
[9225]1431!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1432! ifndef BUILD_QUIET
1433 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1434! endif
1435 \
1436! ifndef BUILD_VERBOSE
1437 @ \
1438! endif
1439 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$(TARGET_DEF) $(TARGET_DEF) $(TARGET_DEF_LINK)
1440!endif
1441!ifndef TOOL_DEFCONV
1442 @$(TOOL_ECHOTXT) Creating Linker Input File $(CLRRST)<<$(TARGET_LNK)
1443$(LINK_LNK1)
1444$(LINK_LNK2)
1445$(LINK_LNK3)
1446$(LINK_LNK4)
1447$(LINK_LNK5)
1448<<KEEP
1449!else
1450 @$(ECHO) Creating Linker Input File $(CLRRST) $(TARGET_LNK)
1451 @$(TOOL_RM) "$(TARGET_LNK)"
1452 \
[9240]1453! ifndef BUILD_VERBOSE
[9225]1454 @ \
1455! endif
1456 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $(TARGET_LNK) <<$(TARGET_LNK)2
1457$(LINK_LNK1)
1458$(LINK_LNK2)
1459$(LINK_LNK3)
1460$(LINK_LNK4)
1461$(LINK_LNK5)
1462<<keep
1463!endif
1464!ifdef BUILD_VERBOSE
1465 @type $(TARGET_LNK)
1466!endif
[8197]1467 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
[8714]1468 \
[8290]1469!ifndef BUILD_VERBOSE
1470 @ \
1471!endif
[8197]1472!ifdef TARGET_IGNORE_LINKER_WARNINGS
1473 -4 \
1474!endif
1475!if "$(TARGET_MODE)" == "EXE"
[8253]1476 $(LINK_CMD_EXE)
[8197]1477!endif
[8423]1478!if "$(TARGET_MODE)" == "DLL"
[8290]1479 $(LINK_CMD_DLL)
[8197]1480!endif
1481!if "$(TARGET_MODE)" == "SYS"
[8290]1482 $(LINK_CMD_SYS)
[8197]1483!endif
[8213]1484!if "$(TARGET_MODE)" == "IFS"
[8290]1485 $(LINK_CMD_IFS)
[8213]1486!endif
[8290]1487!if "$(TARGET_MODE)" == "VDD"
1488 $(LINK_CMD_VDD)
1489!endif
[8197]1490!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1491 @$(ECHO) Linking Resources $(CLRRST)
[8714]1492 \
[8290]1493! ifndef BUILD_VERBOSE
1494 @ \
1495! endif
[10155]1496 $(RL) $(RL_FLAGS) $(TARGET_RES) $(RL_EXE_OUT)$@
[8197]1497!endif
1498!if "$(TARGET_DLLRNAME)" != ""
1499 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
[8714]1500 \
[8290]1501! ifndef BUILD_VERBOSE
1502 @ \
1503! endif
[8197]1504 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1505!endif
[8333]1506!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
[8714]1507 \
[8333]1508! ifndef BUILD_VERBOSE
1509 @ \
1510! endif
1511 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1512!endif
[9127]1513!if "$(BUILD_MODE)" == "RELEASE"
1514 \
1515! ifndef BUILD_VERBOSE
1516 @ \
1517! endif
1518 $(TOOL_COPY) "$@" "$(_TARGET_DEB)"
1519! if "$(TOOL_STRIP)" != ""
1520 \
1521! ifndef BUILD_VERBOSE
1522 @ \
1523! endif
1524 $(TOOL_STRIP) $@
1525! endif
1526!endif
[8197]1527
[8362]1528!endif
[8333]1529
1530
[8253]1531# -----------------------------------------------------------------------------
[8290]1532# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
[8253]1533# -----------------------------------------------------------------------------
[8290]1534!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
[8197]1535$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
[8423]1536!if "$(TOOL_JOB_WAIT)" != ""
1537! ifndef BUILD_QUIET
1538 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1539! endif
[8714]1540 \
[8423]1541! ifndef BUILD_VERBOSE
1542 @ \
1543! endif
1544 $(TOOL_JOB_WAIT)
1545!endif
[8197]1546 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
[8290]1547!ifndef BUILD_VERBOSE
[9044]1548 @$(TOOL_RM) "$@"
[8290]1549 @$(AR_CMD)
1550!else
[9044]1551 $(TOOL_RM) "$@"
[8197]1552 $(AR_CMD)
[8290]1553!endif
[8197]1554
1555
1556#
1557# Lib parameter file.
1558#
[9240]1559$(TARGET_LNK): $(MAKEFILE) $(MAKE_INCLUDE_SETUP) $(MAKE_INCLUDE_AR_SETUP) $(PATH_ROOT)\$(BUILD_SETUP_MAK)
[9116]1560 @$(TOOL_ECHOTXT) Creating Lib Input File $(CLRRST)<<$@
[8197]1561$(AR_LNK1)
1562$(AR_LNK2)
1563$(AR_LNK3)
1564$(AR_LNK4)
1565$(AR_LNK5)
1566<<KEEP
[8423]1567!ifdef BUILD_VERBOSE
1568 @type $@
[8197]1569!endif
[8423]1570!endif
[8197]1571
1572
[9031]1573# -----------------------------------------------------------------------------
1574# The $(TARGET) rule - For DEPEND targets.
[8253]1575# -----------------------------------------------------------------------------
[9028]1576!if "$(TARGET_MODE)" == "DEPEND"
1577$(TARGET):
1578 @$(ECHO) .
[8197]1579!endif
1580
1581
[8253]1582
1583# -----------------------------------------------------------------------------
1584# The $(TARGET_ILIB) rule - Make import library.
1585# -----------------------------------------------------------------------------
1586!ifdef TARGET_ILIB
[9240]1587$(TARGET_ILIB): $(TARGET_IDEF) $(MAKEFILE) $(MAKE_INCLUDE_SETUP) $(MAKE_INCLUDE_AR_SETUP) $(PATH_MAKE)\setup.tools.mk
[8253]1588 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
[8714]1589 \
[8290]1590!ifndef BUILD_VERBOSE
[9065]1591 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1592!endif
1593 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1594 \
1595!ifndef BUILD_VERBOSE
[8290]1596 @ \
1597!endif
[8253]1598 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
[9116]1599
1600
1601#
1602# Conversion rule for converting the .def file before passing along to implib.
1603#
1604! if "$(TARGET_IDEF_ORG)" != "" && "$(TARGET_IDEF_ORG)" != "$(TARGET_IDEF)"
1605$(TARGET_IDEF): $(TARGET_IDEF_ORG)
1606 @$(ECHO) Making Import Definition File $(CLRFIL)$@ $(CLRRST)
1607 \
1608!ifndef BUILD_VERBOSE
1609 @if not exist $(@D) $(ECHO) Target .def path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
[8253]1610!endif
[9116]1611 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1612 \
1613!ifndef BUILD_VERBOSE
1614 @ \
1615!endif
1616 $(TOOL_IDEFCONV) $(TOOL_IDEFCONV_FLAGS) $(TARGET_IDEF_ORG) $@
1617! endif
[8253]1618
[9116]1619!endif
[8253]1620
1621
[9116]1622
[8253]1623# -----------------------------------------------------------------------------
1624# The .force rule - Force a remake of something everytime.
1625# -----------------------------------------------------------------------------
1626.force:
[8290]1627!ifndef BUILD_VERBOSE
[8253]1628 @$(ECHO) .
[8290]1629!else
1630 @$(ECHO) . (force) .
1631!endif
[8253]1632
1633
1634
1635# -----------------------------------------------------------------------------
1636# Read Dependencies.
1637# -----------------------------------------------------------------------------
[9028]1638!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
[8714]1639!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
[8253]1640
[8197]1641#
[8253]1642# Read dependency file for current directory
[8197]1643#
[8714]1644!ifndef MAKEVER
1645! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1646! ifdef BUILD_VERBOSE
1647! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1648! endif
[8197]1649! endif
[8714]1650! include $(TARGET_DEPEND)
1651! else
[9062]1652#! ifndef NODEP
1653#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1654#! endif
1655#! endif
[8253]1656! endif
[8714]1657!else
1658! if %exists($(TARGET_DEPEND)) != 0
1659! ifdef BUILD_VERBOSE
1660$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1661! endif
1662! include $(TARGET_DEPEND)
1663! else
[9062]1664#! ifndef NODEP
1665#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1666#! endif
[8714]1667! endif
[8253]1668!endif
1669
1670
1671#
1672# Read global dependency files.
1673#
1674!ifdef BUILD_DEPEND1
[8714]1675! ifndef MAKEVER
1676! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1677! ifdef BUILD_VERBOSE
1678! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1679! endif
[8253]1680! endif
[8714]1681! include $(BUILD_DEPEND1)
1682! else
1683! ifndef NODEP
[8253]1684! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
[8197]1685! endif
[8714]1686! endif
[8197]1687! endif
[8714]1688! else
1689! if %exists($(BUILD_DEPEND1)) != 0
1690! ifdef BUILD_VERBOSE
1691$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1692! endif
1693! include $(BUILD_DEPEND1)
1694! else
1695! ifndef NODEP
1696$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1697! endif
1698! endif
[8197]1699! endif
1700!endif
1701
[8714]1702
[8253]1703!ifdef BUILD_DEPEND2
[8714]1704! ifndef MAKEVER
1705! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1706! ifdef BUILD_VERBOSE
1707! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1708! endif
[8253]1709! endif
[8714]1710! include $(BUILD_DEPEND2)
1711! else
1712! ifndef NODEP
[8253]1713! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1714! endif
[8714]1715! endif
[8253]1716! endif
[8714]1717! else
1718! if %exists($(BUILD_DEPEND2)) != 0
1719! ifdef BUILD_VERBOSE
1720$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1721! endif
1722! include $(BUILD_DEPEND2)
1723! else
1724! ifndef NODEP
1725$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1726! endif
1727! endif
[8253]1728! endif
1729!endif
[8197]1730
1731
[8253]1732!ifdef BUILD_DEPEND3
[8714]1733! ifndef MAKEVER
1734! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1735! ifdef BUILD_VERBOSE
1736! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1737! endif
[8253]1738! endif
[8714]1739! include $(BUILD_DEPEND3)
1740! else
1741! ifndef NODEP
[8253]1742! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1743! endif
[8714]1744! endif
[8253]1745! endif
[8714]1746! else
1747! if %exists($(BUILD_DEPEND3)) != 0
1748! ifdef BUILD_VERBOSE
1749$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1750! endif
1751! include $(BUILD_DEPEND3)
1752! else
1753! ifndef NODEP
1754$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1755! endif
1756! endif
[8253]1757! endif
1758!endif
1759
1760
1761!endif
1762
[8423]1763
1764#
1765# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1766#
1767!if "$(BUILD_MULTIJOBS)" != ""
1768! if [$(TOOL_JOB_UP)] != 0
1769! if "$(BUILD_QUITE)" == ""
[8714]1770! ifndef MAKEVER
1771! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1772! endif
1773! else
1774$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
[8423]1775! endif
1776! endif
1777! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
[8714]1778! ifndef MAKEVER
1779! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1780! endif
1781! error
1782!else
1783! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1784!endif
[8423]1785! endif
1786! endif
1787!endif
1788
[8714]1789!endif #!TESTCASE
[9178]1790
1791
1792#
1793# Include system library dependency stubs.
1794#
1795!include $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)libs.mk
1796
1797
1798#
1799# Check if TARGET_ALWAYS needs to be forced built.
1800#
1801!if "$(TARGET_ALWAYS)" != ""
1802! ifndef BUILD_FORCED_BUILD_TEST
[9188]1803! if [$(TOOL_MAKE) BUILD_FORCED_BUILD_TEST=1 -f $(MAKEFILE) -q $(TARGET) $(TARGET_ILIB) >nul 2>nul] != 0
[9178]1804$(TARGET_ALWAYS): .force
1805! endif
1806! endif
1807!endif
1808
Note: See TracBrowser for help on using the repository browser.