source: trunk/make/process.mak@ 8423

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

Merged in latest changes.

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