source: trunk/make/process.mak@ 9228

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

Added pass[1-6] and quick shortcuts for lazy programmers.

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