source: trunk/make/process.mak@ 10438

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

PUB2

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