source: trunk/make/process.forwarder.mak@ 8296

Last change on this file since 8296 was 8294, checked in by bird, 24 years ago

Support for forced environment change, using BUILD_ENV_FORCE,
BUILD_ENVS_PRE and BUILD_ENVS_POST.
(first successful try)

File size: 7.3 KB
Line 
1# $Id: process.forwarder.mak,v 1.1 2002-04-22 01:59:33 bird Exp $
2
3#
4# Generic makefile system.
5#
6# The common build process rules for the case
7# where we forward to a different compiler environment.
8#
9# Note: this makefile is supposed to be included from the
10# current source path.
11#
12
13
14# -----------------------------------------------------------------------------
15# Assertions.
16# This makefile expects setup.mak and the specific setup to be included
17# already.
18# It also requires the TARGET_NAME to be specified in the makefile.
19# -----------------------------------------------------------------------------
20!if "$(MAKE_SETUP_INCLUDED)" != "YES"
21!error Fatal error: You must include setup.mak before process.mak in the makefile.
22!endif
23!if "$(ENV_STATUS)" != "OK"
24!error Fatal error: The environment is not valid. Bad setup.mak?
25!endif
26
27!if "$(TARGET_NAME)" == ""
28!error Fatal error: TARGET_NAME is not defined! Should be set in the makefile.
29!endif
30
31
32# -----------------------------------------------------------------------------
33# Tell user what we're doing.
34# -----------------------------------------------------------------------------
35!ifndef BUILD_QUIET
36!if [$(ECHO) Forwarding to another compiler setup...]
37!endif
38!endif
39
40
41# -----------------------------------------------------------------------------
42# Common inference rules
43# -----------------------------------------------------------------------------
44
45.SUFFIXES:
46.SUFFIXES: .$(EXT_OBJ) .c .cpp .asm .$(EXT_RES) .rc .pre-c .pre-cpp # .h .def
47
48
49# Assembling assembly source.
50.asm{$(PATH_TARGET)}.$(EXT_OBJ):
51!ifndef BUILD_VERBOSE
52 @ \
53!endif
54 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
55
56.asm.$(EXT_OBJ):
57!ifndef BUILD_VERBOSE
58 @ \
59!endif
60 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
61
62
63# Compiling C++ source.
64.cpp{$(PATH_TARGET)}.$(EXT_OBJ):
65!ifndef BUILD_VERBOSE
66 @ \
67!endif
68 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
69
70.cpp.$(EXT_OBJ):
71!ifndef BUILD_VERBOSE
72 @ \
73!endif
74 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
75
76
77# Pre-Compiling C++ source.
78.cpp.pre-cpp:
79!ifndef BUILD_VERBOSE
80 @ \
81!endif
82 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
83
84
85# Compiling C source.
86.c{$(PATH_TARGET)}.$(EXT_OBJ):
87!ifndef BUILD_VERBOSE
88 @ \
89!endif
90 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
91
92.c.$(EXT_OBJ):
93!ifndef BUILD_VERBOSE
94 @ \
95!endif
96 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
97
98
99# Pre-Compiling C source.
100.c.pre-c:
101!ifndef BUILD_VERBOSE
102 @ \
103!endif
104 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
105
106
107# Compiling resources.
108.rc{$(PATH_TARGET)}.res:
109!ifndef BUILD_VERBOSE
110 @ \
111!endif
112 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
113
114.rc.res:
115!ifndef BUILD_VERBOSE
116 @ \
117!endif
118 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
119
120
121
122
123
124# -----------------------------------------------------------------------------
125# The all rule - The default one, as it's the first rule in the file.
126# -----------------------------------------------------------------------------
127all: build
128
129
130
131# -----------------------------------------------------------------------------
132# The build rule - Build the target.
133# -----------------------------------------------------------------------------
134build:
135!ifndef BUILD_VERBOSE
136 @ \
137!endif
138 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
139
140
141
142# -----------------------------------------------------------------------------
143# The lib rule - Make Public libraries.
144# -----------------------------------------------------------------------------
145lib:
146!ifndef BUILD_VERBOSE
147 @ \
148!endif
149 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
150
151
152
153# -----------------------------------------------------------------------------
154# The install rule - Copies target to main binary directory.
155# -----------------------------------------------------------------------------
156install:
157!ifndef BUILD_VERBOSE
158 @ \
159!endif
160 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
161
162
163
164# -----------------------------------------------------------------------------
165# The testcase rule - Execute testcases when present.
166# -----------------------------------------------------------------------------
167testcase:
168!ifndef BUILD_VERBOSE
169 @ \
170!endif
171 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
172
173
174# -----------------------------------------------------------------------------
175# The dep rule - Make dependencies.
176# -----------------------------------------------------------------------------
177dep:
178!ifndef BUILD_VERBOSE
179 @ \
180!endif
181 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
182
183
184
185# -----------------------------------------------------------------------------
186# The clean rule - Clean up output files.
187# The current setup doesn't clean the installed ones.
188# -----------------------------------------------------------------------------
189clean:
190!ifndef BUILD_VERBOSE
191 @ \
192!endif
193 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
194
195
196
197# -----------------------------------------------------------------------------
198# The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
199# -----------------------------------------------------------------------------
200!if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
201$(TARGET):
202!ifndef BUILD_VERBOSE
203 @ \
204!endif
205 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
206!endif
207
208
209# -----------------------------------------------------------------------------
210# The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
211# -----------------------------------------------------------------------------
212!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
213$(TARGET):
214!ifndef BUILD_VERBOSE
215 @ \
216!endif
217 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
218!endif
219
220
221# -----------------------------------------------------------------------------
222# The $(TARGET) rule - For EMPTY targets.
223# -----------------------------------------------------------------------------
224!if "$(TARGET_MODE)" == "EMPTY"
225$(TARGET):
226 @$(ECHO) .
227!endif
228
229
230
231# -----------------------------------------------------------------------------
232# The $(TARGET_ILIB) rule - Make import library.
233# -----------------------------------------------------------------------------
234!ifdef TARGET_ILIB
235$(TARGET_ILIB):
236!ifndef BUILD_VERBOSE
237 @ \
238!endif
239 $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) BUILD_ENV=$(BUILD_ENV_FORCE) $@
240
241!endif
242
243
244
245# -----------------------------------------------------------------------------
246# The .force rule - Force a remake of something everytime.
247# -----------------------------------------------------------------------------
248.force:
249!ifndef BUILD_VERBOSE
250 @$(ECHO) .
251!else
252 @$(ECHO) . (force) .
253!endif
254
255
Note: See TracBrowser for help on using the repository browser.