source: trunk/make/process.mak@ 9090

Last change on this file since 9090 was 9090, checked in by bird, 23 years ago

-Implemented a 'needed' pass to make required tools like code generators etc.
-Made SUBDIRS and PRE/POSTMAKEFILES more customizable by adding _<rule>
overrides. This is good when you wanna skip a tree for a rule (=pass) or/and
just run do that rule (=pass) in a tree.
-Added check for TARGET_PRIVATE macro before installing anything.

File size: 39.6 KB
RevLine 
[9090]1# $Id: process.mak,v 1.21 2002-08-22 03:25:48 bird Exp $
[8197]2
3#
4# Unix-like tools for OS/2
5#
6# The common build process rules
7#
8# Note: this makefile is supposed to be included from the
9# current source path.
10#
11
12
[8253]13# -----------------------------------------------------------------------------
14# Assertions.
15# This makefile expects setup.mak and the specific setup to be included
16# already.
17# It also requires the TARGET_NAME to be specified in the makefile.
18# -----------------------------------------------------------------------------
[8714]19!if "$(MAKE_SETUP_INCLUDED)" != "YES"
20! ifndef MAKEVER
21! if [$(ECHO) $(CLRERR)Fatal error: You must include setup.mak before process.mak in the makefile.$(CLRRST)]
22! endif
23! error
24!else
25! error $(CLRERR)Fatal error: You must include setup.mak before process.mak in the makefile.$(CLRRST)
[8197]26!endif
[8714]27!endif
[8253]28!if "$(ENV_STATUS)" != "OK"
[8714]29! ifndef MAKEVER
30! if [$(ECHO) $(CLRERR)Fatal error: The environment is not valid. Bad setup.mak?$(CLRRST)]
31! endif
32! error
33! else
34! error $(CLRERR)Fatal error: The environment is not valid. Bad setup.mak?$(CLRRST)
[8423]35! endif
[8253]36!endif
[8197]37
[8423]38!if "$(TARGET_NAME)" == "" && "$(TARGET_MODE)" != "EMPTY"
[8714]39! ifndef MAKEVER
40! if [$(ECHO) $(CLRERR)Fatal error: TARGET_NAME is not defined! Should be set in the makefile.$(CLRRST)]
41! endif
42! error
43! else
44! error $(CLRERR)Fatal error: TARGET_NAME is not defined! Should be set in the makefile.$(CLRRST)
[8423]45! endif
[8253]46!endif
47
[8290]48!ifdef TARGET_MODE
49# Executable target mode.
50! if "$(TARGET_MODE)" != "EXE"
51# Dynamic Load Library target mode.
52! if "$(TARGET_MODE)" != "DLL"
53# Drive (/ system software) target mode.
[8423]54! if "$(TARGET_MODE)" != "SYS"
[8290]55# Installable File System Drive target mode. (Also called FSD, File System Driver.)
[8423]56! if "$(TARGET_MODE)" != "IFS"
[8290]57# Virtual Device Driver target mode.
[8423]58! if "$(TARGET_MODE)" != "VDD"
[8290]59# Object Library target mode.
[8423]60! if "$(TARGET_MODE)" != "LIB"
[8290]61# Object Library target mode - Special variant which is to be linked with a SYS target.
[8423]62! if "$(TARGET_MODE)" != "SYSLIB"
[8290]63# Object Library target mode - Special variant which is to be linked with an IFS target.
[8423]64! if "$(TARGET_MODE)" != "IFSLIB"
[8290]65# Dummy/Hub/TopLevel empty makefile. This has no target.
[8423]66! if "$(TARGET_MODE)" != "EMPTY"
[9028]67# Dependency only makefile. (typical for include directories)
68! if "$(TARGET_MODE)" != "DEPEND"
69# Testcase makefile.
70! if "$(TARGET_MODE)" != "TESTCASE"
71# Bad TARGET_MODE complain.
72! ifndef MAKEVER
73! if [$(ECHO) $(CLRERR)Fatal Error: Bad TARGET_MODE="$(TARGET_MODE)". Valid ones are: EXE, DLL, SYS, IFS, VDD, LIB, SYSLIB, IFSLIB, TESTCASE and EMPTY.$(CLRRST)]
74! endif
75! error
76! else
77! error $(CLRERR)Fatal Error: Bad TARGET_MODE="$(TARGET_MODE)". Valid ones are: EXE, DLL, SYS, IFS, VDD, LIB, SYSLIB, IFSLIB, TESTCASE and EMPTY.$(CLRRST)
[8714]78! endif
79! endif
[8290]80! endif
81! endif
82! endif
83! endif
84! endif
85! endif
86! endif
87! endif
88! endif
89! endif
90!endif
91
92
[8253]93# -----------------------------------------------------------------------------
94# Provide overridable defaults
95# -----------------------------------------------------------------------------
96
97# Default target mode is executable.
98!ifndef TARGET_MODE
99TARGET_MODE = EXE
100!endif
101
102# Default extension corresponds to the target mode.
103!ifndef TARGET_EXT
[8423]104! if "$(TARGET_MODE)" == "DLL"
[8253]105TARGET_EXT = $(EXT_DLL)
106! endif
107! if "$(TARGET_MODE)" == "SYS"
108TARGET_EXT = $(EXT_SYS)
109! endif
[8290]110! if "$(TARGET_MODE)" == "IFS"
111TARGET_EXT = $(EXT_IFS)
112! endif
113! if "$(TARGET_MODE)" == "VDD"
114TARGET_EXT = $(EXT_VDD)
115! endif
[8253]116! if "$(TARGET_MODE)" == "EXE"
117TARGET_EXT = $(EXT_EXE)
118! endif
[8290]119! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
[8253]120TARGET_EXT = $(EXT_LIB)
121! endif
122! if "$(TARGET_MODE)" == "EMPTY"
123TARGET_EXT = empty
124! endif
[9028]125! if "$(TARGET_MODE)" == "DEPEND"
126TARGET_EXT = depend
127! endif
[8714]128! if "$(TARGET_MODE)" == "TESTCASE"
129TARGET_EXT = testcase
130! endif
[8253]131! ifndef TARGET_EXT
[8714]132! ifndef MAKEVER
133! if [$(ECHO) $(CLRERR)Internal Error: TARGET_EXT not set. Probably invalid TARGET_MODE. (TARGET_MODE="$(TARGET_MODE)")$(CLRRST)]
134! endif
135! error
136! else
137! error $(CLRERR)Internal Error: TARGET_EXT not set. Probably invalid TARGET_MODE. (TARGET_MODE="$(TARGET_MODE)")$(CLRRST)
[8423]138! endif
[8253]139! endif
140!endif
141
142# Default target path. (where all the generated stuff for this target goes)
143!ifndef PATH_TARGET
144PATH_TARGET = $(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
145!endif
146
147# Default target file. (output)
[8197]148!ifndef TARGET
[8270]149! if "$(TARGET_MODE)" != "EMPTY"
[8714]150! if "$(TARGET_MODE)" != "TESTCASE"
[8253]151TARGET = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
[8714]152! else
153TARGET = testcase
154! endif
[8270]155! endif
[8197]156!endif
157
[8333]158# Default target .sym file. (output)
159!ifndef TARGET_SYM
160TARGET_SYM = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_SYM)
161!endif
[8270]162
[8253]163# Default object file. (output)
[8197]164!ifndef TARGET_OBJS
[8253]165TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
[8197]166!endif
167
[8253]168# Default libraries. (input)
[8197]169!ifndef TARGET_LIBS
[8253]170TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
[8197]171!endif
172
[8253]173# Default definition file. (input)
[8197]174!ifndef TARGET_DEF
[8253]175TARGET_DEF = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
[8197]176!endif
177
[8333]178# Default modified definition filename. (output)
179!ifndef TARGET_DEF_LINK
180TARGET_DEF_LINK = $(PATH_TARGET)\$(TARGET_NAME)_link.def
181!endif
182
[8253]183# Default definition file for generating the import library. (input)
[8197]184!ifndef TARGET_IDEF
[8253]185TARGET_IDEF = $(TARGET_DEF)
[8197]186!endif
187
[8253]188# Default map file. (output)
[8197]189!ifndef TARGET_MAP
[8333]190TARGET_MAP = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_MAP)
[8197]191!endif
192
[8253]193# Default link file. (output)
[8197]194!ifndef TARGET_LNK
[8253]195TARGET_LNK = $(PATH_TARGET)\$(TARGET_NAME).lnk
[8197]196!endif
197
[8253]198# Default import library file. (output)
199!ifndef TARGET_ILIB
[9090]200! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_ILIB_YES)" != ""
[8253]201TARGET_ILIB =$(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
202! endif
[8197]203!endif
204
[8290]205# Default public name. (output)
206!ifndef TARGET_PUBNAME
207TARGET_PUBNAME=
208! ifdef TARGET_PUBLIC
209! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
210TARGET_PUBNAME=$(PATH_LIB)\$(TARGET_NAME).$(TARGET_EXT)
211! endif
212! if "$(TARGET_MODE)" == "EXE"
213TARGET_PUBNAME=$(PATH_EXE)\$(TARGET_NAME).$(TARGET_EXT)
214! endif
[8423]215! if "$(TARGET_MODE)" == "DLL"
[8290]216TARGET_PUBNAME=$(PATH_DLL)\$(TARGET_NAME).$(TARGET_EXT)
217! endif
218! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
219TARGET_PUBNAME=$(PATH_SYS)\$(TARGET_NAME).$(TARGET_EXT)
220! endif
221! if "$(TARGET_MODE)" == "VDD"
222TARGET_PUBNAME=$(PATH_VDD)\$(TARGET_NAME).$(TARGET_EXT)
223! endif
[8253]224! endif
[8197]225!endif
[8253]226
227# Default depend filename.
228!ifndef TARGET_DEPEND
229TARGET_DEPEND = $(PATH_TARGET)\.depend
[8197]230!endif
231
[8423]232# Default makefile names.
233!ifndef BUILD_MAKEFILE
234BUILD_MAKEFILE = Makefile
235!endif
236
[8253]237# Default makefile name.
238!ifndef MAKEFILE
[8423]239MAKEFILE = $(BUILD_MAKEFILE)
[8197]240!endif
241
[8253]242# Ignore linker warnings for some target modes.
243!ifndef TARGET_IGNORE_LINKER_WARNINGS
[8423]244! if "$(TARGET_MODE)" == "DLL"
[8253]245TARGET_IGNORE_LINKER_WARNINGS = 1
246! endif
[8197]247!endif
248
249
[8253]250# Default stacksize
[8355]251# If 16bit: 8KB
252# Else (32bit): 64KB
[8197]253!ifndef TARGET_STACKSIZE
[8355]254! ifdef ENV_16BIT
[8197]255TARGET_STACKSIZE=0x2000
256! else
257TARGET_STACKSIZE=0x10000
258! endif
259!endif
260
[8253]261
262
263# -----------------------------------------------------------------------------
264# Tell user what we're building.
265# -----------------------------------------------------------------------------
266!ifndef BUILD_QUIET
[9044]267! if "$(TARGET)" != ""
268! ifndef MAKEVER
269! if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
270! endif
271! else
272$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)
[8714]273! endif
274! endif
[8197]275!endif
276
277
[8253]278# -----------------------------------------------------------------------------
279# Ensure the platform-specific target path exists
280# -----------------------------------------------------------------------------
281
282!if "$(TARGET_MODE)" != "EMPTY"
283! if "$(PATH_TARGET)" != ""
[8714]284! ifndef MAKEVER
285! if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
286! ifndef BUILD_QUIET
287! if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
288! endif
[8253]289! endif
[8714]290! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
291! if [$(ECHO) $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)]
292! endif
293! error
294! endif
[8253]295! endif
[8714]296! else
297! if %exist($(PATH_TARGET)) == 0
298! ifndef BUILD_QUIET
299$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
[8423]300! endif
[8714]301! else
302! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
303! error $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)
304! endif
[8253]305! endif
[8197]306! endif
307! endif
308!endif
[8253]309# not 100% sure about the != EMPTY stuff, but this is way faster.
[8197]310
311
312
[8253]313# -----------------------------------------------------------------------------
314# Common inference rules
315# -----------------------------------------------------------------------------
[8197]316.SUFFIXES:
[8714]317.SUFFIXES: .c .cpp .asm .$(EXT_OBJ) .$(EXT_RES) .rc .ii .s
[8197]318
[8714]319#
320# A workaround for SlickEdits inability to find the buggy files..
321# This makes the source filenames in the error listing have full path.
322# See setup.mak for compile command line.
323#
324_SRC = $<
325!ifdef SLKRUNS
326_SRC = $(PATH_CURRENT)\$<
327!endif
[8197]328
[8714]329
[8197]330# Assembling assembly source.
331.asm{$(PATH_TARGET)}.$(EXT_OBJ):
[8714]332 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
333 \
[8423]334! ifndef BUILD_VERBOSE
[8290]335 @ \
[8423]336! endif
[8213]337!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
[8714]338 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$@
[8197]339!else
[8714]340 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$@
[8197]341!endif
342
343.asm.$(EXT_OBJ):
[8714]344 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRRST)
345 \
[8290]346!ifndef BUILD_VERBOSE
347 @ \
348!endif
[8213]349!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
[8714]350 $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
[8197]351!else
[8714]352 $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
[8197]353!endif
354
[8714]355# C++ Compiler base line
356_CXX_BASELINE = $(CXX) \
[8290]357!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]358 $(CXX_FLAGS_EXE) \
359!endif
360!if "$(TARGET_MODE)" == "DLL"
361 $(CXX_FLAGS_DLL) \
362!endif
363!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
364 $(CXX_FLAGS_SYS) \
365!endif
[8213]366!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
367 $(CXX_FLAGS_IFS) \
368!endif
[8714]369
370# Compiling C++ source.
371.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
372 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
373 \
374!ifndef BUILD_VERBOSE
375 @ \
376!endif
377 $(TOOL_JOB_SUB) $(_CXX_BASELINE) \
[8253]378!if "$(CXX_LST_OUT)" != ""
[8213]379 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
380!endif
[8714]381 $(CXX_OBJ_OUT)$@ $(_SRC)
[8197]382
383.cpp.$(EXT_OBJ):
[8714]384 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
385 \
[8290]386!ifndef BUILD_VERBOSE
387 @ \
388!endif
[8714]389 $(_CXX_BASELINE) \
[8253]390!if "$(CXX_LST_OUT)" != ""
[8213]391 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
392!endif
[8714]393 $(CXX_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
[8197]394
395
396# Pre-Compiling C++ source.
[8714]397.cpp.ii:
398 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
399 \
[8290]400!ifndef BUILD_VERBOSE
401 @ \
402!endif
[8714]403 $(_CXX_BASELINE) \
404 $(CXX_PC_2_STDOUT) $(_SRC) > $@
[8197]405
406
[8714]407# Compiler C++ source to assembly.
408!if "$(CXX_AS_2_FILE)" != ""
409.cpp.s:
410 @$(ECHO) C++ To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
411 \
[8290]412!ifndef BUILD_VERBOSE
413 @ \
414!endif
[8714]415 $(_CXX_BASELINE) \
416 $(CXX_AS_2_FILE)$@ $(_SRC)
417!endif
418
419
420
421# C Compiler base line
422_CC_BASELINE = $(CC) \
[8290]423!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]424 $(CC_FLAGS_EXE) \
425!endif
426!if "$(TARGET_MODE)" == "DLL"
427 $(CC_FLAGS_DLL) \
428!endif
429!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
430 $(CC_FLAGS_SYS) \
431!endif
[8213]432!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
433 $(CC_FLAGS_IFS) \
434!endif
[8714]435
436# Compiling C source.
437.c{$(PATH_TARGET)}.$(EXT_OBJ):
438 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
439 \
440!ifndef BUILD_VERBOSE
441 @ \
442!endif
443 $(TOOL_JOB_SUB) $(_CC_BASELINE) \
[8253]444!if "$(CC_LST_OUT)" != ""
[8213]445 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
446!endif
[8714]447 $(CC_OBJ_OUT)$@ $(_SRC)
[8197]448
449.c.$(EXT_OBJ):
[8714]450 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRRST)
451 \
[8290]452!ifndef BUILD_VERBOSE
453 @ \
454!endif
[8714]455 $(_CC_BASELINE) \
[8253]456!if "$(CC_LST_OUT)" != ""
[8213]457 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
458!endif
[8714]459 $(CC_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
[8197]460
461
462# Pre-Compiling C source.
[8714]463.c.ii:
464 @$(ECHO) C PreCompiler $(CLRFIL)$(_SRC) $(CLRRST)
465 \
[8290]466!ifndef BUILD_VERBOSE
467 @ \
468!endif
[8714]469 $(_CC_BASELINE) \
470 $(CC_PC_2_STDOUT) $(_SRC) > $@
471
472
473# Compiler C source to assembly.
474!if "$(CC_AS_2_FILE)" != ""
475.c.s:
476 @$(ECHO) C To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
477 \
478!ifndef BUILD_VERBOSE
479 @ \
[8197]480!endif
[8714]481 $(_CC_BASELINE) \
482 $(CC_AS_2_FILE)$@ $(_SRC)
[8197]483!endif
484
485
486# Compiling resources.
487.rc{$(PATH_TARGET)}.res:
[8714]488 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
489 \
[8290]490!ifndef BUILD_VERBOSE
491 @ \
492!endif
[8714]493 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $(_SRC) $@
[8197]494
495.rc.res:
[8714]496 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
497 \
[8290]498!ifndef BUILD_VERBOSE
499 @ \
500!endif
[8714]501 $(RC) $(RC_FLAGS) $(_SRC) $(PATH_TARGET)\$(@F)
[8197]502
503
[8253]504
505
506
507# -----------------------------------------------------------------------------
508# The all rule - The default one, as it's the first rule in the file.
509# -----------------------------------------------------------------------------
[8197]510all: build
511
512
[8253]513
514# -----------------------------------------------------------------------------
[9031]515# The build rule - This runs all passes:
516# 1. Make Dependencies
[9090]517# 2. Make Needed Tools (stuff required in the next steps)
518# 3. Make Libraries (all kinds)
519# 4. Make Executables
520# 5. Make Miscellaneous Targets
521# 6. Make Install
[9031]522# Note: In order to load dependencies we'll do a forwarding after making them.
[8253]523# -----------------------------------------------------------------------------
[9031]524build: _build
525!if "$(MAKEFLAGS:I=_)" == "$(MAKEFLAGS)" # this is of course broken in nmake v5.0 for OS/2.
526 @$(ECHO)$(CLRMAK)[Successfully Built Everything!] $(CLRRST)
527!else
528 @$(ECHO)$(CLRMAK)[Built Everything! (Ignore option specified)] $(CLRRST)
529!endif
530
531# internal rule shared by rebuild and build.
532_build: _build_banner_dep dep
533!ifndef BUILD_QUIET
534 @$(ECHO) Restarting $(CLRFIL)$(MAKEFILE)$(CLRTXT) with new dependencies. $(CLRRST)
535!endif
536 \
537!ifndef BUILD_VERBOSE
538 @ \
539!endif
540 $(TOOL_MAKE) -f $(MAKEFILE) _build_new_dependencies_
541
542# internal rule used to reload dependencies.
543_build_new_dependencies_: \
[9090]544 _build_banner_needed needed \
[9031]545 _build_banner_lib lib \
546 _build_banner_executable executable \
547 _build_banner_miscellaneous miscellaneous \
548 _build_banner_install install
549
550# Banners for rebuild and build.
551_build_banner_clean:
552 @$(ECHO)$(CLRMAK)[Start Pass 0 - Make Clean] $(CLRRST)
553 @SET _BUILD_PASS=0
554_build_banner_dep:
555 @$(ECHO)$(CLRMAK)[Start Pass 1 - Make Dependencies] $(CLRRST)
556 @SET _BUILD_PASS=1
[9090]557_build_banner_needed:
558 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
559 @SET _BUILD_PASS=2
[9031]560_build_banner_lib:
[9090]561 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
562 @SET _BUILD_PASS=3
[9031]563_build_banner_executable:
[9090]564 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Executables] $(CLRRST)
565 @SET _BUILD_PASS=4
[9031]566_build_banner_miscellaneous:
[9090]567 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
568 @SET _BUILD_PASS=5
[9031]569_build_banner_install:
[9090]570 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Install] $(CLRRST)
571 @SET _BUILD_PASS=6
[9031]572
573
574
575# -----------------------------------------------------------------------------
576# The rebuild rule - Same as build but does a clean first (as Pass 0).
577# -----------------------------------------------------------------------------
578rebuild: \
579 _build_banner_clean clean \
580 _build
581!if "$(MAKEFLAGS:i=_)" == "$(MAKEFLAGS)"
582 @$(ECHO)$(CLRMAK)[Successfully Rebuilt Everything!] $(CLRRST)
583!else
584 @$(ECHO)$(CLRMAK)[Rebuilt Everything! (Ignore option specified)] $(CLRRST)
585!endif
586
587
588
589# -----------------------------------------------------------------------------
590# Pass 0 - The clean rule - Clean up output files.
591# The current setup doesn't clean the installed ones.
592# -----------------------------------------------------------------------------
593!if "$(TARGET_MODE)" != "TESTCASE"
594clean:
595 @$(ECHO) Cleaning... $(CLRRST)
596!if "$(PATH_TARGET)" != "" # paranoia
597 \
598! ifndef BUILD_VERBOSE
599 @ \
600! endif
601 $(TOOL_RM) \
[9062]602 $(PATH_TARGET)\*.$(EXT_OBJ) \
603 $(PATH_TARGET)\*.$(EXT_ILIB) \
604 $(PATH_TARGET)\*.$(EXT_EXE) \
605 $(PATH_TARGET)\*.$(EXT_DLL) \
606 $(PATH_TARGET)\*.$(EXT_RES)
[9031]607 \
608! ifndef BUILD_VERBOSE
609 @ \
610! endif
611 $(TOOL_RM) \
[9062]612 $(PATH_TARGET)\*.$(EXT_SYS) \
613 $(PATH_TARGET)\*.$(EXT_LIB) \
614 $(PATH_TARGET)\*.$(EXT_IFS) \
615 $(PATH_TARGET)\*.$(EXT_MAP) \
616 $(PATH_TARGET)\*.$(EXT_SYM)
[9031]617 \
618! ifndef BUILD_VERBOSE
619 @ \
620! endif
621 $(TOOL_RM) \
[9062]622 $(PATH_TARGET)\*.s \
623 $(PATH_TARGET)\*.lst \
624 $(PATH_TARGET)\*.lnk \
625 $(PATH_TARGET)\*.ii \
626 $(PATH_TARGET)\.depend"
[9031]627 \
628! ifndef BUILD_VERBOSE
629 @ \
630! endif
631 $(TOOL_RM) \
[9062]632 .\*.ii \
633 .\*.err \
634 .\.depend
[9031]635!endif
[9090]636!ifdef SUBDIRS_CLEAN
637 @$(TOOL_DODIRS) "$(SUBDIRS_CLEAN)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
638!else
639! ifdef SUBDIRS
640 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
641! endif
[8197]642!endif
[9090]643!ifdef PREMAKEFILES_CLEAN
644 @$(TOOL_DOMAKES) "$(PREMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
645!else
646! ifdef PREMAKEFILES
647 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
648! endif
[9031]649!endif
[9090]650!ifdef POSTMAKEFILES_CLEAN
651 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
652!else
653! ifdef POSTMAKEFILES
654 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
655! endif
[9031]656!endif
[9090]657
[9031]658!endif #!TESTCASE
[8197]659
[9031]660
661
662# -----------------------------------------------------------------------------
663# Pass 1 - The dep rule - Make dependencies.
664# -----------------------------------------------------------------------------
665dep:
[9044]666!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
[9031]667 @$(ECHO) Making dependencies... $(CLRRST)
668 \
[9044]669! ifndef BUILD_VERBOSE
[9031]670 @ \
[9044]671! endif
[9031]672 $(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
673! ifdef TARGET_NO_DEP
674 -x$(TARGET_NO_DEP: =;)\
675! endif
676 $(TOOL_DEP_FILES)
677!endif
[9090]678!ifdef SUBDIRS_DEP
679 @$(TOOL_DODIRS) "$(SUBDIRS_DEP)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
680!else
681! ifdef SUBDIRS
682 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
683! endif
[9031]684!endif
[9090]685!ifdef PREMAKEFILES_DEP
686 @$(TOOL_DOMAKES) "$(PREMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
687!else
688! ifdef PREMAKEFILES
689 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
690! endif
[8197]691!endif
[9090]692!ifdef POSTMAKEFILES_DEP
693 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
694!else
695! ifdef POSTMAKEFILES
696 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
697! endif
[8197]698!endif
699
700
[8253]701
702# -----------------------------------------------------------------------------
[9090]703# Pass 2 - The needed rule - Make need tools.
704# That is tools and stuff that is required for the next passes.
705# WARNING! These tools and stuff shouldn't rely on libraries and other
706# results of later passes.
[8253]707# -----------------------------------------------------------------------------
[9090]708!ifdef SUBDIRS_NEEDED
709_SUBDIRS_NEEDED = _subdir_needed
710$(_SUBDIRS_NEEDED):
711 @$(TOOL_DODIRS) "$(SUBDIRS_NEEDED)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
712!else
713! ifdef SUBDIRS
714_SUBDIRS_NEEDED = _subdir_needed
715$(_SUBDIRS_NEEDED):
716 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
717! endif
718!endif
719
720!ifdef PREMAKEFILES_NEEDED
721_PREMAKEFILES_NEEDED = _premakefiles_needed
722$(_PREMAKEFILES_NEEDED):
723 @$(TOOL_DOMAKES) "$(PREMAKEFILES_NEEDED)" $(TOOL_MAKE) needed
724!else
725! ifdef PREMAKEFILES
726_PREMAKEFILES_NEEDED = _premakefiles_needed
727$(_PREMAKEFILES_NEEDED):
728 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) needed
729! endif
730!endif
731
732!if "$(TARGET_NEEDED)" != ""
733needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED) target
734!else
735needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED)
736!endif
737!ifdef POSTMAKEFILES_NEEDED
738 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_NEEDED)" $(TOOL_MAKE) $@
739!else
740! ifdef POSTMAKEFILES
741 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
742! endif
743!endif
744
745
746
747# -----------------------------------------------------------------------------
748# Pass 3 - The lib rule - Make libraries.
749# -----------------------------------------------------------------------------
750!ifdef SUBDIRS_LIB
751_SUBDIRS_LIB = _subdir_lib
752$(_SUBDIRS_LIB):
753 @$(TOOL_DODIRS) "$(SUBDIRS_LIB)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
754!else
755! ifdef SUBDIRS
756_SUBDIRS_LIB = _subdir_lib
757$(_SUBDIRS_LIB):
[8423]758 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
[9090]759! endif
[8197]760!endif
761
[9090]762!ifdef PREMAKEFILES_LIB
763_PREMAKEFILES_LIB = _premakefiles_lib
764$(_PREMAKEFILES_LIB):
765 @$(TOOL_DOMAKES) "$(PREMAKEFILES_LIB)" $(TOOL_MAKE) lib
766!else
767! ifdef PREMAKEFILES
768_PREMAKEFILES_LIB = _premakefiles_lib
769$(_PREMAKEFILES_LIB):
[8197]770 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
[9090]771! endif
[8197]772!endif
773
[9090]774lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
[9031]775!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
776 $(TARGET) $(TARGET_PUBNAME) \
777!endif
778 $(TARGET_ILIB)
[9090]779!ifdef POSTMAKEFILES_LIB
780 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
781!else
782! ifdef POSTMAKEFILES
[9031]783 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]784! endif
[9031]785!endif
786
787
788
789# -----------------------------------------------------------------------------
[9090]790# Pass 4 - The executable rule - Build the executables.
[9031]791# -----------------------------------------------------------------------------
[9090]792!ifdef SUBDIRS_EXECUTABLE
793_SUBDIRS_EXECUTABLE = _subdir_executable
794$(_SUBDIRS_EXECUTABLE):
795 @$(TOOL_DODIRS) "$(SUBDIRS_EXECUTABLE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
796!else
797! ifdef SUBDIRS
798_SUBDIRS_EXECUTABLE = _subdir_executable
799$(_SUBDIRS_EXECUTABLE):
[9031]800 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
[9090]801! endif
[9031]802!endif
803
[9090]804!ifdef PREMAKEFILES_EXECUTABLE
805_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
806$(_PREMAKEFILES_EXECUTABLE):
807 @$(TOOL_DOMAKES) "$(PREMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) executable
808!else
809! ifdef PREMAKEFILES
810_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
811$(_PREMAKEFILES_EXECUTABLE):
[9031]812 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) executable
[9090]813! endif
[9031]814!endif
815
816executable: \
[9090]817!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && "$(TARGET_NEEDED)" == ""
818 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE) $(TARGET) $(TARGET_PUBNAME)
[9044]819! if "$(TARGET)" != ""
[9031]820 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET)$(CLRRST)
[9044]821! endif
[8290]822!else
[9090]823 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE)
[8290]824!endif
[9090]825!ifdef POSTMAKEFILES_EXECUTABLE
826 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) $@
827!else
828! ifdef POSTMAKEFILES
[8197]829 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]830! endif
[8197]831!endif
832
833
[8253]834
835# -----------------------------------------------------------------------------
[9090]836# Pass 5 - The miscellaneous rule - Makes other miscellaneous stuff like
[9031]837# documentations etc. This is experimental for the moment.
838# -----------------------------------------------------------------------------
[9090]839!ifdef SUBDIRS_MISC
840_SUBDIRS_MISC = _subdir_misc
[9031]841$(SUBDIRS_MISC):
[9090]842 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
843!else
844! ifdef SUBDIRS
845_SUBDIRS_MISC = _subdir_misc
846$(_SUBDIRS_MISC):
[9031]847 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
[9090]848! endif
[9031]849!endif
850
[9090]851!ifdef PREMAKEFILES_MISC
852_PREMAKEFILES_MISC = _premakefiles_misc
[9031]853$(PREMAKEFILES_MISC):
[9090]854 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) miscellaneous
855!else
856! ifdef PREMAKEFILES
857_PREMAKEFILES_MISC = _premakefiles_misc
858$(_PREMAKEFILES_MISC):
[9031]859 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) miscellaneous
[9090]860! endif
[9031]861!endif
862
[9090]863miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
[9031]864 $(TARGET_DOCS) $(TARGET_MISC)
865!if "$(TARGET_DOCS)$(TARGET_MISC)" != ""
866 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
[9090]867!endif
868!ifdef POSTMAKEFILES_MISC
869 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
[9031]870!else
[9090]871! ifdef POSTMAKEFILES
[9031]872 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]873! endif
[9031]874!endif
875
876
877
878# -----------------------------------------------------------------------------
[9090]879# Pass 6 - The install rule - Copies target to main binary directory.
[8253]880# Installation order is not concidered vital, so subdirectories and
881# pre-makefiles are processed after this directory. This might be changed.
882# -----------------------------------------------------------------------------
[8197]883install:
[9090]884!if "$(TARGET_PUBLIC)" == "" && "$(TARGET_PUBNAME)" == "" && "$(TARGET_PRIVATE)" == ""
[8290]885! if "$(TARGET_MODE)" == "EXE"
886 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_BIN)$(CLRRST)
887 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]888 @if not exist $(PATH_BIN) $(TOOL_CREATEPATH) $(PATH_BIN)
[8333]889 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_BIN)
890 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_BIN)
[8290]891! endif
[8423]892! if "$(TARGET_MODE)" == "DLL"
[8290]893 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_DLL)$(CLRRST)
894 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]895 @if not exist $(PATH_DLL) $(TOOL_CREATEPATH) $(PATH_DLL)
[8333]896 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_DLL)
897 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_DLL)
[8290]898! endif
899! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
900 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_SYS)$(CLRRST)
901 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]902 @if not exist $(PATH_SYS) $(TOOL_CREATEPATH) $(PATH_SYS)
[8333]903 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_SYS)
904 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_SYS)
[8290]905! endif
[8423]906!if 0 # these targets are either TARGET_PUBLIC or all private.
[8290]907! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
908 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_LIB)$(CLRRST)
909 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]910 @if not exist $(PATH_LIB) $(TOOL_CREATEPATH) $(PATH_LIB)
[8333]911 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_LIB)
912 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_LIB)
[8290]913! endif
914! endif
[8197]915!endif
916!if "$(TARGET_DOCS)" != ""
917 $(TOOL_COPY) $(TARGET_DOCS) $(PATH_DOC)
918!endif
[9090]919!ifdef SUBDIRS_INSTALL
920 @$(TOOL_DODIRS) "$(SUBDIRS_INSTALL)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
921!else
922! ifdef SUBDIRS
[8423]923 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[9090]924! endif
[8197]925!endif
[9090]926!ifdef PREMAKEFILES_INSTALL
927 @$(TOOL_DOMAKES) "$(PREMAKEFILES_INSTALL)" $(TOOL_MAKE) $@
928!else
929! ifdef PREMAKEFILES
[8197]930 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
[9090]931! endif
[8197]932!endif
[9090]933!ifdef POSTMAKEFILES_INSTALL
934 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_INSTALL)" $(TOOL_MAKE) $@
935!else
936! ifdef POSTMAKEFILES
[8197]937 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]938! endif
[8197]939!endif
940
941
[8253]942
[9031]943# -----------------------------------------------------------------------------
944# Pass x - The testcase rule - Execute testcases when present.
945# Testcases are either a testcase.mak file or a testcase subdirectory.
946# -----------------------------------------------------------------------------
[8714]947!if "$(TARGET_MODE)" != "TESTCASE"
948!ifndef BUILD_OWN_TESTCASE_RULE
[9090]949
[8714]950!ifndef MAKEVER
951_TESTCASE_TST1 = [$(TOOL_EXISTS) testcase] == 0
952_TESTCASE_TST2 = [$(TOOL_EXISTS) testcase.mak] == 0
953!else
954_TESTCASE_TST1 = exists(testcase) != 0
955_TESTCASE_TST2 = exists(testcase.mak) != 0
956!endif
[9031]957
[8290]958testcase:
[9031]959 @$(ECHO) Executing testcases $(CLRRST)
[8714]960!if $(_TESTCASE_TST1)
[8423]961 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]962!endif
[8714]963!if $(_TESTCASE_TST2)
[8197]964 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
965!endif
[9090]966!ifdef SUBDIRS_TESTCASE
967 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
968!else
969! ifdef SUBDIRS
[8423]970 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[9090]971! endif
[8197]972!endif
[9090]973!ifdef PREMAKEFILES_TESTCASE
974 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
975!else
976! ifdef PREMAKEFILES
[8197]977 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
[9090]978! endif
[8197]979!endif
[9090]980!ifdef POSTMAKEFILES_TESTCASE
981 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
982!else
983! ifdef POSTMAKEFILES
[8197]984 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
[9090]985! endif
[8197]986!endif
[9090]987
988!endif # BUILD_OWN_TESTCASE_RULE
[8714]989!endif #!TESTCASE
[8197]990
991
[8253]992
993# -----------------------------------------------------------------------------
[9031]994# The target rule - Build the target.
[9090]995# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
[8298]996# -----------------------------------------------------------------------------
[9090]997target: $(TARGET) $(TARGET_ILIB) $(TARGET_PUBNAME)
[9031]998 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
[8197]999
1000
[8253]1001
1002# -----------------------------------------------------------------------------
[9031]1003# The shell rule - Setup the correcte shell environment and start a shell.
[8253]1004# -----------------------------------------------------------------------------
[9031]1005shell:
1006 @$(ECHO) Creating work shell $(CLRRST)
1007 \
1008!ifndef BUILD_VERBOSE
1009 @ \
[8197]1010!endif
[9031]1011 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1012 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
[8714]1013
1014
1015
1016# -----------------------------------------------------------------------------
1017# The nothing rule - Rule for testing the makefile structure.
1018# -----------------------------------------------------------------------------
1019nothing:
[9031]1020 @$(ECHO) Doing nothing in $(MAKEFILE).
[8714]1021!ifdef SUBDIRS
[8423]1022 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]1023!endif
1024!ifdef PREMAKEFILES
1025 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1026!endif
1027!ifdef POSTMAKEFILES
1028 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1029!endif
[8714]1030 @$(ECHO) Completed nothing in $(MAKEFILE).
[8197]1031
1032
[8253]1033
1034# -----------------------------------------------------------------------------
1035# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1036# -----------------------------------------------------------------------------
[8423]1037!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
[8333]1038$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS)
[8423]1039!if "$(TOOL_JOB_WAIT)" != ""
1040! ifndef BUILD_QUIET
[8714]1041 @$(ECHO) Waiting for jobs to complete $(CLRRST)
[8423]1042! endif
[8714]1043 \
[8423]1044! ifndef BUILD_VERBOSE
[8714]1045 @ \
[8423]1046! endif
[8714]1047 $(TOOL_JOB_WAIT)
[8423]1048!endif
[8197]1049 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
[8714]1050 \
[8290]1051!ifndef BUILD_VERBOSE
1052 @ \
1053!endif
[8197]1054!ifdef TARGET_IGNORE_LINKER_WARNINGS
1055 -4 \
1056!endif
1057!if "$(TARGET_MODE)" == "EXE"
[8253]1058 $(LINK_CMD_EXE)
[8197]1059!endif
[8423]1060!if "$(TARGET_MODE)" == "DLL"
[8290]1061 $(LINK_CMD_DLL)
[8197]1062!endif
1063!if "$(TARGET_MODE)" == "SYS"
[8290]1064 $(LINK_CMD_SYS)
[8197]1065!endif
[8213]1066!if "$(TARGET_MODE)" == "IFS"
[8290]1067 $(LINK_CMD_IFS)
[8213]1068!endif
[8290]1069!if "$(TARGET_MODE)" == "VDD"
1070 $(LINK_CMD_VDD)
1071!endif
[8197]1072!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1073 @$(ECHO) Linking Resources $(CLRRST)
[8714]1074 \
[8290]1075! ifndef BUILD_VERBOSE
1076 @ \
1077! endif
1078 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
[8197]1079!endif
1080!if "$(TARGET_DLLRNAME)" != ""
1081 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
[8714]1082 \
[8290]1083! ifndef BUILD_VERBOSE
1084 @ \
1085! endif
[8197]1086 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1087!endif
[8333]1088!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
[8714]1089 \
[8333]1090! ifndef BUILD_VERBOSE
1091 @ \
1092! endif
1093 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1094!endif
[8197]1095
1096
1097#
1098# Linker parameter file.
1099#
1100$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
[8362]1101!ifndef TOOL_DEFCONV
[8714]1102 @$(TOOL_ECHO) Creating Linker Input File $(CLRRST)<<$@
[8197]1103$(LINK_LNK1)
1104$(LINK_LNK2)
1105$(LINK_LNK3)
1106$(LINK_LNK4)
1107$(LINK_LNK5)
1108<<KEEP
[8362]1109!else
1110 @$(ECHO) Creating Linker Input File $(CLRRST) $@
[9044]1111 @$(TOOL_RM) "$@"
[8714]1112 \
[8362]1113! ifdef BUILD_VERBOSE
1114 @ \
1115! endif
1116 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $@ <<$(TARGET_LNK)2
1117#
1118# LINK_LNK[1-5]:
1119#
1120$(LINK_LNK1)
1121$(LINK_LNK2)
1122$(LINK_LNK3)
1123$(LINK_LNK4)
1124$(LINK_LNK5)
1125<<keep
1126!endif
[8355]1127!ifdef BUILD_VERBOSE
1128 @type $@
1129!endif
[8333]1130
1131
1132#
1133# Builddef modified definition file.
1134#
1135!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1136$(TARGET_DEF_LINK): $(TARGET_DEF)
1137! ifndef BUILD_QUIET
1138 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1139! endif
[8714]1140 \
[8333]1141! ifndef BUILD_VERBOSE
1142 @ \
1143! endif
1144 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$** $** $@
[8290]1145!endif
[8197]1146
[8333]1147!endif
[8197]1148
[8333]1149
[8253]1150# -----------------------------------------------------------------------------
[8290]1151# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
[8253]1152# -----------------------------------------------------------------------------
[8290]1153!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
[8197]1154$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
[8423]1155!if "$(TOOL_JOB_WAIT)" != ""
1156! ifndef BUILD_QUIET
1157 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1158! endif
[8714]1159 \
[8423]1160! ifndef BUILD_VERBOSE
1161 @ \
1162! endif
1163 $(TOOL_JOB_WAIT)
1164!endif
[8197]1165 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
[8290]1166!ifndef BUILD_VERBOSE
[9044]1167 @$(TOOL_RM) "$@"
[8290]1168 @$(AR_CMD)
1169!else
[9044]1170 $(TOOL_RM) "$@"
[8197]1171 $(AR_CMD)
[8290]1172!endif
[8197]1173
1174
1175#
1176# Lib parameter file.
1177#
1178$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
[8714]1179 @$(TOOL_ECHO) Creating Lib Input File $(CLRRST)<<$@
[8197]1180$(AR_LNK1)
1181$(AR_LNK2)
1182$(AR_LNK3)
1183$(AR_LNK4)
1184$(AR_LNK5)
1185<<KEEP
[8423]1186!ifdef BUILD_VERBOSE
1187 @type $@
[8197]1188!endif
[8423]1189!endif
[8197]1190
1191
[9031]1192# -----------------------------------------------------------------------------
[8290]1193# Copy rule for public targets.
[9031]1194# Normally used for public libraries, but may be used for other purposes...
1195# -----------------------------------------------------------------------------
[8290]1196!if "$(TARGET_PUBNAME)" != ""
1197$(TARGET_PUBNAME): $(TARGET)
1198 @$(ECHO) Copying $(CLRFIL)$(TARGET)$(CLRTXT) to $(CLRFIL)$(@D)$(CLRRST)
[8714]1199 \
[8290]1200!ifndef BUILD_VERBOSE
[8423]1201 @if not exist $(@D) $(ECHO) Target public path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1202!endif
1203 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
[8714]1204 \
[8423]1205!ifndef BUILD_VERBOSE
[8290]1206 @ \
[8197]1207!endif
[8290]1208 $(TOOL_COPY) $** $@
[8333]1209 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(@R).sym
[8290]1210!endif
[8197]1211
1212
[8253]1213
1214# -----------------------------------------------------------------------------
[9031]1215# The $(TARGET) rule - For DEPEND targets.
[8253]1216# -----------------------------------------------------------------------------
[9028]1217!if "$(TARGET_MODE)" == "DEPEND"
1218$(TARGET):
1219 @$(ECHO) .
[8197]1220!endif
1221
1222
[8253]1223
1224# -----------------------------------------------------------------------------
1225# The $(TARGET_ILIB) rule - Make import library.
1226# -----------------------------------------------------------------------------
1227!ifdef TARGET_ILIB
1228$(TARGET_ILIB): $(TARGET_IDEF)
1229 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
[8714]1230 \
[8290]1231!ifndef BUILD_VERBOSE
[9065]1232 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1233!endif
1234 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1235 \
1236!ifndef BUILD_VERBOSE
[8290]1237 @ \
1238!endif
[8253]1239 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
1240!endif
1241
1242
1243
1244# -----------------------------------------------------------------------------
1245# The .force rule - Force a remake of something everytime.
1246# -----------------------------------------------------------------------------
1247.force:
[8290]1248!ifndef BUILD_VERBOSE
[8253]1249 @$(ECHO) .
[8290]1250!else
1251 @$(ECHO) . (force) .
1252!endif
[8253]1253
1254
1255
1256# -----------------------------------------------------------------------------
1257# Read Dependencies.
1258# -----------------------------------------------------------------------------
[9028]1259!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
[8714]1260!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
[8253]1261
[8197]1262#
[8253]1263# Read dependency file for current directory
[8197]1264#
[8714]1265!ifndef MAKEVER
1266! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1267! ifdef BUILD_VERBOSE
1268! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1269! endif
[8197]1270! endif
[8714]1271! include $(TARGET_DEPEND)
1272! else
[9062]1273#! ifndef NODEP
1274#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1275#! endif
1276#! endif
[8253]1277! endif
[8714]1278!else
1279! if %exists($(TARGET_DEPEND)) != 0
1280! ifdef BUILD_VERBOSE
1281$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1282! endif
1283! include $(TARGET_DEPEND)
1284! else
[9062]1285#! ifndef NODEP
1286#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1287#! endif
[8714]1288! endif
[8253]1289!endif
1290
1291
1292#
1293# Read global dependency files.
1294#
1295!ifdef BUILD_DEPEND1
[8714]1296! ifndef MAKEVER
1297! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1298! ifdef BUILD_VERBOSE
1299! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1300! endif
[8253]1301! endif
[8714]1302! include $(BUILD_DEPEND1)
1303! else
1304! ifndef NODEP
[8253]1305! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
[8197]1306! endif
[8714]1307! endif
[8197]1308! endif
[8714]1309! else
1310! if %exists($(BUILD_DEPEND1)) != 0
1311! ifdef BUILD_VERBOSE
1312$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1313! endif
1314! include $(BUILD_DEPEND1)
1315! else
1316! ifndef NODEP
1317$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1318! endif
1319! endif
[8197]1320! endif
1321!endif
1322
[8714]1323
[8253]1324!ifdef BUILD_DEPEND2
[8714]1325! ifndef MAKEVER
1326! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1327! ifdef BUILD_VERBOSE
1328! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1329! endif
[8253]1330! endif
[8714]1331! include $(BUILD_DEPEND2)
1332! else
1333! ifndef NODEP
[8253]1334! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1335! endif
[8714]1336! endif
[8253]1337! endif
[8714]1338! else
1339! if %exists($(BUILD_DEPEND2)) != 0
1340! ifdef BUILD_VERBOSE
1341$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1342! endif
1343! include $(BUILD_DEPEND2)
1344! else
1345! ifndef NODEP
1346$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1347! endif
1348! endif
[8253]1349! endif
1350!endif
[8197]1351
1352
[8253]1353!ifdef BUILD_DEPEND3
[8714]1354! ifndef MAKEVER
1355! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1356! ifdef BUILD_VERBOSE
1357! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1358! endif
[8253]1359! endif
[8714]1360! include $(BUILD_DEPEND3)
1361! else
1362! ifndef NODEP
[8253]1363! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1364! endif
[8714]1365! endif
[8253]1366! endif
[8714]1367! else
1368! if %exists($(BUILD_DEPEND3)) != 0
1369! ifdef BUILD_VERBOSE
1370$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1371! endif
1372! include $(BUILD_DEPEND3)
1373! else
1374! ifndef NODEP
1375$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1376! endif
1377! endif
[8253]1378! endif
1379!endif
1380
1381
1382!endif
1383
[8423]1384
1385#
1386# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1387#
1388!if "$(BUILD_MULTIJOBS)" != ""
1389! if [$(TOOL_JOB_UP)] != 0
1390! if "$(BUILD_QUITE)" == ""
[8714]1391! ifndef MAKEVER
1392! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1393! endif
1394! else
1395$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
[8423]1396! endif
1397! endif
1398! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
[8714]1399! ifndef MAKEVER
1400! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1401! endif
1402! error
1403!else
1404! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1405!endif
[8423]1406! endif
1407! endif
1408!endif
1409
[8714]1410!endif #!TESTCASE
Note: See TracBrowser for help on using the repository browser.