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
Line 
1# $Id: process.mak,v 1.22 2002-08-24 04:49:17 bird Exp $
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
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# -----------------------------------------------------------------------------
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)
26!endif
27!endif
28!if "$(ENV_STATUS)" != "OK"
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)
35! endif
36!endif
37
38!if "$(TARGET_NAME)" == "" && "$(TARGET_MODE)" != "EMPTY"
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)
45! endif
46!endif
47
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.
54! if "$(TARGET_MODE)" != "SYS"
55# Installable File System Drive target mode. (Also called FSD, File System Driver.)
56! if "$(TARGET_MODE)" != "IFS"
57# Virtual Device Driver target mode.
58! if "$(TARGET_MODE)" != "VDD"
59# Object Library target mode.
60! if "$(TARGET_MODE)" != "LIB"
61# Object Library target mode - Special variant which is to be linked with a SYS target.
62! if "$(TARGET_MODE)" != "SYSLIB"
63# Object Library target mode - Special variant which is to be linked with an IFS target.
64! if "$(TARGET_MODE)" != "IFSLIB"
65# Dummy/Hub/TopLevel empty makefile. This has no target.
66! if "$(TARGET_MODE)" != "EMPTY"
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)
78! endif
79! endif
80! endif
81! endif
82! endif
83! endif
84! endif
85! endif
86! endif
87! endif
88! endif
89! endif
90!endif
91
92
93# -----------------------------------------------------------------------------
94# Provide overridable defaults
95# -----------------------------------------------------------------------------
96
97# Default target mode is executable.
98!ifndef TARGET_MODE
99! if "$(BUILD_PROJECT)" != "Odin32"
100TARGET_MODE = EXE
101! else
102# Odin32 defaults.
103! ifndef CUSTOMBUILD
104TARGET_MODE = DLL
105! else
106TARGET_MODE = LIB
107! endif
108! endif
109!endif
110
111# Default extension corresponds to the target mode.
112!ifndef TARGET_EXT
113! if "$(TARGET_MODE)" == "DLL"
114TARGET_EXT = $(EXT_DLL)
115! endif
116! if "$(TARGET_MODE)" == "SYS"
117TARGET_EXT = $(EXT_SYS)
118! endif
119! if "$(TARGET_MODE)" == "IFS"
120TARGET_EXT = $(EXT_IFS)
121! endif
122! if "$(TARGET_MODE)" == "VDD"
123TARGET_EXT = $(EXT_VDD)
124! endif
125! if "$(TARGET_MODE)" == "EXE"
126TARGET_EXT = $(EXT_EXE)
127! endif
128! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
129TARGET_EXT = $(EXT_LIB)
130! endif
131! if "$(TARGET_MODE)" == "EMPTY"
132TARGET_EXT = empty
133! endif
134! if "$(TARGET_MODE)" == "DEPEND"
135TARGET_EXT = depend
136! endif
137! if "$(TARGET_MODE)" == "TESTCASE"
138TARGET_EXT = testcase
139! endif
140! ifndef TARGET_EXT
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)
147! endif
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)
157!ifndef TARGET
158! if "$(TARGET_MODE)" != "EMPTY"
159! if "$(TARGET_MODE)" != "TESTCASE"
160TARGET = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
161! else
162TARGET = testcase
163! endif
164! endif
165!endif
166
167# Default target .sym file. (output)
168!ifndef TARGET_SYM
169TARGET_SYM = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_SYM)
170!endif
171
172# Default object file. (output)
173!ifndef TARGET_OBJS
174TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
175!endif
176
177# Default libraries. (input)
178!ifndef TARGET_LIBS
179TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
180!endif
181
182# Default definition file. (input)
183!ifndef TARGET_DEF
184TARGET_DEF = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
185!endif
186
187# Default modified definition filename. (output)
188!ifndef TARGET_DEF_LINK
189TARGET_DEF_LINK = $(PATH_TARGET)\$(TARGET_NAME)_link.def
190!endif
191
192# Default definition file for generating the import library. (input)
193!ifndef TARGET_IDEF
194! if "$(BUILD_PROJECT)" != "Odin32"
195TARGET_IDEF = $(TARGET_DEF)
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
205!endif
206
207# Default map file. (output)
208!ifndef TARGET_MAP
209TARGET_MAP = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_MAP)
210!endif
211
212# Default link file. (output)
213!ifndef TARGET_LNK
214TARGET_LNK = $(PATH_TARGET)\$(TARGET_NAME).lnk
215!endif
216
217# Default import library file. (output)
218!ifndef TARGET_ILIB
219! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_ILIB_YES)" != ""
220TARGET_ILIB =$(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
221! endif
222!endif
223
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
234! if "$(TARGET_MODE)" == "DLL"
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
243! endif
244!endif
245
246# Default depend filename.
247!ifndef TARGET_DEPEND
248TARGET_DEPEND = $(PATH_TARGET)\.depend
249!endif
250
251# Default makefile names.
252!ifndef BUILD_MAKEFILE
253BUILD_MAKEFILE = Makefile
254!endif
255
256# Default makefile name.
257!ifndef MAKEFILE
258MAKEFILE = $(BUILD_MAKEFILE)
259!endif
260
261# Ignore linker warnings for some target modes.
262!ifndef TARGET_IGNORE_LINKER_WARNINGS
263! if "$(TARGET_MODE)" == "DLL"
264TARGET_IGNORE_LINKER_WARNINGS = 1
265! endif
266!endif
267
268
269# Default stacksize
270# If 16bit: 8KB
271# Else (32bit): 64KB
272!ifndef TARGET_STACKSIZE
273! ifdef ENV_16BIT
274TARGET_STACKSIZE=0x2000
275! else
276TARGET_STACKSIZE=0x10000
277! endif
278!endif
279
280
281
282# -----------------------------------------------------------------------------
283# Tell user what we're building.
284# -----------------------------------------------------------------------------
285!ifndef BUILD_QUIET
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)
292! endif
293! endif
294!endif
295
296
297# -----------------------------------------------------------------------------
298# Ensure the platform-specific target path exists
299# -----------------------------------------------------------------------------
300
301!if "$(TARGET_MODE)" != "EMPTY"
302! if "$(PATH_TARGET)" != ""
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
308! endif
309! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
310! if [$(ECHO) $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)]
311! endif
312! error
313! endif
314! endif
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)
319! endif
320! else
321! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
322! error $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)
323! endif
324! endif
325! endif
326! endif
327!endif
328# not 100% sure about the != EMPTY stuff, but this is way faster.
329
330
331
332# -----------------------------------------------------------------------------
333# Common inference rules
334# -----------------------------------------------------------------------------
335.SUFFIXES:
336.SUFFIXES: .c .cpp .orc .asm .$(EXT_OBJ) .$(EXT_RES) .rc .ii .s
337
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
347
348
349# Assembling assembly source.
350.asm{$(PATH_TARGET)}.$(EXT_OBJ):
351 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
352 \
353! ifndef BUILD_VERBOSE
354 @ \
355! endif
356!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
357 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$@
358!else
359 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$@
360!endif
361
362.asm.$(EXT_OBJ):
363 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRRST)
364 \
365!ifndef BUILD_VERBOSE
366 @ \
367!endif
368!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
369 $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
370!else
371 $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
372!endif
373
374# C++ Compiler base line
375_CXX_BASELINE = $(CXX) \
376!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
385!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
386 $(CXX_FLAGS_IFS) \
387!endif
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) \
397!if "$(CXX_LST_OUT)" != ""
398 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
399!endif
400 $(CXX_OBJ_OUT)$@ $(_SRC)
401
402.cpp.$(EXT_OBJ):
403 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
404 \
405!ifndef BUILD_VERBOSE
406 @ \
407!endif
408 $(_CXX_BASELINE) \
409!if "$(CXX_LST_OUT)" != ""
410 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
411!endif
412 $(CXX_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
413
414
415# Pre-Compiling C++ source.
416.cpp.ii:
417 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
418 \
419!ifndef BUILD_VERBOSE
420 @ \
421!endif
422 $(_CXX_BASELINE) \
423 $(CXX_PC_2_STDOUT) $(_SRC) > $@
424
425
426# Compiler C++ source to assembly.
427!if "$(CXX_AS_2_FILE)" != ""
428.cpp.s:
429 @$(ECHO) C++ To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
430 \
431!ifndef BUILD_VERBOSE
432 @ \
433!endif
434 $(_CXX_BASELINE) \
435 $(CXX_AS_2_FILE)$@ $(_SRC)
436!endif
437
438
439
440# C Compiler base line
441_CC_BASELINE = $(CC) \
442!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
451!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
452 $(CC_FLAGS_IFS) \
453!endif
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) \
463!if "$(CC_LST_OUT)" != ""
464 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
465!endif
466 $(CC_OBJ_OUT)$@ $(_SRC)
467
468.c.$(EXT_OBJ):
469 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRRST)
470 \
471!ifndef BUILD_VERBOSE
472 @ \
473!endif
474 $(_CC_BASELINE) \
475!if "$(CC_LST_OUT)" != ""
476 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
477!endif
478 $(CC_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
479
480
481# Pre-Compiling C source.
482.c.ii:
483 @$(ECHO) C PreCompiler $(CLRFIL)$(_SRC) $(CLRRST)
484 \
485!ifndef BUILD_VERBOSE
486 @ \
487!endif
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 @ \
499!endif
500 $(_CC_BASELINE) \
501 $(CC_AS_2_FILE)$@ $(_SRC)
502!endif
503
504
505# Compiling resources.
506.rc{$(PATH_TARGET)}.res:
507 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
508 \
509!ifndef BUILD_VERBOSE
510 @ \
511!endif
512 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $(_SRC) $@
513
514.rc.res:
515 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
516 \
517!ifndef BUILD_VERBOSE
518 @ \
519!endif
520 $(RC) $(RC_FLAGS) $(_SRC) $(PATH_TARGET)\$(@F)
521
522
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)
536
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)
549
550
551
552
553
554# -----------------------------------------------------------------------------
555# The all rule - The default one, as it's the first rule in the file.
556# -----------------------------------------------------------------------------
557all: build
558
559
560
561# -----------------------------------------------------------------------------
562# The build rule - This runs all passes:
563# 1. Make Dependencies
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
569# Note: In order to load dependencies we'll do a forwarding after making them.
570# -----------------------------------------------------------------------------
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_: \
591 _build_banner_needed needed \
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
604_build_banner_needed:
605 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
606 @SET _BUILD_PASS=2
607_build_banner_lib:
608 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
609 @SET _BUILD_PASS=3
610_build_banner_executable:
611 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Executables] $(CLRRST)
612 @SET _BUILD_PASS=4
613_build_banner_miscellaneous:
614 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
615 @SET _BUILD_PASS=5
616_build_banner_install:
617 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Install] $(CLRRST)
618 @SET _BUILD_PASS=6
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
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<<
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
675!endif
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
682!endif
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
689!endif
690
691!endif #!TESTCASE
692
693
694
695# -----------------------------------------------------------------------------
696# Pass 1 - The dep rule - Make dependencies.
697# -----------------------------------------------------------------------------
698dep:
699!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
700 @$(ECHO) Making dependencies... $(CLRRST)
701 \
702! ifndef BUILD_VERBOSE
703 @ \
704! endif
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
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
717!endif
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
724!endif
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
731!endif
732
733
734
735# -----------------------------------------------------------------------------
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.
740# -----------------------------------------------------------------------------
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):
791 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
792! endif
793!endif
794
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):
803 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
804! endif
805!endif
806
807lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
808!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
809 $(TARGET) $(TARGET_PUBNAME) \
810!endif
811 $(TARGET_ILIB)
812!ifdef POSTMAKEFILES_LIB
813 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
814!else
815! ifdef POSTMAKEFILES
816 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
817! endif
818!endif
819
820
821
822# -----------------------------------------------------------------------------
823# Pass 4 - The executable rule - Build the executables.
824# -----------------------------------------------------------------------------
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):
833 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
834! endif
835!endif
836
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):
845 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) executable
846! endif
847!endif
848
849executable: \
850!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && "$(TARGET_NEEDED)" == ""
851 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE) $(TARGET) $(TARGET_PUBNAME)
852! if "$(TARGET)" != ""
853 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET)$(CLRRST)
854! endif
855!else
856 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE)
857!endif
858!ifdef POSTMAKEFILES_EXECUTABLE
859 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) $@
860!else
861! ifdef POSTMAKEFILES
862 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
863! endif
864!endif
865
866
867
868# -----------------------------------------------------------------------------
869# Pass 5 - The miscellaneous rule - Makes other miscellaneous stuff like
870# documentations etc. This is experimental for the moment.
871# -----------------------------------------------------------------------------
872!ifdef SUBDIRS_MISC
873_SUBDIRS_MISC = _subdir_misc
874$(SUBDIRS_MISC):
875 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
876!else
877! ifdef SUBDIRS
878_SUBDIRS_MISC = _subdir_misc
879$(_SUBDIRS_MISC):
880 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
881! endif
882!endif
883
884!ifdef PREMAKEFILES_MISC
885_PREMAKEFILES_MISC = _premakefiles_misc
886$(PREMAKEFILES_MISC):
887 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) miscellaneous
888!else
889! ifdef PREMAKEFILES
890_PREMAKEFILES_MISC = _premakefiles_misc
891$(_PREMAKEFILES_MISC):
892 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) miscellaneous
893! endif
894!endif
895
896miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
897 $(TARGET_DOCS) $(TARGET_MISC)
898!if "$(TARGET_DOCS)$(TARGET_MISC)" != ""
899 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
900!endif
901!ifdef POSTMAKEFILES_MISC
902 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
903!else
904! ifdef POSTMAKEFILES
905 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
906! endif
907!endif
908
909
910
911# -----------------------------------------------------------------------------
912# Pass 6 - The install rule - Copies target to main binary directory.
913# Installation order is not concidered vital, so subdirectories and
914# pre-makefiles are processed after this directory. This might be changed.
915# -----------------------------------------------------------------------------
916install:
917!if "$(TARGET_PUBLIC)" == "" && "$(TARGET_PUBNAME)" == "" && "$(TARGET_PRIVATE)" == ""
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)
921 @if not exist $(PATH_BIN) $(TOOL_CREATEPATH) $(PATH_BIN)
922 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_BIN)
923 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_BIN)
924! endif
925! if "$(TARGET_MODE)" == "DLL"
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)
928 @if not exist $(PATH_DLL) $(TOOL_CREATEPATH) $(PATH_DLL)
929 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_DLL)
930 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_DLL)
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)
935 @if not exist $(PATH_SYS) $(TOOL_CREATEPATH) $(PATH_SYS)
936 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_SYS)
937 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_SYS)
938! endif
939!if 0 # these targets are either TARGET_PUBLIC or all private.
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)
943 @if not exist $(PATH_LIB) $(TOOL_CREATEPATH) $(PATH_LIB)
944 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_LIB)
945 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_LIB)
946! endif
947! endif
948!endif
949!if "$(TARGET_DOCS)" != ""
950 $(TOOL_COPY) $(TARGET_DOCS) $(PATH_DOC)
951!endif
952!ifdef SUBDIRS_INSTALL
953 @$(TOOL_DODIRS) "$(SUBDIRS_INSTALL)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
954!else
955! ifdef SUBDIRS
956 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
957! endif
958!endif
959!ifdef PREMAKEFILES_INSTALL
960 @$(TOOL_DOMAKES) "$(PREMAKEFILES_INSTALL)" $(TOOL_MAKE) $@
961!else
962! ifdef PREMAKEFILES
963 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
964! endif
965!endif
966!ifdef POSTMAKEFILES_INSTALL
967 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_INSTALL)" $(TOOL_MAKE) $@
968!else
969! ifdef POSTMAKEFILES
970 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
971! endif
972!endif
973
974
975
976# -----------------------------------------------------------------------------
977# Pass x - The testcase rule - Execute testcases when present.
978# Testcases are either a testcase.mak file or a testcase subdirectory.
979# -----------------------------------------------------------------------------
980!if "$(TARGET_MODE)" != "TESTCASE"
981!ifndef BUILD_OWN_TESTCASE_RULE
982
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
990
991testcase:
992 @$(ECHO) Executing testcases $(CLRRST)
993!if $(_TESTCASE_TST1)
994 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
995!endif
996!if $(_TESTCASE_TST2)
997 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
998!endif
999!ifdef SUBDIRS_TESTCASE
1000 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1001!else
1002! ifdef SUBDIRS
1003 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1004! endif
1005!endif
1006!ifdef PREMAKEFILES_TESTCASE
1007 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1008!else
1009! ifdef PREMAKEFILES
1010 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1011! endif
1012!endif
1013!ifdef POSTMAKEFILES_TESTCASE
1014 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1015!else
1016! ifdef POSTMAKEFILES
1017 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1018! endif
1019!endif
1020
1021!endif # BUILD_OWN_TESTCASE_RULE
1022!endif #!TESTCASE
1023
1024
1025
1026# -----------------------------------------------------------------------------
1027# The target rule - Build the target.
1028# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
1029# -----------------------------------------------------------------------------
1030target: $(TARGET) $(TARGET_ILIB) $(TARGET_PUBNAME)
1031 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
1032
1033
1034
1035# -----------------------------------------------------------------------------
1036# The shell rule - Setup the correcte shell environment and start a shell.
1037# -----------------------------------------------------------------------------
1038shell:
1039 @$(ECHO) Creating work shell $(CLRRST)
1040 \
1041!ifndef BUILD_VERBOSE
1042 @ \
1043!endif
1044 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1045 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
1046
1047
1048
1049# -----------------------------------------------------------------------------
1050# The nothing rule - Rule for testing the makefile structure.
1051# -----------------------------------------------------------------------------
1052nothing:
1053 @$(ECHO) Doing nothing in $(MAKEFILE).
1054!ifdef SUBDIRS
1055 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1056!endif
1057!ifdef PREMAKEFILES
1058 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1059!endif
1060!ifdef POSTMAKEFILES
1061 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1062!endif
1063 @$(ECHO) Completed nothing in $(MAKEFILE).
1064
1065
1066
1067# -----------------------------------------------------------------------------
1068# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1069# -----------------------------------------------------------------------------
1070!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
1071$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS)
1072!if "$(TOOL_JOB_WAIT)" != ""
1073! ifndef BUILD_QUIET
1074 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1075! endif
1076 \
1077! ifndef BUILD_VERBOSE
1078 @ \
1079! endif
1080 $(TOOL_JOB_WAIT)
1081!endif
1082 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
1083 \
1084!ifndef BUILD_VERBOSE
1085 @ \
1086!endif
1087!ifdef TARGET_IGNORE_LINKER_WARNINGS
1088 -4 \
1089!endif
1090!if "$(TARGET_MODE)" == "EXE"
1091 $(LINK_CMD_EXE)
1092!endif
1093!if "$(TARGET_MODE)" == "DLL"
1094 $(LINK_CMD_DLL)
1095!endif
1096!if "$(TARGET_MODE)" == "SYS"
1097 $(LINK_CMD_SYS)
1098!endif
1099!if "$(TARGET_MODE)" == "IFS"
1100 $(LINK_CMD_IFS)
1101!endif
1102!if "$(TARGET_MODE)" == "VDD"
1103 $(LINK_CMD_VDD)
1104!endif
1105!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1106 @$(ECHO) Linking Resources $(CLRRST)
1107 \
1108! ifndef BUILD_VERBOSE
1109 @ \
1110! endif
1111 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
1112!endif
1113!if "$(TARGET_DLLRNAME)" != ""
1114 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
1115 \
1116! ifndef BUILD_VERBOSE
1117 @ \
1118! endif
1119 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1120!endif
1121!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
1122 \
1123! ifndef BUILD_VERBOSE
1124 @ \
1125! endif
1126 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1127!endif
1128
1129
1130#
1131# Linker parameter file.
1132#
1133$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1134!ifndef TOOL_DEFCONV
1135 @$(TOOL_ECHOTXT) Creating Linker Input File $(CLRRST)<<$@
1136$(LINK_LNK1)
1137$(LINK_LNK2)
1138$(LINK_LNK3)
1139$(LINK_LNK4)
1140$(LINK_LNK5)
1141<<KEEP
1142!else
1143 @$(ECHO) Creating Linker Input File $(CLRRST) $@
1144 @$(TOOL_RM) "$@"
1145 \
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
1160!ifdef BUILD_VERBOSE
1161 @type $@
1162!endif
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
1173 \
1174! ifndef BUILD_VERBOSE
1175 @ \
1176! endif
1177 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$** $** $@
1178!endif
1179
1180!endif
1181
1182
1183# -----------------------------------------------------------------------------
1184# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
1185# -----------------------------------------------------------------------------
1186!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
1187$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
1188!if "$(TOOL_JOB_WAIT)" != ""
1189! ifndef BUILD_QUIET
1190 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1191! endif
1192 \
1193! ifndef BUILD_VERBOSE
1194 @ \
1195! endif
1196 $(TOOL_JOB_WAIT)
1197!endif
1198 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
1199!ifndef BUILD_VERBOSE
1200 @$(TOOL_RM) "$@"
1201 @$(AR_CMD)
1202!else
1203 $(TOOL_RM) "$@"
1204 $(AR_CMD)
1205!endif
1206
1207
1208#
1209# Lib parameter file.
1210#
1211$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1212 @$(TOOL_ECHOTXT) Creating Lib Input File $(CLRRST)<<$@
1213$(AR_LNK1)
1214$(AR_LNK2)
1215$(AR_LNK3)
1216$(AR_LNK4)
1217$(AR_LNK5)
1218<<KEEP
1219!ifdef BUILD_VERBOSE
1220 @type $@
1221!endif
1222!endif
1223
1224
1225# -----------------------------------------------------------------------------
1226# Copy rule for public targets.
1227# Normally used for public libraries, but may be used for other purposes...
1228# -----------------------------------------------------------------------------
1229!if "$(TARGET_PUBNAME)" != ""
1230$(TARGET_PUBNAME): $(TARGET)
1231 @$(ECHO) Copying $(CLRFIL)$(TARGET)$(CLRTXT) to $(CLRFIL)$(@D)$(CLRRST)
1232 \
1233!ifndef BUILD_VERBOSE
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)
1237 \
1238!ifndef BUILD_VERBOSE
1239 @ \
1240!endif
1241 $(TOOL_COPY) $** $@
1242 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(@R).sym
1243!endif
1244
1245
1246
1247# -----------------------------------------------------------------------------
1248# The $(TARGET) rule - For DEPEND targets.
1249# -----------------------------------------------------------------------------
1250!if "$(TARGET_MODE)" == "DEPEND"
1251$(TARGET):
1252 @$(ECHO) .
1253!endif
1254
1255
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)
1263 \
1264!ifndef BUILD_VERBOSE
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
1270 @ \
1271!endif
1272 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
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)
1284!endif
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
1292
1293!endif
1294
1295
1296
1297# -----------------------------------------------------------------------------
1298# The .force rule - Force a remake of something everytime.
1299# -----------------------------------------------------------------------------
1300.force:
1301!ifndef BUILD_VERBOSE
1302 @$(ECHO) .
1303!else
1304 @$(ECHO) . (force) .
1305!endif
1306
1307
1308
1309# -----------------------------------------------------------------------------
1310# Read Dependencies.
1311# -----------------------------------------------------------------------------
1312!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1313!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
1314
1315#
1316# Read dependency file for current directory
1317#
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
1323! endif
1324! include $(TARGET_DEPEND)
1325! else
1326#! ifndef NODEP
1327#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1328#! endif
1329#! endif
1330! endif
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
1338#! ifndef NODEP
1339#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1340#! endif
1341! endif
1342!endif
1343
1344
1345#
1346# Read global dependency files.
1347#
1348!ifdef BUILD_DEPEND1
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
1354! endif
1355! include $(BUILD_DEPEND1)
1356! else
1357! ifndef NODEP
1358! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
1359! endif
1360! endif
1361! endif
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
1373! endif
1374!endif
1375
1376
1377!ifdef BUILD_DEPEND2
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
1383! endif
1384! include $(BUILD_DEPEND2)
1385! else
1386! ifndef NODEP
1387! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1388! endif
1389! endif
1390! endif
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
1402! endif
1403!endif
1404
1405
1406!ifdef BUILD_DEPEND3
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
1412! endif
1413! include $(BUILD_DEPEND3)
1414! else
1415! ifndef NODEP
1416! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1417! endif
1418! endif
1419! endif
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
1431! endif
1432!endif
1433
1434
1435!endif
1436
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)" == ""
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)
1449! endif
1450! endif
1451! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
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
1459! endif
1460! endif
1461!endif
1462
1463!endif #!TESTCASE
Note: See TracBrowser for help on using the repository browser.