source: trunk/make/process.mak@ 8423

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

Merged in latest changes.

File size: 26.3 KB
RevLine 
[8423]1# $Id: process.mak,v 1.13 2002-05-16 11:37:00 bird Exp $
[8197]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
[8253]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"
[8423]20! if [$(ECHO) $(CLRERR)Fatal error: You must include setup.mak before process.mak in the makefile.$(CLRRST)]
21! endif
22! error
[8197]23!endif
[8253]24!if "$(ENV_STATUS)" != "OK"
[8423]25! if [$(ECHO) $(CLRERR)Fatal error: The environment is not valid. Bad setup.mak?$(CLRRST)]
26! endif
27! error
[8253]28!endif
[8197]29
[8423]30!if "$(TARGET_NAME)" == "" && "$(TARGET_MODE)" != "EMPTY"
31! if [$(ECHO) $(CLRERR)Fatal error: TARGET_NAME is not defined! Should be set in the makefile.$(CLRRST)]
32! endif
33! error
[8253]34!endif
35
[8290]36!ifdef TARGET_MODE
37# Executable target mode.
38! if "$(TARGET_MODE)" != "EXE"
39# Dynamic Load Library target mode.
40! if "$(TARGET_MODE)" != "DLL"
41# Drive (/ system software) target mode.
[8423]42! if "$(TARGET_MODE)" != "SYS"
[8290]43# Installable File System Drive target mode. (Also called FSD, File System Driver.)
[8423]44! if "$(TARGET_MODE)" != "IFS"
[8290]45# Virtual Device Driver target mode.
[8423]46! if "$(TARGET_MODE)" != "VDD"
[8290]47# Object Library target mode.
[8423]48! if "$(TARGET_MODE)" != "LIB"
[8290]49# Object Library target mode - Special variant which is to be linked with a SYS target.
[8423]50! if "$(TARGET_MODE)" != "SYSLIB"
[8290]51# Object Library target mode - Special variant which is to be linked with an IFS target.
[8423]52! if "$(TARGET_MODE)" != "IFSLIB"
[8290]53# Dummy/Hub/TopLevel empty makefile. This has no target.
[8423]54! if "$(TARGET_MODE)" != "EMPTY"
55! if [$(ECHO) $(CLRERR)Fatal Error: Bad TARGET_MODE="$(TARGET_MODE)". Valid ones are: EXE, DLL, SYS, IFS, VDD, LIB, SYSLIB, IFSLIB and EMPTY.$(CLRRST)]
[8290]56! endif
[8423]57! error
[8290]58! endif
59! endif
60! endif
61! endif
62! endif
63! endif
64! endif
65! endif
66! endif
67!endif
68
69
[8253]70# -----------------------------------------------------------------------------
71# Provide overridable defaults
72# -----------------------------------------------------------------------------
73
74# Default target mode is executable.
75!ifndef TARGET_MODE
76TARGET_MODE = EXE
77!endif
78
79# Default extension corresponds to the target mode.
80!ifndef TARGET_EXT
[8423]81! if "$(TARGET_MODE)" == "DLL"
[8253]82TARGET_EXT = $(EXT_DLL)
83! endif
84! if "$(TARGET_MODE)" == "SYS"
85TARGET_EXT = $(EXT_SYS)
86! endif
[8290]87! if "$(TARGET_MODE)" == "IFS"
88TARGET_EXT = $(EXT_IFS)
89! endif
90! if "$(TARGET_MODE)" == "VDD"
91TARGET_EXT = $(EXT_VDD)
92! endif
[8253]93! if "$(TARGET_MODE)" == "EXE"
94TARGET_EXT = $(EXT_EXE)
95! endif
[8290]96! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
[8253]97TARGET_EXT = $(EXT_LIB)
98! endif
99! if "$(TARGET_MODE)" == "EMPTY"
100TARGET_EXT = empty
101! endif
102! ifndef TARGET_EXT
[8423]103! if [$(ECHO) $(CLRERR)Internal Error: TARGET_EXT not set. Probably invalid TARGET_MODE. (TARGET_MODE="$(TARGET_MODE)")$(CLRRST)]
104! endif
105! error
[8253]106! endif
107!endif
108
109# Default target path. (where all the generated stuff for this target goes)
110!ifndef PATH_TARGET
111PATH_TARGET = $(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
112!endif
113
114# Default target file. (output)
[8197]115!ifndef TARGET
[8270]116! if "$(TARGET_MODE)" != "EMPTY"
[8253]117TARGET = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
[8270]118! endif
[8197]119!endif
120
[8333]121# Default target .sym file. (output)
122!ifndef TARGET_SYM
123TARGET_SYM = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_SYM)
124!endif
[8270]125
[8253]126# Default object file. (output)
[8197]127!ifndef TARGET_OBJS
[8253]128TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
[8197]129!endif
130
[8253]131# Default libraries. (input)
[8197]132!ifndef TARGET_LIBS
[8253]133TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
[8197]134!endif
135
[8253]136# Default definition file. (input)
[8197]137!ifndef TARGET_DEF
[8253]138TARGET_DEF = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
[8197]139!endif
140
[8333]141# Default modified definition filename. (output)
142!ifndef TARGET_DEF_LINK
143TARGET_DEF_LINK = $(PATH_TARGET)\$(TARGET_NAME)_link.def
144!endif
145
[8253]146# Default definition file for generating the import library. (input)
[8197]147!ifndef TARGET_IDEF
[8253]148TARGET_IDEF = $(TARGET_DEF)
[8197]149!endif
150
[8253]151# Default map file. (output)
[8197]152!ifndef TARGET_MAP
[8333]153TARGET_MAP = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_MAP)
[8197]154!endif
155
[8253]156# Default link file. (output)
[8197]157!ifndef TARGET_LNK
[8253]158TARGET_LNK = $(PATH_TARGET)\$(TARGET_NAME).lnk
[8197]159!endif
160
[8253]161# Default import library file. (output)
162!ifndef TARGET_ILIB
[8423]163! if "$(TARGET_MODE)" == "DLL"
[8253]164TARGET_ILIB =$(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
165! endif
[8197]166!endif
167
[8290]168# Default public name. (output)
169!ifndef TARGET_PUBNAME
170TARGET_PUBNAME=
171! ifdef TARGET_PUBLIC
172! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
173TARGET_PUBNAME=$(PATH_LIB)\$(TARGET_NAME).$(TARGET_EXT)
174! endif
175! if "$(TARGET_MODE)" == "EXE"
176TARGET_PUBNAME=$(PATH_EXE)\$(TARGET_NAME).$(TARGET_EXT)
177! endif
[8423]178! if "$(TARGET_MODE)" == "DLL"
[8290]179TARGET_PUBNAME=$(PATH_DLL)\$(TARGET_NAME).$(TARGET_EXT)
180! endif
181! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
182TARGET_PUBNAME=$(PATH_SYS)\$(TARGET_NAME).$(TARGET_EXT)
183! endif
184! if "$(TARGET_MODE)" == "VDD"
185TARGET_PUBNAME=$(PATH_VDD)\$(TARGET_NAME).$(TARGET_EXT)
186! endif
[8253]187! endif
[8197]188!endif
[8253]189
190# Default depend filename.
191!ifndef TARGET_DEPEND
192TARGET_DEPEND = $(PATH_TARGET)\.depend
[8197]193!endif
194
[8423]195# Default makefile names.
196!ifndef BUILD_MAKEFILE
197BUILD_MAKEFILE = Makefile
198!endif
199
[8253]200# Default makefile name.
201!ifndef MAKEFILE
[8423]202MAKEFILE = $(BUILD_MAKEFILE)
[8197]203!endif
204
[8253]205# Ignore linker warnings for some target modes.
206!ifndef TARGET_IGNORE_LINKER_WARNINGS
[8423]207! if "$(TARGET_MODE)" == "DLL"
[8253]208TARGET_IGNORE_LINKER_WARNINGS = 1
209! endif
[8197]210!endif
211
212
[8253]213# Default stacksize
[8355]214# If 16bit: 8KB
215# Else (32bit): 64KB
[8197]216!ifndef TARGET_STACKSIZE
[8355]217! ifdef ENV_16BIT
[8197]218TARGET_STACKSIZE=0x2000
219! else
220TARGET_STACKSIZE=0x10000
221! endif
222!endif
223
[8253]224
225
226# -----------------------------------------------------------------------------
227# Tell user what we're building.
228# -----------------------------------------------------------------------------
229!ifndef BUILD_QUIET
230!if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
[8197]231!endif
[8253]232!endif
[8197]233
234
[8253]235# -----------------------------------------------------------------------------
236# Ensure the platform-specific target path exists
237# -----------------------------------------------------------------------------
238
239!if "$(TARGET_MODE)" != "EMPTY"
240! if "$(PATH_TARGET)" != ""
241! if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
242! ifndef BUILD_QUIET
243! if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
244! endif
245! endif
246! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
[8423]247! if [$(ECHO) $(CLRERR)Error: Could not create $(CLRFIL)$(PATH_TARGET)$(CLRRST)]
248! endif
249! error
[8253]250! endif
[8197]251! endif
252! endif
253!endif
[8253]254# not 100% sure about the != EMPTY stuff, but this is way faster.
[8197]255
256
257
[8253]258# -----------------------------------------------------------------------------
259# Common inference rules
260# -----------------------------------------------------------------------------
[8197]261
262.SUFFIXES:
[8213]263.SUFFIXES: .$(EXT_OBJ) .c .cpp .asm .$(EXT_RES) .rc .pre-c .pre-cpp # .h .def
[8197]264
265
266# Assembling assembly source.
267.asm{$(PATH_TARGET)}.$(EXT_OBJ):
[8423]268 @$(ECHO) Assembling $(CLRFIL)$< $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
269! ifndef BUILD_VERBOSE
[8290]270 @ \
[8423]271! endif
[8213]272!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
[8423]273 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS_SYS) $< $(AS_OBJ_OUT)$@
[8197]274!else
[8423]275 $(TOOL_JOB_SUB) $(AS) $(AS_FLAGS) $< $(AS_OBJ_OUT)$@
[8197]276!endif
277
278.asm.$(EXT_OBJ):
279 @$(ECHO) Assembling $(CLRFIL)$< $(CLRRST)
[8290]280!ifndef BUILD_VERBOSE
281 @ \
282!endif
[8213]283!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
[8290]284 $(AS) $(AS_FLAGS_SYS) $< $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
[8197]285!else
[8290]286 $(AS) $(AS_FLAGS) $< $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
[8197]287!endif
288
289
290# Compiling C++ source.
291.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
[8423]292 @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
[8290]293!ifndef BUILD_VERBOSE
294 @ \
295!endif
[8423]296 $(TOOL_JOB_SUB) $(CXX) \
[8290]297!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]298 $(CXX_FLAGS_EXE) \
299!endif
300!if "$(TARGET_MODE)" == "DLL"
301 $(CXX_FLAGS_DLL) \
302!endif
303!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
304 $(CXX_FLAGS_SYS) \
305!endif
[8213]306!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
307 $(CXX_FLAGS_IFS) \
308!endif
[8253]309!if "$(CXX_LST_OUT)" != ""
[8213]310 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
311!endif
[8197]312 $(CXX_OBJ_OUT)$@ $<
313
314.cpp.$(EXT_OBJ):
315 @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
[8290]316!ifndef BUILD_VERBOSE
317 @ \
318!endif
319 $(CXX) \
320!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]321 $(CXX_FLAGS_EXE) \
322!endif
323!if "$(TARGET_MODE)" == "DLL"
324 $(CXX_FLAGS_DLL) \
325!endif
326!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
327 $(CXX_FLAGS_SYS) \
328!endif
[8213]329!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
330 $(CXX_FLAGS_IFS) \
331!endif
[8253]332!if "$(CXX_LST_OUT)" != ""
[8213]333 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
334!endif
[8197]335 $(CXX_OBJ_OUT)$(PATH_TARGET)\$(@F) $<
336
337
338# Pre-Compiling C++ source.
339.cpp.pre-cpp:
340 @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
[8290]341!ifndef BUILD_VERBOSE
342 @ \
343!endif
344 $(CXX) \
345!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]346 $(CXX_FLAGS_EXE) \
347!endif
348!if "$(TARGET_MODE)" == "DLL"
349 $(CXX_FLAGS_DLL) \
350!endif
351!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
352 $(CXX_FLAGS_SYS) \
353!endif
[8213]354!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
355 $(CXX_FLAGS_IFS) \
356!endif
[8197]357 $(CXX_PC_2_STDOUT) $< > $@
358
359
360# Compiling C source.
361.c{$(PATH_TARGET)}.$(EXT_OBJ):
[8423]362 @$(ECHO) C Compiler $(CLRFIL)$< $(CLRTXT)$(TOOL_JOB_SUB_MSG) $(CLRRST)
[8290]363!ifndef BUILD_VERBOSE
364 @ \
365!endif
[8423]366 $(TOOL_JOB_SUB) $(CC) \
[8290]367!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]368 $(CC_FLAGS_EXE) \
369!endif
370!if "$(TARGET_MODE)" == "DLL"
371 $(CC_FLAGS_DLL) \
372!endif
373!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
374 $(CC_FLAGS_SYS) \
375!endif
[8213]376!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
377 $(CC_FLAGS_IFS) \
378!endif
[8253]379!if "$(CC_LST_OUT)" != ""
[8213]380 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
381!endif
[8197]382 $(CC_OBJ_OUT)$@ $<
383
384.c.$(EXT_OBJ):
385 @$(ECHO) C Compiler $(CLRFIL)$< $(CLRRST)
[8290]386!ifndef BUILD_VERBOSE
387 @ \
388!endif
389 $(CC) \
390!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]391 $(CC_FLAGS_EXE) \
392!endif
393!if "$(TARGET_MODE)" == "DLL"
394 $(CC_FLAGS_DLL) \
395!endif
396!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
397 $(CC_FLAGS_SYS) \
398!endif
[8213]399!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
400 $(CC_FLAGS_IFS) \
401!endif
[8253]402!if "$(CC_LST_OUT)" != ""
[8213]403 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
404!endif
[8197]405 $(CC_OBJ_OUT)$(PATH_TARGET)\$(@F) $<
406
407
408# Pre-Compiling C source.
409.c.pre-c:
410 @$(ECHO) C PreCompiler $(CLRFIL)$< $(CLRRST)
[8290]411!ifndef BUILD_VERBOSE
412 @ \
413!endif
414 $(CC) \
415!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
[8197]416 $(CC_FLAGS_EXE) \
417!endif
418!if "$(TARGET_MODE)" == "DLL"
419 $(CC_FLAGS_DLL) \
420!endif
421!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
422 $(CC_FLAGS_SYS) \
423!endif
[8213]424!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
425 $(CC_FLAGS_IFS) \
426!endif
[8197]427 $(CC_PC_2_STDOUT) $< > $@
428
429
430# Compiling resources.
431.rc{$(PATH_TARGET)}.res:
[8423]432 @$(ECHO) RC Compiler $(CLRFIL)$< $(CLRTXT)$(TOOL_JOB_SUB_MSG)$(CLRRST)
[8290]433!ifndef BUILD_VERBOSE
434 @ \
435!endif
[8423]436 $(TOOL_JOB_SUB) $(RC) $(RC_FLAGS) $< $@
[8197]437
438.rc.res:
439 @$(ECHO) RC Compiler $(CLRFIL)$< $(CLRRST)
[8290]440!ifndef BUILD_VERBOSE
441 @ \
442!endif
443 $(RC) $(RC_FLAGS) $< $(PATH_TARGET)\$(@F)
[8197]444
445
[8253]446
447
448
449# -----------------------------------------------------------------------------
450# The all rule - The default one, as it's the first rule in the file.
451# -----------------------------------------------------------------------------
[8197]452all: build
453
454
[8253]455
456# -----------------------------------------------------------------------------
457# The build rule - Build the target.
458# Must take into account any subdirectories and makefiles which is is to be
459# made before and after the target. That makes it kind of messy, sorry.
460# -----------------------------------------------------------------------------
[8197]461!ifdef SUBDIRS
462SUBDIRS_BUILD = subbuild
463$(SUBDIRS_BUILD):
[8423]464 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) build
[8197]465!endif
466
467!ifdef PREMAKEFILES
468PREMAKEFILES_BUILD = premakefiles_build
469$(PREMAKEFILES_BUILD):
470 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) build
471!endif
472
[8290]473build: $(SUBDIRS_BUILD) $(PREMAKEFILES_BUILD) $(TARGET) $(TARGET_ILIB) $(TARGET_PUBNAME)
[8197]474 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
475!ifdef POSTMAKEFILES
476 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
477!endif
478
479
[8253]480
481# -----------------------------------------------------------------------------
482# The lib rule - Make Public libraries.
483# Must take into account any subdirectories and makefiles which is is to be
484# made before and after the target. That makes it kind of messy, sorry.
485# -----------------------------------------------------------------------------
[8197]486!ifdef SUBDIRS
487SUBDIRS_LIB = subdir_lib
488$(SUBDIRS_LIB):
[8423]489 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) lib
[8197]490!endif
491
492!ifdef PREMAKEFILES
493PREMAKEFILES_LIB = premakefiles_lib
494$(PREMAKEFILES_LIB):
495 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
496!endif
497
[8423]498!if "$(TARGET_PUBLIC_PART)" != "" && ("$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB")
[8319]499lib: $(SUBDIRS_LIB) $(TARGET_ILIB) $(TARGET) $(TARGET_PUBNAME)
[8290]500!else
501lib: $(SUBDIRS_LIB) $(TARGET_ILIB)
502!endif
[8197]503!ifdef POSTMAKEFILES
504 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
505!endif
506
507
[8253]508
509# -----------------------------------------------------------------------------
510# The install rule - Copies target to main binary directory.
511# Installation order is not concidered vital, so subdirectories and
512# pre-makefiles are processed after this directory. This might be changed.
513# -----------------------------------------------------------------------------
[8197]514install:
[8290]515!if "$(TARGET_PUBLIC)" == ""
516! if "$(TARGET_MODE)" == "EXE"
517 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_BIN)$(CLRRST)
518 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]519 @if not exist $(PATH_BIN) $(TOOL_CREATEPATH) $(PATH_BIN)
[8333]520 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_BIN)
521 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_BIN)
[8290]522! endif
[8423]523! if "$(TARGET_MODE)" == "DLL"
[8290]524 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_DLL)$(CLRRST)
525 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]526 @if not exist $(PATH_DLL) $(TOOL_CREATEPATH) $(PATH_DLL)
[8333]527 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_DLL)
528 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_DLL)
[8290]529! endif
530! if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
531 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_SYS)$(CLRRST)
532 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]533 @if not exist $(PATH_SYS) $(TOOL_CREATEPATH) $(PATH_SYS)
[8333]534 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_SYS)
535 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_SYS)
[8290]536! endif
[8423]537!if 0 # these targets are either TARGET_PUBLIC or all private.
[8290]538! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
539 @$(ECHO) Installing $(CLRFIL)$(TARGET)$(CLRTXT) in directory $(CLRFIL)$(PATH_LIB)$(CLRRST)
540 @if not exist $(TARGET) $(ECHO) $(CLRERR)WARNING: $(CLRFIL)$(TARGET)$(CLRERR) doesn't exist. $(CLRRST)
[8423]541 @if not exist $(PATH_LIB) $(TOOL_CREATEPATH) $(PATH_LIB)
[8333]542 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_LIB)
543 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_LIB)
[8290]544! endif
545! endif
[8197]546!endif
547!if "$(TARGET_DOCS)" != ""
548 $(TOOL_COPY) $(TARGET_DOCS) $(PATH_DOC)
549!endif
550!ifdef SUBDIRS
[8423]551 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]552!endif
553!ifdef PREMAKEFILES
554 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
555!endif
556!ifdef POSTMAKEFILES
557 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
558!endif
559
560
[8253]561
562# -----------------------------------------------------------------------------
563# The testcase rule - Execute testcases when present.
564# Testcases are either a testcase.mak file or a testcase subdirectory.
565# -----------------------------------------------------------------------------
[8265]566!ifndef BUILD_OWN_TESTCASE_RULE
[8290]567testcase:
[8197]568!if [$(TOOL_EXISTS) testcase] == 0
[8423]569 @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]570!endif
571!if [$(TOOL_EXISTS) testcase.mak] == 0
572 @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
573!endif
574!ifdef SUBDIRS
[8423]575 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]576!endif
577!ifdef PREMAKEFILES
578 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
579!endif
580!ifdef POSTMAKEFILES
581 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
582!endif
583!endif
584
585
[8253]586
587# -----------------------------------------------------------------------------
[8298]588# The shell rule - Setup the correcte shell environment and start a shell.
589# -----------------------------------------------------------------------------
590shell:
591!ifndef BUILD_VERBOSE
592 @ \
593!endif
594 -$(TOOL_BUILDENV) $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) \
595 $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST) * $(COMSPEC)
596
597
598
599# -----------------------------------------------------------------------------
[8253]600# The dep rule - Make dependencies.
601# -----------------------------------------------------------------------------
[8197]602dep:
603 @$(ECHO) Building dependencies $(CLRRST)
[8290]604!ifndef BUILD_VERBOSE
605 @ \
606!endif
607 $(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
[8197]608!ifdef TARGET_NO_DEP
609 -x$(TARGET_NO_DEP: =;)\
610!endif
611 $(TOOL_DEP_FILES)
612!ifdef SUBDIRS
[8423]613 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) NODEP=1 $@
[8197]614!endif
615!ifdef PREMAKEFILES
616 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) NODEP=1 $@
617!endif
618!ifdef POSTMAKEFILES
619 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) NODEP=1 $@
620!endif
621
622
[8253]623
624# -----------------------------------------------------------------------------
625# The clean rule - Clean up output files.
626# The current setup doesn't clean the installed ones.
627# -----------------------------------------------------------------------------
[8197]628clean:
629!if "$(PATH_TARGET)" != "" # paranoia
630 $(TOOL_RM) \
631 $(PATH_TARGET)\*.$(EXT_OBJ) \
632 $(PATH_TARGET)\*.$(EXT_ILIB) \
633 $(PATH_TARGET)\*.$(EXT_EXE) \
634 $(PATH_TARGET)\*.$(EXT_DLL) \
[8333]635 $(PATH_TARGET)\*.$(EXT_RES)
636 $(TOOL_RM) \
[8197]637 $(PATH_TARGET)\*.$(EXT_SYS) \
[8333]638 $(PATH_TARGET)\*.$(EXT_LIB) \
639 $(PATH_TARGET)\*.$(EXT_IFS) \
640 $(PATH_TARGET)\*.$(EXT_MAP) \
641 $(PATH_TARGET)\*.$(EXT_SYM)
[8213]642 $(TOOL_RM) \
643 $(PATH_TARGET)\*.s \
644 $(PATH_TARGET)\*.lst \
[8197]645 $(PATH_TARGET)\*.lnk \
646 $(PATH_TARGET)\*.pre-c \
647 $(PATH_TARGET)\*.pre-cpp \
[8213]648 $(PATH_TARGET)\.depend
[8197]649!endif
650!ifdef SUBDIRS
[8423]651 @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) -f $(BUILD_MAKEFILE) $@
[8197]652!endif
653!ifdef PREMAKEFILES
654 @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
655!endif
656!ifdef POSTMAKEFILES
657 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
658!endif
659
660
[8253]661
662# -----------------------------------------------------------------------------
663# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
664# -----------------------------------------------------------------------------
[8423]665!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
[8333]666$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS)
[8423]667!if "$(TOOL_JOB_WAIT)" != ""
668! ifndef BUILD_QUIET
669 @$(ECHO) Waiting for jobs to complete $(CLRRST)
670! endif
671! ifndef BUILD_VERBOSE
672 @ \
673! endif
674 $(TOOL_JOB_WAIT)
675!endif
[8197]676 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
[8290]677!ifndef BUILD_VERBOSE
678 @ \
679!endif
[8197]680!ifdef TARGET_IGNORE_LINKER_WARNINGS
681 -4 \
682!endif
683!if "$(TARGET_MODE)" == "EXE"
[8253]684 $(LINK_CMD_EXE)
[8197]685!endif
[8423]686!if "$(TARGET_MODE)" == "DLL"
[8290]687 $(LINK_CMD_DLL)
[8197]688!endif
689!if "$(TARGET_MODE)" == "SYS"
[8290]690 $(LINK_CMD_SYS)
[8197]691!endif
[8213]692!if "$(TARGET_MODE)" == "IFS"
[8290]693 $(LINK_CMD_IFS)
[8213]694!endif
[8290]695!if "$(TARGET_MODE)" == "VDD"
696 $(LINK_CMD_VDD)
697!endif
[8197]698!if "$(TARGET_RES)" != "" && "$(RL)" != ""
699 @$(ECHO) Linking Resources $(CLRRST)
[8290]700! ifndef BUILD_VERBOSE
701 @ \
702! endif
703 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
[8197]704!endif
705!if "$(TARGET_DLLRNAME)" != ""
706 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
[8290]707! ifndef BUILD_VERBOSE
708 @ \
709! endif
[8197]710 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
711!endif
[8333]712!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
713! ifndef BUILD_VERBOSE
714 @ \
715! endif
716 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
717!endif
[8197]718
719
720#
721# Linker parameter file.
722#
723$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
[8362]724!ifndef TOOL_DEFCONV
[8197]725 @$(ECHO) Creating Linker Input File $(CLRRST)<<$@
726$(LINK_LNK1)
727$(LINK_LNK2)
728$(LINK_LNK3)
729$(LINK_LNK4)
730$(LINK_LNK5)
731<<KEEP
[8362]732!else
733 @$(ECHO) Creating Linker Input File $(CLRRST) $@
734 @$(TOOL_RM) $@
735! ifdef BUILD_VERBOSE
736 @ \
737! endif
738 $(TOOL_DEFCONV) $(TARGET_DEF_LINK) $@ <<$(TARGET_LNK)2
739#
740# LINK_LNK[1-5]:
741#
742$(LINK_LNK1)
743$(LINK_LNK2)
744$(LINK_LNK3)
745$(LINK_LNK4)
746$(LINK_LNK5)
747<<keep
748!endif
[8355]749!ifdef BUILD_VERBOSE
750 @type $@
751!endif
[8333]752
753
754#
755# Builddef modified definition file.
756#
757!if "$(TARGET_DEF_LINK)" != "$(TARGET_DEF)"
758$(TARGET_DEF_LINK): $(TARGET_DEF)
759! ifndef BUILD_QUIET
760 @$(ECHO) Stamping deffile with build level info.$(CLRRST)
761! endif
762! ifndef BUILD_VERBOSE
763 @ \
764! endif
765 $(TOOL_BLDLEVEL) $(BUILD_BLDLEVEL_FLAGS) $(TARGET_BLDLEVEL_FLAGS) -R$** $** $@
[8290]766!endif
[8197]767
[8333]768!endif
[8197]769
[8333]770
[8253]771# -----------------------------------------------------------------------------
[8290]772# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
[8253]773# -----------------------------------------------------------------------------
[8290]774!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
[8197]775$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
[8423]776!if "$(TOOL_JOB_WAIT)" != ""
777! ifndef BUILD_QUIET
778 @$(ECHO) Waiting for jobs to complete $(CLRRST)
779! endif
780! ifndef BUILD_VERBOSE
781 @ \
782! endif
783 $(TOOL_JOB_WAIT)
784!endif
[8197]785 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
[8290]786!ifndef BUILD_VERBOSE
787 @$(TOOL_RM) $@
788 @$(AR_CMD)
789!else
[8197]790 $(TOOL_RM) $@
791 $(AR_CMD)
[8290]792!endif
[8197]793
794
795#
796# Lib parameter file.
797#
798$(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
799 @$(ECHO) Creating Lib Input File $(CLRRST)<<$@
800$(AR_LNK1)
801$(AR_LNK2)
802$(AR_LNK3)
803$(AR_LNK4)
804$(AR_LNK5)
805<<KEEP
[8423]806!ifdef BUILD_VERBOSE
807 @type $@
[8197]808!endif
[8423]809!endif
[8197]810
811
812#
[8290]813# Copy rule for public targets.
[8197]814#
[8290]815!if "$(TARGET_PUBNAME)" != ""
816$(TARGET_PUBNAME): $(TARGET)
817 @$(ECHO) Copying $(CLRFIL)$(TARGET)$(CLRTXT) to $(CLRFIL)$(@D)$(CLRRST)
818!ifndef BUILD_VERBOSE
[8423]819 @if not exist $(@D) $(ECHO) Target public path $(CLRFIL)$(@D)$(CLRTXT) does NOT exist. Creating. $(CLRRST)
820!endif
821 @if not exist $(@D) $(TOOL_CREATEPATH) $(@D)
822!ifndef BUILD_VERBOSE
[8290]823 @ \
[8197]824!endif
[8290]825 $(TOOL_COPY) $** $@
[8333]826 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(@R).sym
[8290]827!endif
[8197]828
829
[8253]830
831# -----------------------------------------------------------------------------
832# The $(TARGET) rule - For EMPTY targets.
833# -----------------------------------------------------------------------------
[8197]834!if "$(TARGET_MODE)" == "EMPTY"
[8316]835#$(TARGET):
836# @$(ECHO) .
[8197]837!endif
838
839
[8253]840
841# -----------------------------------------------------------------------------
842# The $(TARGET_ILIB) rule - Make import library.
843# -----------------------------------------------------------------------------
844!ifdef TARGET_ILIB
845$(TARGET_ILIB): $(TARGET_IDEF)
846 @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
[8290]847!ifndef BUILD_VERBOSE
848 @ \
849!endif
[8253]850 $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
851!endif
852
853
854
855# -----------------------------------------------------------------------------
856# The .force rule - Force a remake of something everytime.
857# -----------------------------------------------------------------------------
858.force:
[8290]859!ifndef BUILD_VERBOSE
[8253]860 @$(ECHO) .
[8290]861!else
862 @$(ECHO) . (force) .
863!endif
[8253]864
865
866
867# -----------------------------------------------------------------------------
868# Read Dependencies.
869# -----------------------------------------------------------------------------
870
871!if "$(TARGET_MODE)" != "EMPTY"
872
[8197]873#
[8253]874# Read dependency file for current directory
[8197]875#
[8253]876!if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
[8423]877! ifdef BUILD_VERBOSE
[8253]878! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
[8197]879! endif
[8253]880! endif
881! include $(TARGET_DEPEND)
882!else
883! ifndef NODEP
884! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
885! endif
886! endif
887!endif
888
889
890#
891# Read global dependency files.
892#
893!ifdef BUILD_DEPEND1
894! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
[8423]895! ifdef BUILD_VERBOSE
[8253]896! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
897! endif
898! endif
899! include $(BUILD_DEPEND1)
[8197]900! else
901! ifndef NODEP
[8253]902! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
[8197]903! endif
904! endif
905! endif
906!endif
907
[8253]908!ifdef BUILD_DEPEND2
909! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
[8423]910! ifdef BUILD_VERBOSE
[8253]911! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
912! endif
913! endif
914! include $(BUILD_DEPEND2)
915! else
916! ifndef NODEP
917! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
918! endif
919! endif
920! endif
921!endif
[8197]922
923
[8253]924!ifdef BUILD_DEPEND3
925! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
[8423]926! ifdef BUILD_VERBOSE
[8253]927! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
928! endif
929! endif
930! include $(BUILD_DEPEND3)
931! else
932! ifndef NODEP
933! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
934! endif
935! endif
936! endif
937!endif
938
939
940!endif
941
[8423]942
943#
944# If BUILD_MULTIJOBS is nonempty make sure the job daemon is up running.
945#
946!if "$(BUILD_MULTIJOBS)" != ""
947! if [$(TOOL_JOB_UP)] != 0
948! if "$(BUILD_QUITE)" == ""
949! if [$(ECHO) Starting Job Daemon With $(TOOL_JOB_WORKERS) Workers...$(CLRRST)]
950! endif
951! endif
952! if [$(TOOL_JOB_INIT) $(TOOL_JOB_WORKERS)] != 0
953! if [$(ECHO) $(CLRERR)Fatal error: Failed to start job daemon.$(CLRRST)]
954! endif
955! error
956! endif
957! endif
958!endif
959
Note: See TracBrowser for help on using the repository browser.