source: trunk/make/process.mak@ 9127

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

Restructured install (now publish).

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