source: trunk/make/process.mak@ 9178

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

Packing and lib dependencies.

File size: 44.5 KB
Line 
1# $Id: process.mak,v 1.26 2002-08-30 19:45:29 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# Pass x - The packing rule - traverse subdirs etc.
1128# -----------------------------------------------------------------------------
1129!ifdef SUBDIRS_PACKING
1130_SUBDIRS_PACKING = _subdir_packing
1131$(_SUBDIRS_PACKING):
1132 @$(TOOL_DODIRS) "$(SUBDIRS_PACKING)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1133!else
1134! ifdef SUBDIRS
1135_SUBDIRS_PACKING = _subdir_packing
1136$(_SUBDIRS_PACKING):
1137 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1138! endif
1139!endif
1140
1141!ifdef PREMAKEFILES_PACKING
1142_PREMAKEFILES_PACKING = _premakefiles_packing
1143$(PREMAKEFILES_PACKING):
1144 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PACKING)" $(TOOL_MAKE) packing
1145!else
1146! ifdef PREMAKEFILES
1147_PREMAKEFILES_PACKING = _premakefiles_packing
1148$(_PREMAKEFILES_PACKING):
1149 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) packing
1150! endif
1151!endif
1152
1153!if "$(RULE_PACKING)" == "packing"
1154_packing: \
1155!else
1156packing: \
1157!endif
1158 $(_SUBDIRS_PACKING) $(_PREMAKEFILES_PACKING) $(RULE_PACKING)
1159!ifdef POSTMAKEFILES_PACKING
1160 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PACKING)" $(TOOL_MAKE) $@
1161!else
1162! ifdef POSTMAKEFILES
1163 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1164! endif
1165!endif
1166 $(ECHO) .$(CLRRST)
1167
1168
1169
1170# -----------------------------------------------------------------------------
1171# The target rule - Build the target.
1172# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
1173# -----------------------------------------------------------------------------
1174target: $(TARGET) $(TARGET_ILIB) $(_TARGET_EARLY_PUBLISH)
1175!if "$(TARGET)$(TARGET_ILIB)" != ""
1176 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
1177!else
1178 @$(ECHO) .$(CLRRST)
1179!endif
1180
1181
1182
1183# -----------------------------------------------------------------------------
1184# The shell rule - Setup the correcte shell environment and start a shell.
1185# -----------------------------------------------------------------------------
1186shell:
1187 @$(ECHO) Creating work shell $(CLRRST)
1188 \
1189!ifndef BUILD_VERBOSE
1190 @ \
1191!endif
1192 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1193 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
1194
1195
1196
1197# -----------------------------------------------------------------------------
1198# The nothing rule - Rule for testing the makefile structure.
1199# -----------------------------------------------------------------------------
1200nothing:
1201 @$(ECHO) Doing nothing in $(MAKEFILE).
1202!ifdef SUBDIRS
1203 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1204!endif
1205!ifdef PREMAKEFILES
1206 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1207!endif
1208!ifdef POSTMAKEFILES
1209 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1210!endif
1211 @$(ECHO) Completed nothing in $(MAKEFILE).
1212
1213
1214
1215# -----------------------------------------------------------------------------
1216# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1217# -----------------------------------------------------------------------------
1218!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
1219$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS) $(TARGET_LIBS)
1220!if "$(TOOL_JOB_WAIT)" != ""
1221! ifndef BUILD_QUIET
1222 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1223! endif
1224 \
1225! ifndef BUILD_VERBOSE
1226 @ \
1227! endif
1228 $(TOOL_JOB_WAIT)
1229!endif
1230 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
1231 \
1232!ifndef BUILD_VERBOSE
1233 @ \
1234!endif
1235!ifdef TARGET_IGNORE_LINKER_WARNINGS
1236 -4 \
1237!endif
1238!if "$(TARGET_MODE)" == "EXE"
1239 $(LINK_CMD_EXE)
1240!endif
1241!if "$(TARGET_MODE)" == "DLL"
1242 $(LINK_CMD_DLL)
1243!endif
1244!if "$(TARGET_MODE)" == "SYS"
1245 $(LINK_CMD_SYS)
1246!endif
1247!if "$(TARGET_MODE)" == "IFS"
1248 $(LINK_CMD_IFS)
1249!endif
1250!if "$(TARGET_MODE)" == "VDD"
1251 $(LINK_CMD_VDD)
1252!endif
1253!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1254 @$(ECHO) Linking Resources $(CLRRST)
1255 \
1256! ifndef BUILD_VERBOSE
1257 @ \
1258! endif
1259 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
1260!endif
1261!if "$(TARGET_DLLRNAME)" != ""
1262 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
1263 \
1264! ifndef BUILD_VERBOSE
1265 @ \
1266! endif
1267 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1268!endif
1269!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
1270 \
1271! ifndef BUILD_VERBOSE
1272 @ \
1273! endif
1274 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1275!endif
1276!if "$(BUILD_MODE)" == "RELEASE"
1277 \
1278! ifndef BUILD_VERBOSE
1279 @ \
1280! endif
1281 $(TOOL_COPY) "$@" "$(_TARGET_DEB)"
1282! if "$(TOOL_STRIP)" != ""
1283 \
1284! ifndef BUILD_VERBOSE
1285 @ \
1286! endif
1287 $(TOOL_STRIP) $@
1288! endif
1289!endif
1290
1291
1292#
1293# Linker parameter file.
1294#
1295$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1296!ifndef TOOL_DEFCONV
1297 @$(TOOL_ECHOTXT) Creating Linker Input File $(CLRRST)<<$@
1298$(LINK_LNK1)
1299$(LINK_LNK2)
1300$(LINK_LNK3)
1301$(LINK_LNK4)
1302$(LINK_LNK5)
1303<<KEEP
1304!else
1305 @$(ECHO) Creating Linker Input File $(CLRRST) $@
1306 @$(TOOL_RM) "$@"
1307 \
1308! ifdef BUILD_VERBOSE
1309 @ \
1310! endif
1311 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $@ <<$(TARGET_LNK)2
1312#
1313# LINK_LNK[1-5]:
1314#
1315$(LINK_LNK1)
1316$(LINK_LNK2)
1317$(LINK_LNK3)
1318$(LINK_LNK4)
1319$(LINK_LNK5)
1320<<keep
1321!endif
1322!ifdef BUILD_VERBOSE
1323 @type $@
1324!endif
1325
1326
1327#
1328# Builddef modified definition file.
1329#
1330!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1331$(TARGET_DEF_LINK): $(TARGET_DEF)
1332! ifndef BUILD_QUIET
1333 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1334! endif
1335 \
1336! ifndef BUILD_VERBOSE
1337 @ \
1338! endif
1339 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$** $** $@
1340!endif
1341
1342!endif
1343
1344
1345# -----------------------------------------------------------------------------
1346# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
1347# -----------------------------------------------------------------------------
1348!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
1349$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
1350!if "$(TOOL_JOB_WAIT)" != ""
1351! ifndef BUILD_QUIET
1352 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1353! endif
1354 \
1355! ifndef BUILD_VERBOSE
1356 @ \
1357! endif
1358 $(TOOL_JOB_WAIT)
1359!endif
1360 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
1361!ifndef BUILD_VERBOSE
1362 @$(TOOL_RM) "$@"
1363 @$(AR_CMD)
1364!else
1365 $(TOOL_RM) "$@"
1366 $(AR_CMD)
1367!endif
1368
1369
1370#
1371# Lib parameter file.
1372#
1373$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1374 @$(TOOL_ECHOTXT) Creating Lib Input File $(CLRRST)<<$@
1375$(AR_LNK1)
1376$(AR_LNK2)
1377$(AR_LNK3)
1378$(AR_LNK4)
1379$(AR_LNK5)
1380<<KEEP
1381!ifdef BUILD_VERBOSE
1382 @type $@
1383!endif
1384!endif
1385
1386
1387# -----------------------------------------------------------------------------
1388# The $(TARGET) rule - For DEPEND targets.
1389# -----------------------------------------------------------------------------
1390!if "$(TARGET_MODE)" == "DEPEND"
1391$(TARGET):
1392 @$(ECHO) .
1393!endif
1394
1395
1396
1397# -----------------------------------------------------------------------------
1398# The $(TARGET_ILIB) rule - Make import library.
1399# -----------------------------------------------------------------------------
1400!ifdef TARGET_ILIB
1401$(TARGET_ILIB): $(TARGET_IDEF)
1402 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
1403 \
1404!ifndef BUILD_VERBOSE
1405 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1406!endif
1407 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1408 \
1409!ifndef BUILD_VERBOSE
1410 @ \
1411!endif
1412 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
1413
1414
1415#
1416# Conversion rule for converting the .def file before passing along to implib.
1417#
1418! if "$(TARGET_IDEF_ORG)" != "" && "$(TARGET_IDEF_ORG)" != "$(TARGET_IDEF)"
1419$(TARGET_IDEF): $(TARGET_IDEF_ORG)
1420 @$(ECHO) Making Import Definition File $(CLRFIL)$@ $(CLRRST)
1421 \
1422!ifndef BUILD_VERBOSE
1423 @if not exist $(@D) $(ECHO) Target .def path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1424!endif
1425 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1426 \
1427!ifndef BUILD_VERBOSE
1428 @ \
1429!endif
1430 $(TOOL_IDEFCONV) $(TOOL_IDEFCONV_FLAGS) $(TARGET_IDEF_ORG) $@
1431! endif
1432
1433!endif
1434
1435
1436
1437# -----------------------------------------------------------------------------
1438# The .force rule - Force a remake of something everytime.
1439# -----------------------------------------------------------------------------
1440.force:
1441!ifndef BUILD_VERBOSE
1442 @$(ECHO) .
1443!else
1444 @$(ECHO) . (force) .
1445!endif
1446
1447
1448
1449# -----------------------------------------------------------------------------
1450# Read Dependencies.
1451# -----------------------------------------------------------------------------
1452!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1453!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
1454
1455#
1456# Read dependency file for current directory
1457#
1458!ifndef MAKEVER
1459! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1460! ifdef BUILD_VERBOSE
1461! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1462! endif
1463! endif
1464! include $(TARGET_DEPEND)
1465! else
1466#! ifndef NODEP
1467#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1468#! endif
1469#! endif
1470! endif
1471!else
1472! if %exists($(TARGET_DEPEND)) != 0
1473! ifdef BUILD_VERBOSE
1474$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1475! endif
1476! include $(TARGET_DEPEND)
1477! else
1478#! ifndef NODEP
1479#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1480#! endif
1481! endif
1482!endif
1483
1484
1485#
1486# Read global dependency files.
1487#
1488!ifdef BUILD_DEPEND1
1489! ifndef MAKEVER
1490! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1491! ifdef BUILD_VERBOSE
1492! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1493! endif
1494! endif
1495! include $(BUILD_DEPEND1)
1496! else
1497! ifndef NODEP
1498! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
1499! endif
1500! endif
1501! endif
1502! else
1503! if %exists($(BUILD_DEPEND1)) != 0
1504! ifdef BUILD_VERBOSE
1505$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1506! endif
1507! include $(BUILD_DEPEND1)
1508! else
1509! ifndef NODEP
1510$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1511! endif
1512! endif
1513! endif
1514!endif
1515
1516
1517!ifdef BUILD_DEPEND2
1518! ifndef MAKEVER
1519! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1520! ifdef BUILD_VERBOSE
1521! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1522! endif
1523! endif
1524! include $(BUILD_DEPEND2)
1525! else
1526! ifndef NODEP
1527! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1528! endif
1529! endif
1530! endif
1531! else
1532! if %exists($(BUILD_DEPEND2)) != 0
1533! ifdef BUILD_VERBOSE
1534$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1535! endif
1536! include $(BUILD_DEPEND2)
1537! else
1538! ifndef NODEP
1539$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1540! endif
1541! endif
1542! endif
1543!endif
1544
1545
1546!ifdef BUILD_DEPEND3
1547! ifndef MAKEVER
1548! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1549! ifdef BUILD_VERBOSE
1550! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1551! endif
1552! endif
1553! include $(BUILD_DEPEND3)
1554! else
1555! ifndef NODEP
1556! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1557! endif
1558! endif
1559! endif
1560! else
1561! if %exists($(BUILD_DEPEND3)) != 0
1562! ifdef BUILD_VERBOSE
1563$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1564! endif
1565! include $(BUILD_DEPEND3)
1566! else
1567! ifndef NODEP
1568$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1569! endif
1570! endif
1571! endif
1572!endif
1573
1574
1575!endif
1576
1577
1578#
1579# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1580#
1581!if "$(BUILD_MULTIJOBS)" != ""
1582! if [$(TOOL_JOB_UP)] != 0
1583! if "$(BUILD_QUITE)" == ""
1584! ifndef MAKEVER
1585! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1586! endif
1587! else
1588$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
1589! endif
1590! endif
1591! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
1592! ifndef MAKEVER
1593! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1594! endif
1595! error
1596!else
1597! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1598!endif
1599! endif
1600! endif
1601!endif
1602
1603!endif #!TESTCASE
1604
1605
1606#
1607# Include system library dependency stubs.
1608#
1609!include $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)libs.mk
1610
1611
1612#
1613# Check if TARGET_ALWAYS needs to be forced built.
1614#
1615!if "$(TARGET_ALWAYS)" != ""
1616! ifndef BUILD_FORCED_BUILD_TEST
1617! if [$(TOOL_MAKE) BUILD_FORCED_BUILD_TEST=1 -f $(MAKEFILE) -q $(TARGET) $(TARGET_ILIB)] != 0
1618$(TARGET_ALWAYS): .force
1619! endif
1620! endif
1621!endif
1622
1623
Note: See TracBrowser for help on using the repository browser.