source: trunk/make/process.mak@ 9116

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