source: trunk/make/setup.mak@ 10493

Last change on this file since 10493 was 10493, checked in by bird, 22 years ago

InnoTek GCC.

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