source: trunk/make/setup.mak@ 9279

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

New PATH_SUB_HELP and PATH_SUB_BOOK. Changed PATH_SUB_DOC to doc.

File size: 11.8 KB
Line 
1# $Id: setup.mak,v 1.20 2002-09-20 03:37:37 bird Exp $
2
3#
4# Generic makefile system.
5#
6# Setting up the build environment variables
7#
8# Many of the variables are a subject to change from project to project.
9#
10
11
12# -----------------------------------------------------------------------------
13# Assert that the file isn't included several times.
14# -----------------------------------------------------------------------------
15!ifdef MAKE_SETUP_INCLUDED
16! error Fatal error: You've included setup.mak before!!!
17!endif
18MAKE_SETUP_INCLUDED = YES
19
20
21# -----------------------------------------------------------------------------
22# Validate the build the requested environment setup.
23# -----------------------------------------------------------------------------
24
25SHT_TRGPLTFRM=
26!if "$(BUILD_PLATFORM)" == "OS2"
27SHT_TRGPLTFRM=os2
28!endif
29!if "$(BUILD_PLATFORM)" == "WIN32"
30SHT_TRGPLTFRM=win32
31!endif
32!if "$(SHT_TRGPLTFRM)" == ""
33! error Fatal error: Env.var BUILD_PLATFORM is either unspecified or incorrect. ($(BUILD_PLATFORM)) Valid values: OS2 and WIN32
34!endif
35
36
37SHT_BLDMD=
38!if "$(BUILD_MODE)" == "RELEASE"
39SHT_BLDMD=rel
40!endif
41!if "$(BUILD_MODE)" == "DEBUG"
42SHT_BLDMD=deb
43!endif
44!if "$(BUILD_MODE)" == "PROFILE"
45SHT_BLDMD=prf
46!endif
47!if "$(SHT_BLDMD)" == ""
48! error Fatal error: Env.var BUILD_MODE is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: RELEASE, DEBUG and PROFILE
49!endif
50
51
52SHT_BLDENV=
53!if "$(BUILD_ENV)" == "VAC308"
54SHT_BLDENV=vac308
55!endif
56!if "$(BUILD_ENV)" == "VAC365"
57SHT_BLDENV=vac365
58!endif
59!if "$(BUILD_ENV)" == "VAC4"
60SHT_BLDENV=vac4
61!endif
62!if "$(BUILD_ENV)" == "EMX"
63SHT_BLDENV=emx
64!endif
65!if "$(BUILD_ENV)" == "MSCV6"
66SHT_BLDENV=mscv6
67!endif
68!if "$(BUILD_ENV)" == "MSCV6-16"
69SHT_BLDENV=mscv6-16
70!endif
71!if "$(BUILD_ENV)" == "MSCV7-16"
72SHT_BLDENV=mscv7-16
73!endif
74!if "$(BUILD_ENV)" == "WAT11C"
75SHT_BLDENV=wat11
76!endif
77!if "$(BUILD_ENV)" == "WAT11C-16"
78SHT_BLDENV=wat11-16
79!endif
80!if "$(SHT_BLDENV)" == ""
81! error Fatal error: Env.var BUILD_ENV is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6-16, MSCV7-16, WAT11C and WAT11C-16.
82!endif
83
84
85!ifdef BUILD_ENV_FORCE
86SHT_BLDENVFRC=
87!if "$(BUILD_ENV_FORCE)" == "VAC308"
88SHT_BLDENVFRC=vac308
89!endif
90!if "$(BUILD_ENV_FORCE)" == "VAC365"
91SHT_BLDENVFRC=vac365
92!endif
93!if "$(BUILD_ENV_FORCE)" == "VAC4"
94SHT_BLDENVFRC=vac4
95!endif
96!if "$(BUILD_ENV_FORCE)" == "EMX"
97SHT_BLDENVFRC=emx
98!endif
99!if "$(BUILD_ENV_FORCE)" == "MSCV6"
100SHT_BLDENVFRC=mscv6
101!endif
102!if "$(BUILD_ENV_FORCE)" == "MSCV6-16"
103SHT_BLDENVFRC=mscv6-16
104!endif
105!if "$(BUILD_ENV_FORCE)" == "MSCV7-16"
106SHT_BLDENVFRC=mscv7-16
107!endif
108!if "$(BUILD_ENV_FORCE)" == "WAT11C"
109SHT_BLDENVFRC=wat11
110!endif
111!if "$(BUILD_ENV_FORCE)" == "WAT11C-16"
112SHT_BLDENVFRC=wat11-16
113!endif
114!if "$(SHT_BLDENVFRC)" == ""
115! error Fatal error: Var BUILD_ENV_FORCE is incorrect. ($(BUILD_ENV_FORCE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6-16, MSCV7-16, WAT11C and WAT11C-16.
116!endif
117!else
118BUILD_ENV_FORCE=$(BUILD_ENV)
119SHT_BLDENVFRC=$(SHT_BLDENV)
120!endif
121
122
123# -----------------------------------------------------------------------------
124# Directories
125# -----------------------------------------------------------------------------
126
127# current directory.
128PATH_CURRENT = $(MAKEDIR)
129# Where build system files are located. (like this file)
130PATH_MAKE = $(PATH_ROOT)\make
131# Where the bulid system and other tools are located
132PATH_TOOLS = $(PATH_ROOT)\tools\bin
133# Where platform-specific files are located. (like the .def files)
134PATH_DEF = .
135# Where the include files are located.
136PATH_INCLUDES = $(PATH_ROOT)\include\win;.;$(PATH_ROOT)\include
137# Where the temporary files goes.
138PATH_OBJ = $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV:-=_)
139# Where the libraries goes.
140PATH_LIB = $(PATH_ROOT)\lib\$(BUILD_MODE)
141# Base directory of the published files.
142PATH_PUB = $(PATH_ROOT)\bin\$(BUILD_MODE)
143# Base directory of the unstripped published files. (release mode only)
144PATH_PUB_DEB = $(PATH_ROOT)\bin\$(BUILD_MODE).unstripped
145# Sub dir where the executable binaries goes.
146PATH_SUB_BIN = .
147# Sub dir where the dynamic link libraries goes.
148PATH_SUB_DLL = .
149# Sub dir where the drivers goes. (common for IFS and SYS.)
150PATH_SUB_SYS = .
151# Sub dir where the virtual dos drivers goes.
152PATH_SUB_VDD = .
153# Sub dir where the book files goes. (aka .inf)
154PATH_SUB_BOOK = book
155# Sub dir where the help files goes. (aka .hlp)
156PATH_SUB_HELP = help
157# Sub dir where the documentation goes.
158PATH_SUB_DOC = docs
159
160
161
162# Note: Makefiles are supposed to set the correct *RELATIVE* path to the
163# projects root. Using '\' slashes please. No trailing slash.
164#
165# Example:
166# PATH_ROOT= ..\..\..
167# Assert PATH_ROOT
168!if "$(PATH_ROOT)" == ""
169!error fatal error: PATH_ROOT empty or undefined.
170!endif
171
172#
173# A workaround for SlickEdits inability to find the buggy files..
174# This fixes the relative paths of includes.
175# Set the make line to:
176# '%v && cd %p && nmake PATH_ROOT_ABS=%rp. %n.obj -a'
177# (NB! Set the project directory to the root dir by creating the project there!)
178#
179!ifdef SLKRUNS
180! ifdef PATH_ROOT_ABS
181PATH_ROOT = $(PATH_ROOT_ABS)
182! endif
183!endif
184
185
186
187# -----------------------------------------------------------------------------
188# Common variables / Project variables
189# -----------------------------------------------------------------------------
190
191# The default definitions.
192!ifndef ODIN32_USERAPP
193BUILD_DEFINES = -D__WIN32OS2__ -DTCPV40HDRS -DCOMCTL32UNDOC -D__WINE__
194!else
195BUILD_DEFINES = -D__WIN32OS2__ #-DTCPV40HDRS -DCOMCTL32UNDOC -D__WINE__
196!endif
197BUILD_BLDLEVEL_FLAGS = -V^"^#define=ODIN32_VERSION,$(PATH_ROOT)\include\odinbuild.h^" \
198 -M^"^#define=ODIN32_BUILD_NR,$(PATH_ROOT)\include\odinbuild.h^"
199BUILD_PROJECT = Odin32
200
201# Project Specific definitions.
202!if "$(BUILD_MODE)" != "DEBUG"
203LIB_ODINCRT = $(PATH_LIB)\odincrt.$(EXT_LIB)
204!else
205LIB_ODINCRT = $(PATH_LIB)\odincrtd.$(EXT_LIB)
206!endif
207!ifndef CUSTOMBUILD
208OBJ_DLLENTRY = $(PATH_LIB)\dllentry.$(EXT_OBJ)
209!else
210OBJ_DLLENTRY =
211!endif
212
213# This is the process file to include at end of the makefile.
214MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.mak
215
216# -----------------------------------------------------------------------------
217# Build the environments variables
218# -----------------------------------------------------------------------------
219
220# In the makefiles you're allowed to use the BUILD_ENVS_PRE,
221# BUILD_ENV_FORCE, BUILD_ENVS_POST variables to make private changes to the
222# environment. These are combined with the two base ones as follows:
223# $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
224#
225# BUILD_ENV_FORCE is used for changing the base compiler. Do *NOT* use
226# BUILD_ENV for that! BUILD_ENV_FORCE isn't used directly but in the setup
227# string above, but ENV_ENVS from the setup.[w]xyz.mk setup file is used.
228#
229
230# These strings are passed on to the BuildEnv.cmd script to setup the correct
231# shell environment.
232# TODO Should these be overridable by setup.[w]xyz.mak ? (kso)
233BUILD_ENVS_BASE_POST = toolkit452
234BUILD_ENVS_BASE_POST_16 =
235BUILD_ENVS_BASE_PRE = buildsetup emx~ cvs~
236BUILD_ENVS_BASE_PRE_16 = buildsetup emx~ cvs~ toolkit452 ddkbase
237
238
239# -----------------------------------------------------------------------------
240# Set forwarding flag.
241# If there is any change in the environment
242# OR the environment is uncertain (_BUILD_PROJECT not right) Then
243# Forward all target commands to the new shell environment we setup.
244#
245# (This have to be done early so the CC setup and it's like can check for
246# the flag. The rest of the forward stuff is at the bottom.)
247# -----------------------------------------------------------------------------
248!if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)" || "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)" || "$(BUILD_ENVS_PRE)" != "" || "$(BUILD_ENVS_POST)" != ""
249BUILD_FORWARDING = 1
250!else
251BUILD_FORWARDING = 0
252!endif
253
254
255# -----------------------------------------------------------------------------
256# Include the setup.
257# First the default common tools setup is included.
258# The the environment specific setup.
259# -----------------------------------------------------------------------------
260
261!include $(PATH_MAKE)\setup.tools.mk
262
263MAKE_INCLUDE_SETUP = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV).mk
264!ifndef BUILD_QUIET
265! ifndef MAKEVER
266! if [$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)]
267! endif
268! else
269$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)
270! endif
271!endif
272!include $(MAKE_INCLUDE_SETUP)
273
274
275# -----------------------------------------------------------------------------
276# Verify the environment setups.
277# Uncomment this when configuring a new project.
278# When the setup is stable comment it out. (it's a waste of time!)
279# -----------------------------------------------------------------------------
280
281#
282#!ifndef ENV_NAME
283#!error No environment signature has been defined ($(NAME_COMPLETE))
284#!endif
285#
286#!ifndef MAKE_INCLUDE_SETUP
287#!error No setup to include has been determined (MAKE_INCLUDE_SETUP)
288#!endif
289#
290#!if "$(ENV_STATUS)" != "OK"
291#!error Environment $(ENV_NAME) does work yet (ENV_STATUS is not OK).
292#!endif
293#
294#!ifndef CC
295#!error Environment $(ENV_NAME) does not define variable (CC).
296#!endif
297#
298#!ifndef CC_FLAGS_EXE
299#!error Environment $(ENV_NAME) does not define variable (CC_FLAGS_EXE).
300#!endif
301#
302#!ifndef LINK
303#!error Environment $(ENV_NAME) does not define variable (LINK).
304#!endif
305#
306#!ifndef LINK_FLAGS_EXE
307#!error Environment $(ENV_NAME) does not define variable (LINK_FLAGS_EXE).
308#!endif
309#
310
311
312# -----------------------------------------------------------------------------
313# Forwarding processing.
314# -----------------------------------------------------------------------------
315!if $(BUILD_FORWARDING)
316
317MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.forwarder.mak
318
319# Debug - find the reason for forwarding.
320#! if 0
321#! if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"
322#! if [echo debug - _BUILD_PROJECT: "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"]
323#! endif
324#! endif
325#! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
326#! if [echo debug - BUILD_ENV: "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"]
327#! endif
328#! endif
329#! if "$(BUILD_ENVS_PRE)" != ""
330#! if [echo debug - BUILD_ENVS_PRE: "$(BUILD_ENVS_PRE)" != ""]
331#! endif
332#! endif
333#! if "$(BUILD_ENVS_POST)" != ""
334#! if [echo debug - BUILD_ENVS_POST: "$(BUILD_ENVS_POST)" != ""]
335#! endif
336#! endif
337#! endif
338
339
340# set the secret _build_project env.var.
341# Note: This 'SET' operation doesn't allways work as designed.
342# Therefore we have a workaround in the forwarder statement which makes
343# sure that the internal variable is set. The problem seems to be to
344# create new environment variables.
345! if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"
346! if [SET _BUILD_PROJECT=$(BUILD_PROJECT)]
347! endif
348! endif
349
350# Compiler change or just environment change.
351! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
352MAKE_INCLUDE_SETUP_FORCE = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENVFRC).mk
353! ifndef BUILD_QUIET
354! ifndef MAKEVER
355! if [$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)]
356! endif
357! else
358$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)
359! endif
360! endif
361! include $(MAKE_INCLUDE_SETUP_FORCE)
362! ifdef ENV_16BIT
363BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE_16) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST_16) $(BUILD_ENVS_POST)
364! else
365BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
366! endif
367! else
368! ifdef ENV_16BIT
369BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE_16) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST_16) $(BUILD_ENVS_POST)
370! else
371BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
372! endif
373! endif
374
375!endif # BUILD_FORWARDING
376
Note: See TracBrowser for help on using the repository browser.