source: trunk/make/process.mak@ 9224

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

Corrected bug which made us put the libraries in the PATH_PUB tree instead of PATH_LIB.

File size: 44.7 KB
Line 
1# $Id: process.mak,v 1.28 2002-09-12 02:55:54 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# Banners for rebuild and build.
710_build_banner_clean:
711 @$(ECHO)$(CLRMAK)[Start Pass 0 - Make Clean] $(CLRRST)
712 @SET _BUILD_PASS=0
713_build_banner_dep:
714 @$(ECHO)$(CLRMAK)[Start Pass 1 - Make Dependencies] $(CLRRST)
715 @SET _BUILD_PASS=1
716_build_banner_needed:
717 @$(ECHO)$(CLRMAK)[Start Pass 2 - Make Needed Tools] $(CLRRST)
718 @SET _BUILD_PASS=2
719_build_banner_lib:
720 @$(ECHO)$(CLRMAK)[Start Pass 3 - Make Libraries] $(CLRRST)
721 @SET _BUILD_PASS=3
722_build_banner_executable:
723 @$(ECHO)$(CLRMAK)[Start Pass 4 - Make Executables] $(CLRRST)
724 @SET _BUILD_PASS=4
725_build_banner_miscellaneous:
726 @$(ECHO)$(CLRMAK)[Start Pass 5 - Make Miscellaneous Targets] $(CLRRST)
727 @SET _BUILD_PASS=5
728_build_banner_publish:
729 @$(ECHO)$(CLRMAK)[Start Pass 6 - Make Public (i.e. Publish)] $(CLRRST)
730 @SET _BUILD_PASS=6
731
732
733
734# -----------------------------------------------------------------------------
735# The rebuild rule - Same as build but does a clean first (as Pass 0).
736# -----------------------------------------------------------------------------
737rebuild: \
738 _build_banner_clean clean \
739 _build
740!if "$(MAKEFLAGS:i=_)" == "$(MAKEFLAGS)"
741 @$(ECHO)$(CLRMAK)[Successfully Rebuilt Everything!] $(CLRRST)
742!else
743 @$(ECHO)$(CLRMAK)[Rebuilt Everything! (Ignore option specified)] $(CLRRST)
744!endif
745
746
747
748# -----------------------------------------------------------------------------
749# Pass 0 - The clean rule - Clean up output files.
750# The current setup doesn't clean the published ones.
751# -----------------------------------------------------------------------------
752!if "$(TARGET_MODE)" != "TESTCASE"
753clean:
754 @$(ECHO) Cleaning... $(CLRRST)
755 \
756! ifndef BUILD_VERBOSE
757 @ \
758! endif
759 $(TOOL_RM) @<<
760"$(PATH_TARGET)\*.$(EXT_OBJ)"
761"$(PATH_TARGET)\*.$(EXT_ILIB)"
762"$(PATH_TARGET)\*.$(EXT_EXE)"
763"$(PATH_TARGET)\*.$(EXT_DLL)"
764"$(PATH_TARGET)\*.$(EXT_RES)"
765"$(PATH_TARGET)\*.$(EXT_SYS)"
766"$(PATH_TARGET)\*.$(EXT_LIB)"
767"$(PATH_TARGET)\*.$(EXT_IFS)"
768"$(PATH_TARGET)\*.$(EXT_MAP)"
769"$(PATH_TARGET)\*.$(EXT_SYM)"
770"$(PATH_TARGET)\*.$(EXT_DEF)"
771"$(PATH_TARGET)\*.s"
772"$(PATH_TARGET)\*.lst"
773"$(PATH_TARGET)\*.lnk"
774"$(PATH_TARGET)\*.ii"
775"$(PATH_TARGET)\.depend"
776"$(TARGET_DEPEND)"
777.\*.ii
778.\*.err
779.\.depend
780<<
781!ifdef SUBDIRS_CLEAN
782 @$(TOOL_DODIRS) "$(SUBDIRS_CLEAN)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
783!else
784! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_EXECUTABLES)$(SUBDIRS_MISC)" != ""
785 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
786! endif
787!endif
788!ifdef PREMAKEFILES_CLEAN
789 @$(TOOL_DOMAKES) "$(PREMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
790!else
791! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_EXECUTABLES)$(PREMAKEFILES_MISC)" != ""
792 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
793! endif
794!endif
795!ifdef POSTMAKEFILES_CLEAN
796 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_CLEAN)" $(TOOL_MAKE) NODEP=1 $@
797!else
798! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_EXECUTABLES)$(POSTMAKEFILES_MISC)" != ""
799 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
800! endif
801!endif
802
803!endif #!TESTCASE
804
805
806
807# -----------------------------------------------------------------------------
808# Pass 1 - The dep rule - Make dependencies.
809# -----------------------------------------------------------------------------
810dep:
811!if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE"
812 @$(ECHO) Making dependencies... $(CLRRST)
813 \
814! ifndef BUILD_VERBOSE
815 @ \
816! endif
817 $(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
818! ifdef TARGET_NO_DEP
819 -x$(TARGET_NO_DEP: =;)\
820! endif
821 $(TOOL_DEP_FILES)
822!endif
823!ifdef SUBDIRS_DEP
824 @$(TOOL_DODIRS) "$(SUBDIRS_DEP)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
825!else
826! if "$(SUBDIRS)$(SUBDIRS_NEEDED)$(SUBDIRS_LIB)$(SUBDIRS_EXECUTABLES)$(SUBDIRS_MISC)" != ""
827 @$(TOOL_DODIRS) "$(SUBDIRS) $(SUBDIRS_NEEDED) $(SUBDIRS_LIB) $(SUBDIRS_EXECUTABLES) $(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
828! endif
829!endif
830!ifdef PREMAKEFILES_DEP
831 @$(TOOL_DOMAKES) "$(PREMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
832!else
833! if "$(PREMAKEFILES)$(PREMAKEFILES_NEEDED)$(PREMAKEFILES_LIB)$(PREMAKEFILES_EXECUTABLES)$(PREMAKEFILES_MISC)" != ""
834 @$(TOOL_DOMAKES) "$(PREMAKEFILES) $(PREMAKEFILES_NEEDED) $(PREMAKEFILES_LIB) $(PREMAKEFILES_EXECUTABLES) $(PREMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
835! endif
836!endif
837!ifdef POSTMAKEFILES_DEP
838 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_DEP)" $(TOOL_MAKE) NODEP=1 $@
839!else
840! if "$(POSTMAKEFILES)$(POSTMAKEFILES_NEEDED)$(POSTMAKEFILES_LIB)$(POSTMAKEFILES_EXECUTABLES)$(POSTMAKEFILES_MISC)" != ""
841 @$(TOOL_DOMAKES) "$(POSTMAKEFILES) $(POSTMAKEFILES_NEEDED) $(POSTMAKEFILES_LIB) $(POSTMAKEFILES_EXECUTABLES) $(POSTMAKEFILES_MISC)" $(TOOL_MAKE) NODEP=1 $@
842! endif
843!endif
844
845
846
847# -----------------------------------------------------------------------------
848# Pass 2 - The needed rule - Make need tools.
849# That is tools and stuff that is required for the next passes.
850# WARNING! These tools and stuff shouldn't rely on libraries and other
851# results of later passes.
852# -----------------------------------------------------------------------------
853!ifdef SUBDIRS_NEEDED
854_SUBDIRS_NEEDED = _subdir_needed
855$(_SUBDIRS_NEEDED):
856 @$(TOOL_DODIRS) "$(SUBDIRS_NEEDED)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
857!else
858! ifdef SUBDIRS
859_SUBDIRS_NEEDED = _subdir_needed
860$(_SUBDIRS_NEEDED):
861 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) needed
862! endif
863!endif
864
865!ifdef PREMAKEFILES_NEEDED
866_PREMAKEFILES_NEEDED = _premakefiles_needed
867$(_PREMAKEFILES_NEEDED):
868 @$(TOOL_DOMAKES) "$(PREMAKEFILES_NEEDED)" $(TOOL_MAKE) needed
869!else
870! ifdef PREMAKEFILES
871_PREMAKEFILES_NEEDED = _premakefiles_needed
872$(_PREMAKEFILES_NEEDED):
873 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) needed
874! endif
875!endif
876
877!ifdef TARGET_NEEDED
878needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED) target
879!else
880needed: $(_SUBDIRS_NEEDED) $(_PREMAKEFILES_NEEDED)
881!endif
882!ifdef POSTMAKEFILES_NEEDED
883 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_NEEDED)" $(TOOL_MAKE) $@
884!else
885! ifdef POSTMAKEFILES
886 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
887! endif
888!endif
889
890
891
892# -----------------------------------------------------------------------------
893# Pass 3 - The lib rule - Make libraries.
894# -----------------------------------------------------------------------------
895!ifdef SUBDIRS_LIB
896_SUBDIRS_LIB = _subdir_lib
897$(_SUBDIRS_LIB):
898 @$(TOOL_DODIRS) "$(SUBDIRS_LIB)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
899!else
900! ifdef SUBDIRS
901_SUBDIRS_LIB = _subdir_lib
902$(_SUBDIRS_LIB):
903 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
904! endif
905!endif
906
907!ifdef PREMAKEFILES_LIB
908_PREMAKEFILES_LIB = _premakefiles_lib
909$(_PREMAKEFILES_LIB):
910 @$(TOOL_DOMAKES) "$(PREMAKEFILES_LIB)" $(TOOL_MAKE) lib
911!else
912! ifdef PREMAKEFILES
913_PREMAKEFILES_LIB = _premakefiles_lib
914$(_PREMAKEFILES_LIB):
915 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
916! endif
917!endif
918
919lib: $(_SUBDIRS_LIB) $(_PREMAKEFILES_LIB) \
920!if !defined(TARGET_NEEDED) && ("$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB")
921 $(TARGET) $(_TARGET_EARLY_PUBLISH) \
922!endif
923 $(TARGET_ILIB)
924!ifdef POSTMAKEFILES_LIB
925 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_LIB)" $(TOOL_MAKE) $@
926!else
927! ifdef POSTMAKEFILES
928 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
929! endif
930!endif
931
932
933
934# -----------------------------------------------------------------------------
935# Pass 4 - The executable rule - Build the executables.
936# -----------------------------------------------------------------------------
937!ifdef SUBDIRS_EXECUTABLE
938_SUBDIRS_EXECUTABLE = _subdir_executable
939$(_SUBDIRS_EXECUTABLE):
940 @$(TOOL_DODIRS) "$(SUBDIRS_EXECUTABLE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
941!else
942! ifdef SUBDIRS
943_SUBDIRS_EXECUTABLE = _subdir_executable
944$(_SUBDIRS_EXECUTABLE):
945 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) executable
946! endif
947!endif
948
949!ifdef PREMAKEFILES_EXECUTABLE
950_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
951$(_PREMAKEFILES_EXECUTABLE):
952 @$(TOOL_DOMAKES) "$(PREMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) executable
953!else
954! ifdef PREMAKEFILES
955_PREMAKEFILES_EXECUTABLE = _premakefiles_executable
956$(_PREMAKEFILES_EXECUTABLE):
957 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) executable
958! endif
959!endif
960
961executable: \
962!if "$(TARGET_MODE)" != "LIB" && "$(TARGET_MODE)" != "SYSLIB" && "$(TARGET_MODE)" != "IFSLIB" && !defined(TARGET_NEEDED)
963 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE) $(TARGET) $(_TARGET_EARLY_PUBLISH)
964!else
965 $(_SUBDIRS_EXECUTABLE) $(_PREMAKEFILES_EXECUTABLE)
966!endif
967!ifdef POSTMAKEFILES_EXECUTABLE
968 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_EXECUTABLE)" $(TOOL_MAKE) $@
969!else
970! ifdef POSTMAKEFILES
971 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
972! endif
973!endif
974
975
976
977# -----------------------------------------------------------------------------
978# Pass 5 - The miscellaneous rule - Makes other miscellaneous stuff like
979# documentations etc. This is experimental for the moment.
980# -----------------------------------------------------------------------------
981!ifdef SUBDIRS_MISC
982_SUBDIRS_MISC = _subdir_misc
983$(_SUBDIRS_MISC):
984 @$(TOOL_DODIRS) "$(SUBDIRS_MISC)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
985!else
986! ifdef SUBDIRS
987_SUBDIRS_MISC = _subdir_misc
988$(_SUBDIRS_MISC):
989 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) miscellaneous
990! endif
991!endif
992
993!ifdef PREMAKEFILES_MISC
994_PREMAKEFILES_MISC = _premakefiles_misc
995$(PREMAKEFILES_MISC):
996 @$(TOOL_DOMAKES) "$(PREMAKEFILES_MISC)" $(TOOL_MAKE) miscellaneous
997!else
998! ifdef PREMAKEFILES
999_PREMAKEFILES_MISC = _premakefiles_misc
1000$(_PREMAKEFILES_MISC):
1001 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) miscellaneous
1002! endif
1003!endif
1004
1005miscellaneous: $(_SUBDIRS_MISC) $(_PREMAKEFILES_MISC) \
1006 $(TARGET_DOCS) $(TARGET_MISC)
1007!if "$(TARGET_DOCS)$(TARGET_MISC)" != ""
1008 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET_DOCS) $(TARGET_MISC)$(CLRRST)
1009!endif
1010!ifdef POSTMAKEFILES_MISC
1011 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_MISC)" $(TOOL_MAKE) $@
1012!else
1013! ifdef POSTMAKEFILES
1014 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1015! endif
1016!endif
1017
1018
1019
1020# -----------------------------------------------------------------------------
1021# Pass 6 - The publish rule - Copies target to main binary directory.
1022# Installation order is not concidered vital, so subdirectories and
1023# pre-makefiles are processed after this directory.
1024# However, this order might be changed!
1025# -----------------------------------------------------------------------------
1026!if "$(_TARGET_EARLY_PUBLISH)" != ""
1027publish:
1028!else
1029publish: publish_target
1030!endif
1031!ifdef SUBDIRS_PUBLISH
1032 @$(TOOL_DODIRS) "$(SUBDIRS_PUBLISH)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1033!else
1034! ifdef SUBDIRS
1035 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1036! endif
1037!endif
1038!ifdef PREMAKEFILES_PUBLISH
1039 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1040!else
1041! ifdef PREMAKEFILES
1042 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1043! endif
1044!endif
1045!ifdef POSTMAKEFILES_PUBLISH
1046 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PUBLISH)" $(TOOL_MAKE) $@
1047!else
1048! ifdef POSTMAKEFILES
1049 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1050! endif
1051!endif
1052
1053
1054#
1055# Publish rule which doesn't go down into subdirs and submakes.
1056# This one is invoked when a target is 'needed' or early published.
1057#
1058publish_target:
1059!if "$(_TARGET_EARLY_PUBLISH)" != "" || "$(TARGET_MODE:LIB=cute)" == "$(TARGET_MODE)"
1060! if "$(TARGET_MODE)" != "EMPTY" && "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1061 @$(ECHO) Publishing $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR)\$(TARGET_PUB_SUB)$(CLRRST)
1062 @if not exist "$(TARGET)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1063 @if not exist "$(TARGET_PUB_DIR)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR)
1064 @if exist "$(TARGET)" $(TOOL_COPY) "$(TARGET)" "$(TARGET_PUB)"
1065 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR)"
1066! if "$(TARGET_PUB_DEB)" != ""
1067 @$(ECHO) Publishing unstripped $(CLRFIL)$(TARGET)$(CLRTXT) to directory $(CLRFIL)$(TARGET_PUB_DIR_DEB)$(CLRRST)
1068 @if not exist "$(_TARGET_DEB)" $(TOOL_ECHO) $(CLRERR)WARNING: $(CLRFIL)$(_TARGET)$(CLRERR) doesn't exist. $(CLRRST)
1069 @if not exist "$(TARGET_PUB_DIR_DEB)" $(TOOL_CREATEPATH) $(TARGET_PUB_DIR_DEB)
1070 @if exist "$(_TARGET_DEB)" $(TOOL_COPY) "$(_TARGET_DEB)" "$(TARGET_PUB_DEB)"
1071 @if exist "$(TARGET_SYM)" $(TOOL_COPY) "$(TARGET_SYM)" "$(TARGET_PUB_DIR_DEB)"
1072! endif
1073! endif
1074!endif
1075!if "$(TARGET_DOCS)" != ""
1076 $(TOOL_COPY) $(TARGET_DOCS) $(PATH_DOC)
1077!endif
1078
1079
1080
1081# -----------------------------------------------------------------------------
1082# Pass x - The testcase rule - Execute testcases when present.
1083# Testcases are either a testcase.mak file or a testcase subdirectory.
1084# -----------------------------------------------------------------------------
1085!if "$(TARGET_MODE)" != "TESTCASE"
1086!ifndef BUILD_OWN_TESTCASE_RULE
1087
1088!ifndef MAKEVER
1089_TESTCASE_TST1 = [$(TOOL_EXISTS) testcase] == 0
1090_TESTCASE_TST2 = [$(TOOL_EXISTS) testcase.mak] == 0
1091!else
1092_TESTCASE_TST1 = exists(testcase) != 0
1093_TESTCASE_TST2 = exists(testcase.mak) != 0
1094!endif
1095
1096testcase:
1097 @$(ECHO) Executing testcases $(CLRRST)
1098!if $(_TESTCASE_TST1)
1099 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1100!endif
1101!if $(_TESTCASE_TST2)
1102 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
1103!endif
1104!ifdef SUBDIRS_TESTCASE
1105 @$(TOOL_DODIRS) "$(SUBDIRS_TESTCASE)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1106!else
1107! ifdef SUBDIRS
1108 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1109! endif
1110!endif
1111!ifdef PREMAKEFILES_TESTCASE
1112 @$(TOOL_DOMAKES) "$(PREMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1113!else
1114! ifdef PREMAKEFILES
1115 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1116! endif
1117!endif
1118!ifdef POSTMAKEFILES_TESTCASE
1119 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_TESTCASE)" $(TOOL_MAKE) $@
1120!else
1121! ifdef POSTMAKEFILES
1122 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1123! endif
1124!endif
1125
1126!endif # BUILD_OWN_TESTCASE_RULE
1127!endif #!TESTCASE
1128
1129
1130# -----------------------------------------------------------------------------
1131# Pass x - The packing rule - traverse subdirs etc.
1132# -----------------------------------------------------------------------------
1133!ifdef SUBDIRS_PACKING
1134_SUBDIRS_PACKING = _subdir_packing
1135$(_SUBDIRS_PACKING):
1136 @$(TOOL_DODIRS) "$(SUBDIRS_PACKING)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1137!else
1138! ifdef SUBDIRS
1139_SUBDIRS_PACKING = _subdir_packing
1140$(_SUBDIRS_PACKING):
1141 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) packing
1142! endif
1143!endif
1144
1145!ifdef PREMAKEFILES_PACKING
1146_PREMAKEFILES_PACKING = _premakefiles_packing
1147$(PREMAKEFILES_PACKING):
1148 @$(TOOL_DOMAKES) "$(PREMAKEFILES_PACKING)" $(TOOL_MAKE) packing
1149!else
1150! ifdef PREMAKEFILES
1151_PREMAKEFILES_PACKING = _premakefiles_packing
1152$(_PREMAKEFILES_PACKING):
1153 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) packing
1154! endif
1155!endif
1156
1157!if "$(RULE_PACKING)" == "packing"
1158_packing: \
1159!else
1160packing: \
1161!endif
1162 $(_SUBDIRS_PACKING) $(_PREMAKEFILES_PACKING) $(RULE_PACKING)
1163!ifdef POSTMAKEFILES_PACKING
1164 @$(TOOL_DOMAKES) "$(POSTMAKEFILES_PACKING)" $(TOOL_MAKE) $@
1165!else
1166! ifdef POSTMAKEFILES
1167 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1168! endif
1169!endif
1170 $(ECHO) .$(CLRRST)
1171
1172
1173
1174# -----------------------------------------------------------------------------
1175# The target rule - Build the target.
1176# NOTE! NO SUBDIRS OR POST/PREMAKED INVOLVED!
1177# -----------------------------------------------------------------------------
1178target: $(TARGET) $(TARGET_ILIB) $(_TARGET_EARLY_PUBLISH)
1179!if "$(TARGET)$(TARGET_ILIB)" != ""
1180 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
1181!else
1182 @$(ECHO) .$(CLRRST)
1183!endif
1184
1185
1186
1187# -----------------------------------------------------------------------------
1188# The shell rule - Setup the correcte shell environment and start a shell.
1189# -----------------------------------------------------------------------------
1190shell:
1191 @$(ECHO) Creating work shell $(CLRRST)
1192 \
1193!ifndef BUILD_VERBOSE
1194 @ \
1195!endif
1196 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
1197 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
1198
1199
1200
1201# -----------------------------------------------------------------------------
1202# The nothing rule - Rule for testing the makefile structure.
1203# -----------------------------------------------------------------------------
1204nothing:
1205 @$(ECHO) Doing nothing in $(MAKEFILE).
1206!ifdef SUBDIRS
1207 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
1208!endif
1209!ifdef PREMAKEFILES
1210 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
1211!endif
1212!ifdef POSTMAKEFILES
1213 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
1214!endif
1215 @$(ECHO) Completed nothing in $(MAKEFILE).
1216
1217
1218
1219# -----------------------------------------------------------------------------
1220# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
1221# -----------------------------------------------------------------------------
1222!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
1223$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS) $(TARGET_LIBS)
1224!if "$(TOOL_JOB_WAIT)" != ""
1225! ifndef BUILD_QUIET
1226 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1227! endif
1228 \
1229! ifndef BUILD_VERBOSE
1230 @ \
1231! endif
1232 $(TOOL_JOB_WAIT)
1233!endif
1234 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
1235 \
1236!ifndef BUILD_VERBOSE
1237 @ \
1238!endif
1239!ifdef TARGET_IGNORE_LINKER_WARNINGS
1240 -4 \
1241!endif
1242!if "$(TARGET_MODE)" == "EXE"
1243 $(LINK_CMD_EXE)
1244!endif
1245!if "$(TARGET_MODE)" == "DLL"
1246 $(LINK_CMD_DLL)
1247!endif
1248!if "$(TARGET_MODE)" == "SYS"
1249 $(LINK_CMD_SYS)
1250!endif
1251!if "$(TARGET_MODE)" == "IFS"
1252 $(LINK_CMD_IFS)
1253!endif
1254!if "$(TARGET_MODE)" == "VDD"
1255 $(LINK_CMD_VDD)
1256!endif
1257!if "$(TARGET_RES)" != "" && "$(RL)" != ""
1258 @$(ECHO) Linking Resources $(CLRRST)
1259 \
1260! ifndef BUILD_VERBOSE
1261 @ \
1262! endif
1263 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
1264!endif
1265!if "$(TARGET_DLLRNAME)" != ""
1266 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
1267 \
1268! ifndef BUILD_VERBOSE
1269 @ \
1270! endif
1271 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
1272!endif
1273!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
1274 \
1275! ifndef BUILD_VERBOSE
1276 @ \
1277! endif
1278 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
1279!endif
1280!if "$(BUILD_MODE)" == "RELEASE"
1281 \
1282! ifndef BUILD_VERBOSE
1283 @ \
1284! endif
1285 $(TOOL_COPY) "$@" "$(_TARGET_DEB)"
1286! if "$(TOOL_STRIP)" != ""
1287 \
1288! ifndef BUILD_VERBOSE
1289 @ \
1290! endif
1291 $(TOOL_STRIP) $@
1292! endif
1293!endif
1294
1295
1296#
1297# Linker parameter file.
1298#
1299$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1300!ifndef TOOL_DEFCONV
1301 @$(TOOL_ECHOTXT) Creating Linker Input File $(CLRRST)<<$@
1302$(LINK_LNK1)
1303$(LINK_LNK2)
1304$(LINK_LNK3)
1305$(LINK_LNK4)
1306$(LINK_LNK5)
1307<<KEEP
1308!else
1309 @$(ECHO) Creating Linker Input File $(CLRRST) $@
1310 @$(TOOL_RM) "$@"
1311 \
1312! ifdef BUILD_VERBOSE
1313 @ \
1314! endif
1315 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $@ <<$(TARGET_LNK)2
1316#
1317# LINK_LNK[1-5]:
1318#
1319$(LINK_LNK1)
1320$(LINK_LNK2)
1321$(LINK_LNK3)
1322$(LINK_LNK4)
1323$(LINK_LNK5)
1324<<keep
1325!endif
1326!ifdef BUILD_VERBOSE
1327 @type $@
1328!endif
1329
1330
1331#
1332# Builddef modified definition file.
1333#
1334!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
1335$(TARGET_DEF_LINK): $(TARGET_DEF)
1336! ifndef BUILD_QUIET
1337 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
1338! endif
1339 \
1340! ifndef BUILD_VERBOSE
1341 @ \
1342! endif
1343 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$** $** $@
1344!endif
1345
1346!endif
1347
1348
1349# -----------------------------------------------------------------------------
1350# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
1351# -----------------------------------------------------------------------------
1352!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
1353$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
1354!if "$(TOOL_JOB_WAIT)" != ""
1355! ifndef BUILD_QUIET
1356 @$(ECHO) Waiting for jobs to complete $(CLRRST)
1357! endif
1358 \
1359! ifndef BUILD_VERBOSE
1360 @ \
1361! endif
1362 $(TOOL_JOB_WAIT)
1363!endif
1364 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
1365!ifndef BUILD_VERBOSE
1366 @$(TOOL_RM) "$@"
1367 @$(AR_CMD)
1368!else
1369 $(TOOL_RM) "$@"
1370 $(AR_CMD)
1371!endif
1372
1373
1374#
1375# Lib parameter file.
1376#
1377$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
1378 @$(TOOL_ECHOTXT) Creating Lib Input File $(CLRRST)<<$@
1379$(AR_LNK1)
1380$(AR_LNK2)
1381$(AR_LNK3)
1382$(AR_LNK4)
1383$(AR_LNK5)
1384<<KEEP
1385!ifdef BUILD_VERBOSE
1386 @type $@
1387!endif
1388!endif
1389
1390
1391# -----------------------------------------------------------------------------
1392# The $(TARGET) rule - For DEPEND targets.
1393# -----------------------------------------------------------------------------
1394!if "$(TARGET_MODE)" == "DEPEND"
1395$(TARGET):
1396 @$(ECHO) .
1397!endif
1398
1399
1400
1401# -----------------------------------------------------------------------------
1402# The $(TARGET_ILIB) rule - Make import library.
1403# -----------------------------------------------------------------------------
1404!ifdef TARGET_ILIB
1405$(TARGET_ILIB): $(TARGET_IDEF)
1406 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
1407 \
1408!ifndef BUILD_VERBOSE
1409 @if not exist $(@D) $(ECHO) Target implib path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1410!endif
1411 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1412 \
1413!ifndef BUILD_VERBOSE
1414 @ \
1415!endif
1416 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
1417
1418
1419#
1420# Conversion rule for converting the .def file before passing along to implib.
1421#
1422! if "$(TARGET_IDEF_ORG)" != "" && "$(TARGET_IDEF_ORG)" != "$(TARGET_IDEF)"
1423$(TARGET_IDEF): $(TARGET_IDEF_ORG)
1424 @$(ECHO) Making Import Definition File $(CLRFIL)$@ $(CLRRST)
1425 \
1426!ifndef BUILD_VERBOSE
1427 @if not exist $(@D) $(ECHO) Target .def path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
1428!endif
1429 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
1430 \
1431!ifndef BUILD_VERBOSE
1432 @ \
1433!endif
1434 $(TOOL_IDEFCONV) $(TOOL_IDEFCONV_FLAGS) $(TARGET_IDEF_ORG) $@
1435! endif
1436
1437!endif
1438
1439
1440
1441# -----------------------------------------------------------------------------
1442# The .force rule - Force a remake of something everytime.
1443# -----------------------------------------------------------------------------
1444.force:
1445!ifndef BUILD_VERBOSE
1446 @$(ECHO) .
1447!else
1448 @$(ECHO) . (force) .
1449!endif
1450
1451
1452
1453# -----------------------------------------------------------------------------
1454# Read Dependencies.
1455# -----------------------------------------------------------------------------
1456!if "$(TARGET_MODE)" != "TESTCASE" && "$(TARGET_MODE)" != "DEPEND"
1457!if "$(TARGET_MODE)" != "EMPTY" && "$(NODEP)" == ""
1458
1459#
1460# Read dependency file for current directory
1461#
1462!ifndef MAKEVER
1463! if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
1464! ifdef BUILD_VERBOSE
1465! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
1466! endif
1467! endif
1468! include $(TARGET_DEPEND)
1469! else
1470#! ifndef NODEP
1471#! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
1472#! endif
1473#! endif
1474! endif
1475!else
1476! if %exists($(TARGET_DEPEND)) != 0
1477! ifdef BUILD_VERBOSE
1478$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)
1479! endif
1480! include $(TARGET_DEPEND)
1481! else
1482#! ifndef NODEP
1483#$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)
1484#! endif
1485! endif
1486!endif
1487
1488
1489#
1490# Read global dependency files.
1491#
1492!ifdef BUILD_DEPEND1
1493! ifndef MAKEVER
1494! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
1495! ifdef BUILD_VERBOSE
1496! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
1497! endif
1498! endif
1499! include $(BUILD_DEPEND1)
1500! else
1501! ifndef NODEP
1502! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
1503! endif
1504! endif
1505! endif
1506! else
1507! if %exists($(BUILD_DEPEND1)) != 0
1508! ifdef BUILD_VERBOSE
1509$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)
1510! endif
1511! include $(BUILD_DEPEND1)
1512! else
1513! ifndef NODEP
1514$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)
1515! endif
1516! endif
1517! endif
1518!endif
1519
1520
1521!ifdef BUILD_DEPEND2
1522! ifndef MAKEVER
1523! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
1524! ifdef BUILD_VERBOSE
1525! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
1526! endif
1527! endif
1528! include $(BUILD_DEPEND2)
1529! else
1530! ifndef NODEP
1531! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
1532! endif
1533! endif
1534! endif
1535! else
1536! if %exists($(BUILD_DEPEND2)) != 0
1537! ifdef BUILD_VERBOSE
1538$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)
1539! endif
1540! include $(BUILD_DEPEND2)
1541! else
1542! ifndef NODEP
1543$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)
1544! endif
1545! endif
1546! endif
1547!endif
1548
1549
1550!ifdef BUILD_DEPEND3
1551! ifndef MAKEVER
1552! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
1553! ifdef BUILD_VERBOSE
1554! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
1555! endif
1556! endif
1557! include $(BUILD_DEPEND3)
1558! else
1559! ifndef NODEP
1560! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
1561! endif
1562! endif
1563! endif
1564! else
1565! if %exists($(BUILD_DEPEND3)) != 0
1566! ifdef BUILD_VERBOSE
1567$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)
1568! endif
1569! include $(BUILD_DEPEND3)
1570! else
1571! ifndef NODEP
1572$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)
1573! endif
1574! endif
1575! endif
1576!endif
1577
1578
1579!endif
1580
1581
1582#
1583# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
1584#
1585!if "$(BUILD_MULTIJOBS)" != ""
1586! if [$(TOOL_JOB_UP)] != 0
1587! if "$(BUILD_QUITE)" == ""
1588! ifndef MAKEVER
1589! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
1590! endif
1591! else
1592$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)
1593! endif
1594! endif
1595! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
1596! ifndef MAKEVER
1597! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
1598! endif
1599! error
1600!else
1601! error $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)
1602!endif
1603! endif
1604! endif
1605!endif
1606
1607!endif #!TESTCASE
1608
1609
1610#
1611# Include system library dependency stubs.
1612#
1613!include $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)libs.mk
1614
1615
1616#
1617# Check if TARGET_ALWAYS needs to be forced built.
1618#
1619!if "$(TARGET_ALWAYS)" != ""
1620! ifndef BUILD_FORCED_BUILD_TEST
1621! if [$(TOOL_MAKE) BUILD_FORCED_BUILD_TEST=1 -f $(MAKEFILE) -q $(TARGET) $(TARGET_ILIB) >nul 2>nul] != 0
1622$(TARGET_ALWAYS): .force
1623! endif
1624! endif
1625!endif
1626
1627
Note: See TracBrowser for help on using the repository browser.