source: trunk/make/process.mak@ 9135

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

Test on _BUILD_PROJECT if Odin32. Corrected idef_conv/org issues. Make all rules unpreciou (only nmake5).

File size: 42.8 KB
Line 
1# $Id: process.mak,v 1.24 2002-08-27 03:01:01 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
439
440# Assembling assembly source.
441.asm{$(PATH_TARGET)}.$(EXT_OBJ):
442 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
443 \
444! ifndef BUILD_VERBOSE
445 @ \
446! endif
447!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
448 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$@
449!else
450 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$@
451!endif
452
453.asm.$(EXT_OBJ):
454 @$(ECHO) Assembling $(CLRFIL)$(_SRC) $(CLRRST)
455 \
456!ifndef BUILD_VERBOSE
457 @ \
458!endif
459!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
460 $(AS) $(AS_FLAGS_SYS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
461!else
462 $(AS) $(AS_FLAGS) $(_SRC) $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
463!endif
464
465# C++ Compiler base line
466_CXX_BASELINE = $(CXX) \
467!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
468 $(CXX_FLAGS_EXE) \
469!endif
470!if "$(TARGET_MODE)" == "DLL"
471 $(CXX_FLAGS_DLL) \
472!endif
473!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
474 $(CXX_FLAGS_SYS) \
475!endif
476!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
477 $(CXX_FLAGS_IFS) \
478!endif
479
480# Compiling C++ source.
481.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
482 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
483 \
484!ifndef BUILD_VERBOSE
485 @ \
486!endif
487 $(TOOL_JOB_SUB) $(_CXX_BASELINE) \
488!if "$(CXX_LST_OUT)" != ""
489 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
490!endif
491 $(CXX_OBJ_OUT)$@ $(_SRC)
492
493.cpp.$(EXT_OBJ):
494 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
495 \
496!ifndef BUILD_VERBOSE
497 @ \
498!endif
499 $(_CXX_BASELINE) \
500!if "$(CXX_LST_OUT)" != ""
501 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
502!endif
503 $(CXX_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
504
505
506# Pre-Compiling C++ source.
507.cpp.ii:
508 @$(ECHO) C++ Compiler $(CLRFIL)$(_SRC) $(CLRRST)
509 \
510!ifndef BUILD_VERBOSE
511 @ \
512!endif
513 $(_CXX_BASELINE) \
514 $(CXX_PC_2_STDOUT) $(_SRC) > $@
515
516
517# Compiler C++ source to assembly.
518!if "$(CXX_AS_2_FILE)" != ""
519.cpp.s:
520 @$(ECHO) C++ To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
521 \
522!ifndef BUILD_VERBOSE
523 @ \
524!endif
525 $(_CXX_BASELINE) \
526 $(CXX_AS_2_FILE)$@ $(_SRC)
527!endif
528
529
530
531# C Compiler base line
532_CC_BASELINE = $(CC) \
533!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
534 $(CC_FLAGS_EXE) \
535!endif
536!if "$(TARGET_MODE)" == "DLL"
537 $(CC_FLAGS_DLL) \
538!endif
539!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
540 $(CC_FLAGS_SYS) \
541!endif
542!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
543 $(CC_FLAGS_IFS) \
544!endif
545
546# Compiling C source.
547.c{$(PATH_TARGET)}.$(EXT_OBJ):
548 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
549 \
550!ifndef BUILD_VERBOSE
551 @ \
552!endif
553 $(TOOL_JOB_SUB) $(_CC_BASELINE) \
554!if "$(CC_LST_OUT)" != ""
555 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
556!endif
557 $(CC_OBJ_OUT)$@ $(_SRC)
558
559.c.$(EXT_OBJ):
560 @$(ECHO) C Compiler $(CLRFIL)$(_SRC) $(CLRRST)
561 \
562!ifndef BUILD_VERBOSE
563 @ \
564!endif
565 $(_CC_BASELINE) \
566!if "$(CC_LST_OUT)" != ""
567 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
568!endif
569 $(CC_OBJ_OUT)$(PATH_TARGET)\$(@F) $(_SRC)
570
571
572# Pre-Compiling C source.
573.c.ii:
574 @$(ECHO) C PreCompiler $(CLRFIL)$(_SRC) $(CLRRST)
575 \
576!ifndef BUILD_VERBOSE
577 @ \
578!endif
579 $(_CC_BASELINE) \
580 $(CC_PC_2_STDOUT) $(_SRC) > $@
581
582
583# Compiler C source to assembly.
584!if "$(CC_AS_2_FILE)" != ""
585.c.s:
586 @$(ECHO) C To Assembly $(CLRFIL)$(_SRC) $(CLRRST)
587 \
588!ifndef BUILD_VERBOSE
589 @ \
590!endif
591 $(_CC_BASELINE) \
592 $(CC_AS_2_FILE)$@ $(_SRC)
593!endif
594
595
596# Compiling resources.
597.rc{$(PATH_TARGET)}.res:
598 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
599 \
600!ifndef BUILD_VERBOSE
601 @ \
602!endif
603 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $(_SRC) $@
604
605.rc.res:
606 @$(ECHO) RC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
607 \
608!ifndef BUILD_VERBOSE
609 @ \
610!endif
611 $(RC) $(RC_FLAGS) $(_SRC) $(PATH_TARGET)\$(@F)
612
613
614# Compiling Odin32 resources.
615.orc{$(PATH_TARGET)}.obj:
616 @$(ECHO) ORC Compiler $(CLRFIL)$(_SRC) $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
617 \
618!ifndef BUILD_VERBOSE
619 @ \
620!endif
621 $(ORC) $(ORC_FLAGS) $(ORC_ASM_OUT)$(PATH_TARGET)\$(@B).asm $(_SRC)
622 \
623!ifndef BUILD_VERBOSE
624 @ \
625!endif
626 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
627
628.orc.obj:
629 @$(ECHO) ORC Compiler $(CLRFIL)$(_SRC) $(CLRRST)
630 \
631!ifndef BUILD_VERBOSE
632 @ \
633!endif
634 $(ORC) $(ORC_FLAGS) $(ORC_ASM_OUT)$(PATH_TARGET)\$(@B).asm $(_SRC)
635 \
636!ifndef BUILD_VERBOSE
637 @ \
638!endif
639 $(AS) $(AS_FLAGS) $(PATH_TARGET)\$(@B).asm $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
640
641
642
643
644
645# -----------------------------------------------------------------------------
646# The all rule - The default one, as it's the first rule in the file.
647# -----------------------------------------------------------------------------
648all: build
649
650
651
652# -----------------------------------------------------------------------------
653# The build rule - This runs all passes:
654# 1. Make Dependencies
655# 2. Make Needed Tools (stuff required in the next steps)
656# 3. Make Libraries (all kinds)
657# 4. Make Executables
658# 5. Make Miscellaneous Targets
659# 6. Make Install
660# Note: In order to load dependencies we'll do a forwarding after making them.
661# -----------------------------------------------------------------------------
662build: _build
663!if "$(MAKEFLAGS:I=_)" == "$(MAKEFLAGS)" # this is of course broken in nmake v5.0 for OS/2.
664 @$(ECHO)$(CLRMAK)[Successfully Built Everything!] $(CLRRST)
665!else
666 @$(ECHO)$(CLRMAK)[Built Everything! (Ignore option specified)] $(CLRRST)
667!endif
668
669# internal rule shared by rebuild and build.
670_build: _build_banner_dep dep
671!ifndef BUILD_QUIET
672 @$(ECHO) Restarting $(CLRFIL)$(MAKEFILE)$(CLRTXT) with new dependencies. $(CLRRST)
673!endif
674 \
675!ifndef BUILD_VERBOSE
676 @ \
677!endif
678 $(TOOL_MAKE) -f $(MAKEFILE) _build_new_dependencies_
679
680# internal rule used to reload dependencies.
681_build_new_dependencies_: \
682 _build_banner_needed needed \
683 _build_banner_lib lib \
684 _build_banner_executable executable \
685 _build_banner_miscellaneous miscellaneous \
686 _build_banner_publish publish
687
688# Banners for rebuild and build.
689_build_banner_clean:
690 @$(ECHO)$(CLRMAK)[Start Pass 0 - Make Clean] $(CLRRST)
691 @SET _BUILD_PASS=0
692_build_banner_dep:
693 @$(ECHO)$(CLRMAK)[Start Pass 1 - Make Dependencies] $(CLRRST)
694 @SET _BUILD_PASS=1
695_build_banner_needed:
696 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
697 @SET _BUILD_PASS=2
698_build_banner_lib:
699 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
700 @SET _BUILD_PASS=3
701_build_banner_executable:
702 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Executables] $(CLRRST)
703 @SET _BUILD_PASS=4
704_build_banner_miscellaneous:
705 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
706 @SET _BUILD_PASS=5
707_build_banner_publish:
708 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Public (i.e. Publish)] $(CLRRST)
709 @SET _BUILD_PASS=6
710
711
712
713# -----------------------------------------------------------------------------
714# The rebuild rule - Same as build but does a clean first (as Pass 0).
715# -----------------------------------------------------------------------------
716rebuild: \
717 _build_banner_clean clean \
718 _build
719!if "$(MAKEFLAGS:i=_)" == "$(MAKEFLAGS)"
720 @$(ECHO)$(CLRMAK)[Successfully Rebuilt Everything!] $(CLRRST)
721!else
722 @$(ECHO)$(CLRMAK)[Rebuilt Everything! (Ignore option specified)] $(CLRRST)
723!endif
724
725
726
727# -----------------------------------------------------------------------------
728# Pass 0 - The clean rule - Clean up output files.
729# The current setup doesn't clean the published ones.
730# -----------------------------------------------------------------------------
731!if "$(TARGET_MODE)" != "TESTCASE"
732clean:
733 @$(ECHO) Cleaning... $(CLRRST)
734 \
735! ifndef BUILD_VERBOSE
736 @ \
737! endif
738 $(TOOL_RM) @<<
739"$(PATH_TARGET)\*.$(EXT_OBJ)"
740"$(PATH_TARGET)\*.$(EXT_ILIB)"
741"$(PATH_TARGET)\*.$(EXT_EXE)"
742"$(PATH_TARGET)\*.$(EXT_DLL)"
743"$(PATH_TARGET)\*.$(EXT_RES)"
744"$(PATH_TARGET)\*.$(EXT_SYS)"
745"$(PATH_TARGET)\*.$(EXT_LIB)"
746"$(PATH_TARGET)\*.$(EXT_IFS)"
747"$(PATH_TARGET)\*.$(EXT_MAP)"
748"$(PATH_TARGET)\*.$(EXT_SYM)"
749"$(PATH_TARGET)\*.$(EXT_DEF)"
750"$(PATH_TARGET)\*.s"
751"$(PATH_TARGET)\*.lst"
752"$(PATH_TARGET)\*.lnk"
753"$(PATH_TARGET)\*.ii"
754"$(PATH_TARGET)\.depend"
755"$(TARGET_DEPEND)"
756.\*.ii
757.\*.err
758.\.depend
759<<
760!ifdef SUBDIRS_CLEAN
761 @$(TOOL_DODIRS) "$(SUBDIRS_CLEAN)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
762!else
763! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_EXECUTABLES)$(SUBDIRS_MISC)" != ""
764 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
765! endif
766!endif
767!ifdef PREMAKEFILES_CLEAN
768 @$(TOOL_DOMAKES) "$(PREMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
769!else
770! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_EXECUTABLES)$(PREMAKEFILES_MISC)" != ""
771 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
772! endif
773!endif
774!ifdef POSTMAKEFILES_CLEAN
775 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
776!else
777! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_EXECUTABLES)$(POSTMAKEFILES_MISC)" != ""
778 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
779! endif
780!endif
781
782!endif #!TESTCASE
783
784
785
786# -----------------------------------------------------------------------------
787# Pass 1 - The dep rule - Make dependencies.
788# -----------------------------------------------------------------------------
789dep:
790!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
791 @$(ECHO) Making dependencies... $(CLRRST)
792 \
793! ifndef BUILD_VERBOSE
794 @ \
795! endif
796 $(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
797! ifdef TARGET_NO_DEP
798 -x$(TARGET_NO_DEP: =;)\
799! endif
800 $(TOOL_DEP_FILES)
801!endif
802!ifdef SUBDIRS_DEP
803 @$(TOOL_DODIRS) "$(SUBDIRS_DEP)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
804!else
805! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_EXECUTABLES)$(SUBDIRS_MISC)" != ""
806 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
807! endif
808!endif
809!ifdef PREMAKEFILES_DEP
810 @$(TOOL_DOMAKES) "$(PREMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
811!else
812! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_EXECUTABLES)$(PREMAKEFILES_MISC)" != ""
813 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
814! endif
815!endif
816!ifdef POSTMAKEFILES_DEP
817 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
818!else
819! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_EXECUTABLES)$(POSTMAKEFILES_MISC)" != ""
820 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
821! endif
822!endif
823
824
825
826# -----------------------------------------------------------------------------
827# Pass 2 - The needed rule - Make need tools.
828# That is tools and stuff that is required for the next passes.
829# WARNING! These tools and stuff shouldn't rely on libraries and other
830# results of later passes.
831# -----------------------------------------------------------------------------
832!ifdef SUBDIRS_NEEDED
833_SUBDIRS_NEEDED = _subdir_needed
834$(_SUBDIRS_NEEDED):
835 @$(TOOL_DODIRS) "$(SUBDIRS_NEEDED)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
836!else
837! ifdef SUBDIRS
838_SUBDIRS_NEEDED = _subdir_needed
839$(_SUBDIRS_NEEDED):
840 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
841! endif
842!endif
843
844!ifdef PREMAKEFILES_NEEDED
845_PREMAKEFILES_NEEDED = _premakefiles_needed
846$(_PREMAKEFILES_NEEDED):
847 @$(TOOL_DOMAKES) "$(PREMAKEFILES_NEEDED)" $(TOOL_MAKE) needed
848!else
849! ifdef PREMAKEFILES
850_PREMAKEFILES_NEEDED = _premakefiles_needed
851$(_PREMAKEFILES_NEEDED):
852 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) needed
853! endif
854!endif
855
856!ifdef TARGET_NEEDED
857needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED) target
858!else
859needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED)
860!endif
861!ifdef POSTMAKEFILES_NEEDED
862 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_NEEDED)" $(TOOL_MAKE) $@
863!else
864! ifdef POSTMAKEFILES
865 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
866! endif
867!endif
868
869
870
871# -----------------------------------------------------------------------------
872# Pass 3 - The lib rule - Make libraries.
873# -----------------------------------------------------------------------------
874!ifdef SUBDIRS_LIB
875_SUBDIRS_LIB = _subdir_lib
876$(_SUBDIRS_LIB):
877 @$(TOOL_DODIRS) "$(SUBDIRS_LIB)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
878!else
879! ifdef SUBDIRS
880_SUBDIRS_LIB = _subdir_lib
881$(_SUBDIRS_LIB):
882 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
883! endif
884!endif
885
886!ifdef PREMAKEFILES_LIB
887_PREMAKEFILES_LIB = _premakefiles_lib
888$(_PREMAKEFILES_LIB):
889 @$(TOOL_DOMAKES) "$(PREMAKEFILES_LIB)" $(TOOL_MAKE) lib
890!else
891! ifdef PREMAKEFILES
892_PREMAKEFILES_LIB = _premakefiles_lib
893$(_PREMAKEFILES_LIB):
894 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
895! endif
896!endif
897
898lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
899!if !defined(TARGET_NEEDED) && ("$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB")
900 $(TARGET) $(_TARGET_EARLY_PUBLISH) \
901!endif
902 $(TARGET_ILIB)
903!ifdef POSTMAKEFILES_LIB
904 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
905!else
906! ifdef POSTMAKEFILES
907 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
908! endif
909!endif
910
911
912
913# -----------------------------------------------------------------------------
914# Pass 4 - The executable rule - Build the executables.
915# -----------------------------------------------------------------------------
916!ifdef SUBDIRS_EXECUTABLE
917_SUBDIRS_EXECUTABLE = _subdir_executable
918$(_SUBDIRS_EXECUTABLE):
919 @$(TOOL_DODIRS) "$(SUBDIRS_EXECUTABLE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
920!else
921! ifdef SUBDIRS
922_SUBDIRS_EXECUTABLE = _subdir_executable
923$(_SUBDIRS_EXECUTABLE):
924 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
925! endif
926!endif
927
928!ifdef PREMAKEFILES_EXECUTABLE
929_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
930$(_PREMAKEFILES_EXECUTABLE):
931 @$(TOOL_DOMAKES) "$(PREMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) executable
932!else
933! ifdef PREMAKEFILES
934_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
935$(_PREMAKEFILES_EXECUTABLE):
936 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) executable
937! endif
938!endif
939
940executable: \
941!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && !defined(TARGET_NEEDED)
942 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE) $(TARGET) $(_TARGET_EARLY_PUBLISH)
943!else
944 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE)
945!endif
946!ifdef POSTMAKEFILES_EXECUTABLE
947 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) $@
948!else
949! ifdef POSTMAKEFILES
950 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
951! endif
952!endif
953
954
955
956# -----------------------------------------------------------------------------
957# Pass 5 - The miscellaneous rule - Makes other miscellaneous stuff like
958# documentations etc. This is experimental for the moment.
959# -----------------------------------------------------------------------------
960!ifdef SUBDIRS_MISC
961_SUBDIRS_MISC = _subdir_misc
962$(SUBDIRS_MISC):
963 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
964!else
965! ifdef SUBDIRS
966_SUBDIRS_MISC = _subdir_misc
967$(_SUBDIRS_MISC):
968 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
969! endif
970!endif
971
972!ifdef PREMAKEFILES_MISC
973_PREMAKEFILES_MISC = _premakefiles_misc
974$(PREMAKEFILES_MISC):
975 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) miscellaneous
976!else
977! ifdef PREMAKEFILES
978_PREMAKEFILES_MISC = _premakefiles_misc
979$(_PREMAKEFILES_MISC):
980 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) miscellaneous
981! endif
982!endif
983
984miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
985 $(TARGET_DOCS) $(TARGET_MISC)
986!if "$(TARGET_DOCS)$(TARGET_MISC)" != ""
987 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
988!endif
989!ifdef POSTMAKEFILES_MISC
990 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
991!else
992! ifdef POSTMAKEFILES
993 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
994! endif
995!endif
996
997
998
999# -----------------------------------------------------------------------------
1000# Pass 6 - The publish rule - Copies target to main binary directory.
1001# Installation order is not concidered vital, so subdirectories and
1002# pre-makefiles are processed after this directory.
1003# However, this order might be changed!
1004# -----------------------------------------------------------------------------
1005!if "$(_TARGET_EARLY_PUBLISH)" != ""
1006publish:
1007!else
1008publish: publish_target
1009!endif
1010!ifdef SUBDIRS_PUBLISH
1011 @$(TOOL_DODIRS) "$(SUBDIRS_PUBLISH)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1012!else
1013! ifdef SUBDIRS
1014 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1015! endif
1016!endif
1017!ifdef PREMAKEFILES_PUBLISH
1018 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1019!else
1020! ifdef PREMAKEFILES
1021 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1022! endif
1023!endif
1024!ifdef POSTMAKEFILES_PUBLISH
1025 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1026!else
1027! ifdef POSTMAKEFILES
1028 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1029! endif
1030!endif
1031
1032
1033#
1034# Publish rule which doesn't go down into subdirs and submakes.
1035# This one is invoked when a target is 'needed' or early published.
1036#
1037publish_target:
1038!if "$(_TARGET_EARLY_PUBLISH)" != "" || "$(TARGET_MODE:LIB=cute)" == "$(TARGET_MODE)"
1039! if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1040 @$(ECHO) Publishing $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR)\$(TARGET_PUB_SUB)$(CLRRST)
1041 @if not exist "$(TARGET)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1042 @if not exist "$(TARGET_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR)
1043 @if exist "$(TARGET)" $(TOOL_COPY) "$(TARGET)" "$(TARGET_PUB)"
1044 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR)"
1045! if "$(TARGET_PUB_DEB)" != ""
1046 @$(ECHO) Publishing unstripped $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR_DEB)$(CLRRST)
1047 @if not exist "$(_TARGET_DEB)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(_TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1048 @if not exist "$(TARGET_PUB_DIR_DEB)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR_DEB)
1049 @if exist "$(_TARGET_DEB)" $(TOOL_COPY) "$(_TARGET_DEB)" "$(TARGET_PUB_DEB)"
1050 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR_DEB)"
1051! endif
1052! endif
1053!endif
1054!if "$(TARGET_DOCS)" != ""
1055 $(TOOL_COPY) $(TARGET_DOCS) $(PATH_DOC)
1056!endif
1057
1058
1059
1060# -----------------------------------------------------------------------------
1061# Pass x - The testcase rule - Execute testcases when present.
1062# Testcases are either a testcase.mak file or a testcase subdirectory.
1063# -----------------------------------------------------------------------------
1064!if "$(TARGET_MODE)" != "TESTCASE"
1065!ifndef BUILD_OWN_TESTCASE_RULE
1066
1067!ifndef MAKEVER
1068_TESTCASE_TST1 = [$(TOOL_EXISTS) testcase] == 0
1069_TESTCASE_TST2 = [$(TOOL_EXISTS) testcase.mak] == 0
1070!else
1071_TESTCASE_TST1 = exists(testcase) != 0
1072_TESTCASE_TST2 = exists(testcase.mak) != 0
1073!endif
1074
1075testcase:
1076 @$(ECHO) Executing testcases $(CLRRST)
1077!if $(_TESTCASE_TST1)
1078 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1079!endif
1080!if $(_TESTCASE_TST2)
1081 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
1082!endif
1083!ifdef SUBDIRS_TESTCASE
1084 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1085!else
1086! ifdef SUBDIRS
1087 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1088! endif
1089!endif
1090!ifdef PREMAKEFILES_TESTCASE
1091 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1092!else
1093! ifdef PREMAKEFILES
1094 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1095! endif
1096!endif
1097!ifdef POSTMAKEFILES_TESTCASE
1098 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1099!else
1100! ifdef POSTMAKEFILES
1101 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1102! endif
1103!endif
1104
1105!endif # BUILD_OWN_TESTCASE_RULE
1106!endif #!TESTCASE
1107
1108
1109
1110# -----------------------------------------------------------------------------
1111# The target rule - Build the target.
1112# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
1113# -----------------------------------------------------------------------------
1114target: $(TARGET) $(TARGET_ILIB) $(_TARGET_EARLY_PUBLISH)
1115!if "$(TARGET)$(TARGET_ILIB)" != ""
1116 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
1117!else
1118 @$(ECHO) .$(CLRRST)
1119!endif
1120
1121
1122
1123# -----------------------------------------------------------------------------
1124# The shell rule - Setup the correcte shell environment and start a shell.
1125# -----------------------------------------------------------------------------
1126shell:
1127 @$(ECHO) Creating work shell $(CLRRST)
1128 \
1129!ifndef BUILD_VERBOSE
1130 @ \
1131!endif
1132 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1133 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
1134
1135
1136
1137# -----------------------------------------------------------------------------
1138# The nothing rule - Rule for testing the makefile structure.
1139# -----------------------------------------------------------------------------
1140nothing:
1141 @$(ECHO) Doing nothing in $(MAKEFILE).
1142!ifdef SUBDIRS
1143 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1144!endif
1145!ifdef PREMAKEFILES
1146 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1147!endif
1148!ifdef POSTMAKEFILES
1149 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1150!endif
1151 @$(ECHO) Completed nothing in $(MAKEFILE).
1152
1153
1154
1155# -----------------------------------------------------------------------------
1156# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1157# -----------------------------------------------------------------------------
1158!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
1159$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS)
1160!if "$(TOOL_JOB_WAIT)" != ""
1161! ifndef BUILD_QUIET
1162 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1163! endif
1164 \
1165! ifndef BUILD_VERBOSE
1166 @ \
1167! endif
1168 $(TOOL_JOB_WAIT)
1169!endif
1170 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
1171 \
1172!ifndef BUILD_VERBOSE
1173 @ \
1174!endif
1175!ifdef TARGET_IGNORE_LINKER_WARNINGS
1176 -4 \
1177!endif
1178!if "$(TARGET_MODE)" == "EXE"
1179 $(LINK_CMD_EXE)
1180!endif
1181!if "$(TARGET_MODE)" == "DLL"
1182 $(LINK_CMD_DLL)
1183!endif
1184!if "$(TARGET_MODE)" == "SYS"
1185 $(LINK_CMD_SYS)
1186!endif
1187!if "$(TARGET_MODE)" == "IFS"
1188 $(LINK_CMD_IFS)
1189!endif
1190!if "$(TARGET_MODE)" == "VDD"
1191 $(LINK_CMD_VDD)
1192!endif
1193!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1194 @$(ECHO) Linking Resources $(CLRRST)
1195 \
1196! ifndef BUILD_VERBOSE
1197 @ \
1198! endif
1199 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
1200!endif
1201!if "$(TARGET_DLLRNAME)" != ""
1202 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
1203 \
1204! ifndef BUILD_VERBOSE
1205 @ \
1206! endif
1207 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1208!endif
1209!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
1210 \
1211! ifndef BUILD_VERBOSE
1212 @ \
1213! endif
1214 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1215!endif
1216!if "$(BUILD_MODE)" == "RELEASE"
1217 \
1218! ifndef BUILD_VERBOSE
1219 @ \
1220! endif
1221 $(TOOL_COPY) "$@" "$(_TARGET_DEB)"
1222! if "$(TOOL_STRIP)" != ""
1223 \
1224! ifndef BUILD_VERBOSE
1225 @ \
1226! endif
1227 $(TOOL_STRIP) $@
1228! endif
1229!endif
1230
1231
1232#
1233# Linker parameter file.
1234#
1235$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1236!ifndef TOOL_DEFCONV
1237 @$(TOOL_ECHOTXT) Creating Linker Input File $(CLRRST)<<$@
1238$(LINK_LNK1)
1239$(LINK_LNK2)
1240$(LINK_LNK3)
1241$(LINK_LNK4)
1242$(LINK_LNK5)
1243<<KEEP
1244!else
1245 @$(ECHO) Creating Linker Input File $(CLRRST) $@
1246 @$(TOOL_RM) "$@"
1247 \
1248! ifdef BUILD_VERBOSE
1249 @ \
1250! endif
1251 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $@ <<$(TARGET_LNK)2
1252#
1253# LINK_LNK[1-5]:
1254#
1255$(LINK_LNK1)
1256$(LINK_LNK2)
1257$(LINK_LNK3)
1258$(LINK_LNK4)
1259$(LINK_LNK5)
1260<<keep
1261!endif
1262!ifdef BUILD_VERBOSE
1263 @type $@
1264!endif
1265
1266
1267#
1268# Builddef modified definition file.
1269#
1270!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1271$(TARGET_DEF_LINK): $(TARGET_DEF)
1272! ifndef BUILD_QUIET
1273 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1274! endif
1275 \
1276! ifndef BUILD_VERBOSE
1277 @ \
1278! endif
1279 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$** $** $@
1280!endif
1281
1282!endif
1283
1284
1285# -----------------------------------------------------------------------------
1286# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
1287# -----------------------------------------------------------------------------
1288!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
1289$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
1290!if "$(TOOL_JOB_WAIT)" != ""
1291! ifndef BUILD_QUIET
1292 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1293! endif
1294 \
1295! ifndef BUILD_VERBOSE
1296 @ \
1297! endif
1298 $(TOOL_JOB_WAIT)
1299!endif
1300 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
1301!ifndef BUILD_VERBOSE
1302 @$(TOOL_RM) "$@"
1303 @$(AR_CMD)
1304!else
1305 $(TOOL_RM) "$@"
1306 $(AR_CMD)
1307!endif
1308
1309
1310#
1311# Lib parameter file.
1312#
1313$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1314 @$(TOOL_ECHOTXT) Creating Lib Input File $(CLRRST)<<$@
1315$(AR_LNK1)
1316$(AR_LNK2)
1317$(AR_LNK3)
1318$(AR_LNK4)
1319$(AR_LNK5)
1320<<KEEP
1321!ifdef BUILD_VERBOSE
1322 @type $@
1323!endif
1324!endif
1325
1326
1327# -----------------------------------------------------------------------------
1328# The $(TARGET) rule - For DEPEND targets.
1329# -----------------------------------------------------------------------------
1330!if "$(TARGET_MODE)" == "DEPEND"
1331$(TARGET):
1332 @$(ECHO) .
1333!endif
1334
1335
1336
1337# -----------------------------------------------------------------------------
1338# The $(TARGET_ILIB) rule - Make import library.
1339# -----------------------------------------------------------------------------
1340!ifdef TARGET_ILIB
1341$(TARGET_ILIB): $(TARGET_IDEF)
1342 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
1343 \
1344!ifndef BUILD_VERBOSE
1345 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1346!endif
1347 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1348 \
1349!ifndef BUILD_VERBOSE
1350 @ \
1351!endif
1352 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
1353
1354
1355#
1356# Conversion rule for converting the .def file before passing along to implib.
1357#
1358! if "$(TARGET_IDEF_ORG)" != "" && "$(TARGET_IDEF_ORG)" != "$(TARGET_IDEF)"
1359$(TARGET_IDEF): $(TARGET_IDEF_ORG)
1360 @$(ECHO) Making Import Definition File $(CLRFIL)$@ $(CLRRST)
1361 \
1362!ifndef BUILD_VERBOSE
1363 @if not exist $(@D) $(ECHO) Target .def path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1364!endif
1365 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1366 \
1367!ifndef BUILD_VERBOSE
1368 @ \
1369!endif
1370 $(TOOL_IDEFCONV) $(TOOL_IDEFCONV_FLAGS) $(TARGET_IDEF_ORG) $@
1371! endif
1372
1373!endif
1374
1375
1376
1377# -----------------------------------------------------------------------------
1378# The .force rule - Force a remake of something everytime.
1379# -----------------------------------------------------------------------------
1380.force:
1381!ifndef BUILD_VERBOSE
1382 @$(ECHO) .
1383!else
1384 @$(ECHO) . (force) .
1385!endif
1386
1387
1388
1389# -----------------------------------------------------------------------------
1390# Read Dependencies.
1391# -----------------------------------------------------------------------------
1392!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1393!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
1394
1395#
1396# Read dependency file for current directory
1397#
1398!ifndef MAKEVER
1399! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1400! ifdef BUILD_VERBOSE
1401! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1402! endif
1403! endif
1404! include $(TARGET_DEPEND)
1405! else
1406#! ifndef NODEP
1407#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1408#! endif
1409#! endif
1410! endif
1411!else
1412! if %exists($(TARGET_DEPEND)) != 0
1413! ifdef BUILD_VERBOSE
1414$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1415! endif
1416! include $(TARGET_DEPEND)
1417! else
1418#! ifndef NODEP
1419#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1420#! endif
1421! endif
1422!endif
1423
1424
1425#
1426# Read global dependency files.
1427#
1428!ifdef BUILD_DEPEND1
1429! ifndef MAKEVER
1430! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1431! ifdef BUILD_VERBOSE
1432! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1433! endif
1434! endif
1435! include $(BUILD_DEPEND1)
1436! else
1437! ifndef NODEP
1438! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
1439! endif
1440! endif
1441! endif
1442! else
1443! if %exists($(BUILD_DEPEND1)) != 0
1444! ifdef BUILD_VERBOSE
1445$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1446! endif
1447! include $(BUILD_DEPEND1)
1448! else
1449! ifndef NODEP
1450$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1451! endif
1452! endif
1453! endif
1454!endif
1455
1456
1457!ifdef BUILD_DEPEND2
1458! ifndef MAKEVER
1459! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1460! ifdef BUILD_VERBOSE
1461! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1462! endif
1463! endif
1464! include $(BUILD_DEPEND2)
1465! else
1466! ifndef NODEP
1467! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1468! endif
1469! endif
1470! endif
1471! else
1472! if %exists($(BUILD_DEPEND2)) != 0
1473! ifdef BUILD_VERBOSE
1474$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1475! endif
1476! include $(BUILD_DEPEND2)
1477! else
1478! ifndef NODEP
1479$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1480! endif
1481! endif
1482! endif
1483!endif
1484
1485
1486!ifdef BUILD_DEPEND3
1487! ifndef MAKEVER
1488! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1489! ifdef BUILD_VERBOSE
1490! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1491! endif
1492! endif
1493! include $(BUILD_DEPEND3)
1494! else
1495! ifndef NODEP
1496! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1497! endif
1498! endif
1499! endif
1500! else
1501! if %exists($(BUILD_DEPEND3)) != 0
1502! ifdef BUILD_VERBOSE
1503$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1504! endif
1505! include $(BUILD_DEPEND3)
1506! else
1507! ifndef NODEP
1508$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1509! endif
1510! endif
1511! endif
1512!endif
1513
1514
1515!endif
1516
1517
1518#
1519# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1520#
1521!if "$(BUILD_MULTIJOBS)" != ""
1522! if [$(TOOL_JOB_UP)] != 0
1523! if "$(BUILD_QUITE)" == ""
1524! ifndef MAKEVER
1525! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1526! endif
1527! else
1528$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
1529! endif
1530! endif
1531! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
1532! ifndef MAKEVER
1533! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1534! endif
1535! error
1536!else
1537! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1538!endif
1539! endif
1540! endif
1541!endif
1542
1543!endif #!TESTCASE
Note: See TracBrowser for help on using the repository browser.