source: trunk/make/process.mak@ 8333

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

Build level info. Symbol files.

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