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
Line 
1# $Id: process.mak,v 1.11 2002-04-30 19:50:40 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# If 16bit: 8KB
203# Else (32bit): 64KB
204!ifndef TARGET_STACKSIZE
205! ifdef ENV_16BIT
206TARGET_STACKSIZE=0x2000
207! else
208TARGET_STACKSIZE=0x10000
209! endif
210!endif
211
212
213
214# -----------------------------------------------------------------------------
215# Tell user what we're building.
216# -----------------------------------------------------------------------------
217!ifndef BUILD_QUIET
218!if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
219!endif
220!endif
221
222
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
237! endif
238! endif
239!endif
240# not 100% sure about the != EMPTY stuff, but this is way faster.
241
242
243
244# -----------------------------------------------------------------------------
245# Common inference rules
246# -----------------------------------------------------------------------------
247
248.SUFFIXES:
249.SUFFIXES: .$(EXT_OBJ) .c .cpp .asm .$(EXT_RES) .rc .pre-c .pre-cpp # .h .def
250
251
252# Assembling assembly source.
253.asm{$(PATH_TARGET)}.$(EXT_OBJ):
254 @$(ECHO) Assembling $(CLRFIL)$< $(CLRRST)
255!ifndef BUILD_VERBOSE
256 @ \
257!endif
258!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
259 $(AS) $(AS_FLAGS_SYS) $< $(AS_OBJ_OUT)$@
260!else
261 $(AS) $(AS_FLAGS) $< $(AS_OBJ_OUT)$@
262!endif
263
264.asm.$(EXT_OBJ):
265 @$(ECHO) Assembling $(CLRFIL)$< $(CLRRST)
266!ifndef BUILD_VERBOSE
267 @ \
268!endif
269!if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
270 $(AS) $(AS_FLAGS_SYS) $< $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
271!else
272 $(AS) $(AS_FLAGS) $< $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
273!endif
274
275
276# Compiling C++ source.
277.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
278 @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
279!ifndef BUILD_VERBOSE
280 @ \
281!endif
282 $(CXX) \
283!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
295!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
296 $(CXX_FLAGS_IFS) \
297!endif
298!if "$(CXX_LST_OUT)" != ""
299 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
300!endif
301 $(CXX_OBJ_OUT)$@ $<
302
303.cpp.$(EXT_OBJ):
304 @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
305!ifndef BUILD_VERBOSE
306 @ \
307!endif
308 $(CXX) \
309!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
321!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
322 $(CXX_FLAGS_IFS) \
323!endif
324!if "$(CXX_LST_OUT)" != ""
325 $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
326!endif
327 $(CXX_OBJ_OUT)$(PATH_TARGET)\$(@F) $<
328
329
330# Pre-Compiling C++ source.
331.cpp.pre-cpp:
332 @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
333!ifndef BUILD_VERBOSE
334 @ \
335!endif
336 $(CXX) \
337!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
349!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
350 $(CXX_FLAGS_IFS) \
351!endif
352 $(CXX_PC_2_STDOUT) $< > $@
353
354
355# Compiling C source.
356.c{$(PATH_TARGET)}.$(EXT_OBJ):
357 @$(ECHO) C Compiler $(CLRFIL)$< $(CLRRST)
358!ifndef BUILD_VERBOSE
359 @ \
360!endif
361 $(CC) \
362!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
374!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
375 $(CC_FLAGS_IFS) \
376!endif
377!if "$(CC_LST_OUT)" != ""
378 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
379!endif
380 $(CC_OBJ_OUT)$@ $<
381
382.c.$(EXT_OBJ):
383 @$(ECHO) C Compiler $(CLRFIL)$< $(CLRRST)
384!ifndef BUILD_VERBOSE
385 @ \
386!endif
387 $(CC) \
388!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
400!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
401 $(CC_FLAGS_IFS) \
402!endif
403!if "$(CC_LST_OUT)" != ""
404 $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
405!endif
406 $(CC_OBJ_OUT)$(PATH_TARGET)\$(@F) $<
407
408
409# Pre-Compiling C source.
410.c.pre-c:
411 @$(ECHO) C PreCompiler $(CLRFIL)$< $(CLRRST)
412!ifndef BUILD_VERBOSE
413 @ \
414!endif
415 $(CC) \
416!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB"
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
428!if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
429 $(CC_FLAGS_IFS) \
430!endif
431 $(CC_PC_2_STDOUT) $< > $@
432
433
434# Compiling resources.
435.rc{$(PATH_TARGET)}.res:
436 @$(ECHO) RC Compiler $(CLRFIL)$< $(CLRRST)
437!ifndef BUILD_VERBOSE
438 @ \
439!endif
440 $(RC) $(RC_FLAGS) $< $@
441
442.rc.res:
443 @$(ECHO) RC Compiler $(CLRFIL)$< $(CLRRST)
444!ifndef BUILD_VERBOSE
445 @ \
446!endif
447 $(RC) $(RC_FLAGS) $< $(PATH_TARGET)\$(@F)
448
449
450
451
452
453# -----------------------------------------------------------------------------
454# The all rule - The default one, as it's the first rule in the file.
455# -----------------------------------------------------------------------------
456all: build
457
458
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# -----------------------------------------------------------------------------
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
477build: $(SUBDIRS_BUILD) $(PREMAKEFILES_BUILD) $(TARGET) $(TARGET_ILIB) $(TARGET_PUBNAME)
478 @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
479!ifdef POSTMAKEFILES
480 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
481!endif
482
483
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# -----------------------------------------------------------------------------
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
502!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
503lib: $(SUBDIRS_LIB) $(TARGET_ILIB) $(TARGET) $(TARGET_PUBNAME)
504!else
505lib: $(SUBDIRS_LIB) $(TARGET_ILIB)
506!endif
507!ifdef POSTMAKEFILES
508 @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
509!endif
510
511
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# -----------------------------------------------------------------------------
518install:
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)
523 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_BIN)
524 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_BIN)
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)
529 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_DLL)
530 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_DLL)
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)
535 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_SYS)
536 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_SYS)
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)
542 @if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_LIB)
543 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(PATH_LIB)
544! endif
545! endif
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
561
562# -----------------------------------------------------------------------------
563# The testcase rule - Execute testcases when present.
564# Testcases are either a testcase.mak file or a testcase subdirectory.
565# -----------------------------------------------------------------------------
566!ifndef BUILD_OWN_TESTCASE_RULE
567testcase:
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
586
587# -----------------------------------------------------------------------------
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# -----------------------------------------------------------------------------
600# The dep rule - Make dependencies.
601# -----------------------------------------------------------------------------
602dep:
603 @$(ECHO) Building dependencies $(CLRRST)
604!ifndef BUILD_VERBOSE
605 @ \
606!endif
607 $(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
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
623
624# -----------------------------------------------------------------------------
625# The clean rule - Clean up output files.
626# The current setup doesn't clean the installed ones.
627# -----------------------------------------------------------------------------
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) \
635 $(PATH_TARGET)\*.$(EXT_RES)
636 $(TOOL_RM) \
637 $(PATH_TARGET)\*.$(EXT_SYS) \
638 $(PATH_TARGET)\*.$(EXT_LIB) \
639 $(PATH_TARGET)\*.$(EXT_IFS) \
640 $(PATH_TARGET)\*.$(EXT_MAP) \
641 $(PATH_TARGET)\*.$(EXT_SYM)
642 $(TOOL_RM) \
643 $(PATH_TARGET)\*.s \
644 $(PATH_TARGET)\*.lst \
645 $(PATH_TARGET)\*.lnk \
646 $(PATH_TARGET)\*.pre-c \
647 $(PATH_TARGET)\*.pre-cpp \
648 $(PATH_TARGET)\.depend
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
661
662# -----------------------------------------------------------------------------
663# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
664# -----------------------------------------------------------------------------
665!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
666$(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF_LINK) $(TARGET_LNK) $(TARGET_DEPS)
667 @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
668!ifndef BUILD_VERBOSE
669 @ \
670!endif
671!ifdef TARGET_IGNORE_LINKER_WARNINGS
672 -4 \
673!endif
674!if "$(TARGET_MODE)" == "EXE"
675 $(LINK_CMD_EXE)
676!endif
677!if "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT"
678 $(LINK_CMD_DLL)
679!endif
680!if "$(TARGET_MODE)" == "SYS"
681 $(LINK_CMD_SYS)
682!endif
683!if "$(TARGET_MODE)" == "IFS"
684 $(LINK_CMD_IFS)
685!endif
686!if "$(TARGET_MODE)" == "VDD"
687 $(LINK_CMD_VDD)
688!endif
689!if "$(TARGET_RES)" != "" && "$(RL)" != ""
690 @$(ECHO) Linking Resources $(CLRRST)
691! ifndef BUILD_VERBOSE
692 @ \
693! endif
694 $(RL) $(RL_FLAGS) $(TARGET_RES) $@
695!endif
696!if "$(TARGET_DLLRNAME)" != ""
697 @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
698! ifndef BUILD_VERBOSE
699 @ \
700! endif
701 $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
702!endif
703!if "$(TOOL_MAPSYM)" != "" && "$(TARGET_SYM)" != "" && "$(TARGET_MAP)" != ""
704! ifndef BUILD_VERBOSE
705 @ \
706! endif
707 $(TOOL_MAPSYM) $(TARGET_MAP) $(TARGET_SYM)
708!endif
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
722!ifdef BUILD_VERBOSE
723 @type $@
724!endif
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$** $** $@
739!endif
740
741!endif
742
743
744# -----------------------------------------------------------------------------
745# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
746# -----------------------------------------------------------------------------
747!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
748$(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
749 @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
750!ifndef BUILD_VERBOSE
751 @$(TOOL_RM) $@
752 @$(AR_CMD)
753!else
754 $(TOOL_RM) $@
755 $(AR_CMD)
756!endif
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#
774# Copy rule for public targets.
775#
776!if "$(TARGET_PUBNAME)" != ""
777$(TARGET_PUBNAME): $(TARGET)
778 @$(ECHO) Copying $(CLRFIL)$(TARGET)$(CLRTXT) to $(CLRFIL)$(@D)$(CLRRST)
779!ifndef BUILD_VERBOSE
780 @ \
781!endif
782 $(TOOL_COPY) $** $@
783 @if exist $(TARGET_SYM) $(TOOL_COPY) $(TARGET_SYM) $(@R).sym
784!endif
785
786
787
788# -----------------------------------------------------------------------------
789# The $(TARGET) rule - For EMPTY targets.
790# -----------------------------------------------------------------------------
791!if "$(TARGET_MODE)" == "EMPTY"
792#$(TARGET):
793# @$(ECHO) .
794!endif
795
796
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)
804!ifndef BUILD_VERBOSE
805 @ \
806!endif
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:
816!ifndef BUILD_VERBOSE
817 @$(ECHO) .
818!else
819 @$(ECHO) . (force) .
820!endif
821
822
823
824# -----------------------------------------------------------------------------
825# Read Dependencies.
826# -----------------------------------------------------------------------------
827
828!if "$(TARGET_MODE)" != "EMPTY"
829
830#
831# Read dependency file for current directory
832#
833!if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
834! ifndef BUILD_QUIET
835! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
836! endif
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)
857! else
858! ifndef NODEP
859! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
860! endif
861! endif
862! endif
863!endif
864
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
879
880
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.