source: trunk/make/process.mak@ 9165

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

Added new tools. Restructured tools. More options. Fixes.

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