source: trunk/make/process.mak@ 8290

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

VDD. TARGET_PUBLIC - removed PUBLIB. BUILD_VERBOSE. TARGET_MODE assertion. ++

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