source: trunk/make/process.mak@ 8355

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

Display link file in BUILD_VERBOSE mode. Fixed the default stack setting by check for ENV_16BIT.

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