| [8333] | 1 | # $Id: setup.mak,v 1.7 2002-04-30 06:19:13 bird Exp $
 | 
|---|
| [8197] | 2 | 
 | 
|---|
 | 3 | #
 | 
|---|
| [8253] | 4 | # Generic makefile system.
 | 
|---|
| [8197] | 5 | #
 | 
|---|
 | 6 | #   Setting up the build environment variables
 | 
|---|
 | 7 | #
 | 
|---|
| [8253] | 8 | #   Many of the variables are a subject to change from project to project.
 | 
|---|
| [8197] | 9 | #
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 | 
 | 
|---|
 | 12 | !ifndef MAKE_SETUP_INCLUDED
 | 
|---|
 | 13 | MAKE_SETUP_INCLUDED=YES
 | 
|---|
 | 14 | 
 | 
|---|
 | 15 | 
 | 
|---|
| [8253] | 16 | # -----------------------------------------------------------------------------
 | 
|---|
 | 17 | # Validate the build the requested environment setup.
 | 
|---|
 | 18 | # -----------------------------------------------------------------------------
 | 
|---|
| [8197] | 19 | 
 | 
|---|
| [8253] | 20 | SHT_TRGPLTFRM=
 | 
|---|
| [8197] | 21 | !if "$(BUILD_PLATFORM)" == "OS2"
 | 
|---|
| [8253] | 22 | SHT_TRGPLTFRM=os2
 | 
|---|
| [8197] | 23 | !endif
 | 
|---|
 | 24 | !if "$(BUILD_PLATFORM)" == "WIN32"
 | 
|---|
| [8253] | 25 | SHT_TRGPLTFRM=win32
 | 
|---|
| [8197] | 26 | !endif
 | 
|---|
| [8253] | 27 | !if "$(SHT_TRGPLTFRM)" == ""
 | 
|---|
 | 28 | ! error Fatal error: Env.var BUILD_PLATFORM is either unspecified or incorrect. ($(BUILD_PLATFORM)) Valid values: OS2 and WIN32
 | 
|---|
| [8197] | 29 | !endif
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | 
 | 
|---|
| [8253] | 32 | SHT_BLDMD=
 | 
|---|
| [8197] | 33 | !if "$(BUILD_MODE)" == "RELEASE"
 | 
|---|
| [8253] | 34 | SHT_BLDMD=rel
 | 
|---|
| [8197] | 35 | !endif
 | 
|---|
 | 36 | !if "$(BUILD_MODE)" == "DEBUG"
 | 
|---|
| [8253] | 37 | SHT_BLDMD=deb
 | 
|---|
| [8197] | 38 | !endif
 | 
|---|
 | 39 | !if "$(BUILD_MODE)" == "PROFILE"
 | 
|---|
| [8253] | 40 | SHT_BLDMD=prf
 | 
|---|
| [8197] | 41 | !endif
 | 
|---|
| [8253] | 42 | !if "$(SHT_BLDMD)" == ""
 | 
|---|
 | 43 | ! error Fatal error: Env.var BUILD_MODE is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: RELEASE, DEBUG and PROFILE
 | 
|---|
| [8197] | 44 | !endif
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | 
 | 
|---|
| [8253] | 47 | SHT_BLDENV=
 | 
|---|
| [8197] | 48 | !if "$(BUILD_ENV)" == "VAC308"
 | 
|---|
| [8253] | 49 | SHT_BLDENV=vac308
 | 
|---|
| [8197] | 50 | !endif
 | 
|---|
 | 51 | !if "$(BUILD_ENV)" == "VAC365"
 | 
|---|
| [8253] | 52 | SHT_BLDENV=vac365
 | 
|---|
| [8197] | 53 | !endif
 | 
|---|
 | 54 | !if "$(BUILD_ENV)" == "VAC4"
 | 
|---|
| [8253] | 55 | SHT_BLDENV=vac4
 | 
|---|
| [8197] | 56 | !endif
 | 
|---|
 | 57 | !if "$(BUILD_ENV)" == "EMX"
 | 
|---|
| [8253] | 58 | SHT_BLDENV=emx
 | 
|---|
| [8197] | 59 | !endif
 | 
|---|
 | 60 | !if "$(BUILD_ENV)" == "MSCV6"
 | 
|---|
| [8253] | 61 | SHT_BLDENV=mscv6
 | 
|---|
| [8197] | 62 | !endif
 | 
|---|
| [8294] | 63 | !if "$(BUILD_ENV)" == "WAT11C"
 | 
|---|
| [8253] | 64 | SHT_BLDENV=wat11
 | 
|---|
 | 65 | !endif
 | 
|---|
 | 66 | !if "$(SHT_BLDENV)" == ""
 | 
|---|
 | 67 | ! error Fatal error: Env.var BUILD_ENV is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6 and WATCOM
 | 
|---|
| [8197] | 68 | !endif
 | 
|---|
 | 69 | 
 | 
|---|
 | 70 | 
 | 
|---|
| [8294] | 71 | !ifdef BUILD_ENV_FORCE
 | 
|---|
 | 72 | SHT_BLDENVFRC=
 | 
|---|
 | 73 | !if "$(BUILD_ENV_FORCE)" == "VAC308"
 | 
|---|
 | 74 | SHT_BLDENVFRC=vac308
 | 
|---|
 | 75 | !endif
 | 
|---|
 | 76 | !if "$(BUILD_ENV_FORCE)" == "VAC365"
 | 
|---|
 | 77 | SHT_BLDENVFRC=vac365
 | 
|---|
 | 78 | !endif
 | 
|---|
 | 79 | !if "$(BUILD_ENV_FORCE)" == "VAC4"
 | 
|---|
 | 80 | SHT_BLDENVFRC=vac4
 | 
|---|
 | 81 | !endif
 | 
|---|
 | 82 | !if "$(BUILD_ENV_FORCE)" == "EMX"
 | 
|---|
 | 83 | SHT_BLDENVFRC=emx
 | 
|---|
 | 84 | !endif
 | 
|---|
 | 85 | !if "$(BUILD_ENV_FORCE)" == "MSCV6"
 | 
|---|
 | 86 | SHT_BLDENVFRC=mscv6
 | 
|---|
 | 87 | !endif
 | 
|---|
 | 88 | !if "$(BUILD_ENV_FORCE)" == "WAT11C"
 | 
|---|
 | 89 | SHT_BLDENVFRC=wat11
 | 
|---|
 | 90 | !endif
 | 
|---|
 | 91 | !if "$(SHT_BLDENVFRC)" == ""
 | 
|---|
 | 92 | ! error Fatal error: Var BUILD_ENV_FORCE is incorrect. ($(BUILD_ENV_FORCE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6 and WATCOM
 | 
|---|
 | 93 | !endif
 | 
|---|
 | 94 | !else
 | 
|---|
 | 95 | BUILD_ENV_FORCE=$(BUILD_ENV)
 | 
|---|
 | 96 | SHT_BLDENVFRC=$(SHT_BLDENV)
 | 
|---|
 | 97 | !endif
 | 
|---|
| [8253] | 98 | 
 | 
|---|
| [8294] | 99 | 
 | 
|---|
| [8253] | 100 | # -----------------------------------------------------------------------------
 | 
|---|
 | 101 | # Directories
 | 
|---|
 | 102 | # -----------------------------------------------------------------------------
 | 
|---|
 | 103 | 
 | 
|---|
 | 104 | # current directory.
 | 
|---|
 | 105 | PATH_CURRENT    = $(MAKEDIR)
 | 
|---|
 | 106 | # Where build system files are located. (like this file)
 | 
|---|
 | 107 | PATH_MAKE       = $(PATH_ROOT)\make
 | 
|---|
 | 108 | # Where the bulid system and other tools are located
 | 
|---|
 | 109 | PATH_TOOLS      = $(PATH_ROOT)\tools\bin
 | 
|---|
 | 110 | # Where platform-specific files are located. (like the .def files)
 | 
|---|
 | 111 | # (default) PATH_DEF        = $(SHT_TRGPLTFRM)
 | 
|---|
 | 112 | PATH_DEF        = .
 | 
|---|
 | 113 | # Where the include files are located.
 | 
|---|
 | 114 | PATH_INCLUDES   = $(PATH_ROOT)\include;$(PATH_ROOT)\include\win
 | 
|---|
 | 115 | 
 | 
|---|
 | 116 | # Where the temporary files goes.
 | 
|---|
 | 117 | PATH_OBJ    = $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV)
 | 
|---|
 | 118 | # Where the executable binaries goes.
 | 
|---|
 | 119 | PATH_BIN    = $(PATH_ROOT)\bin\$(BUILD_MODE)
 | 
|---|
 | 120 | # Where the public libraries goes.
 | 
|---|
 | 121 | PATH_LIB    = $(PATH_ROOT)\lib\$(BUILD_MODE)
 | 
|---|
 | 122 | # Where the dynamic link libraries goes.
 | 
|---|
 | 123 | PATH_DLL    = $(PATH_ROOT)\bin\$(BUILD_MODE)
 | 
|---|
 | 124 | # Where the drivers goes. (common for IFS and SYS.)
 | 
|---|
 | 125 | PATH_SYS    = $(PATH_ROOT)\bin\$(BUILD_MODE)
 | 
|---|
| [8291] | 126 | # Where the virtual dos drivers goes.
 | 
|---|
 | 127 | PATH_VDD    = $(PATH_ROOT)\bin\$(BUILD_MODE)
 | 
|---|
| [8253] | 128 | # Where the documentation goes.
 | 
|---|
 | 129 | PATH_DOC    = $(PATH_ROOT)\bin\$(BUILD_MODE)
 | 
|---|
 | 130 | # Where the helpfiles goes.
 | 
|---|
 | 131 | PATH_HLP    = $(PATH_ROOT)\bin\$(BUILD_MODE)
 | 
|---|
 | 132 | 
 | 
|---|
 | 133 | 
 | 
|---|
 | 134 | # Note: Makefiles are supposed to set the correct *RELATIVE* path to the
 | 
|---|
 | 135 | #       projects root. Using '\' slashes please. No trailing slash.
 | 
|---|
 | 136 | #
 | 
|---|
 | 137 | # Example:
 | 
|---|
 | 138 | #       PATH_ROOT= ..\..\..
 | 
|---|
 | 139 | # Assert PATH_ROOT
 | 
|---|
 | 140 | !if "$(PATH_ROOT)" == ""
 | 
|---|
 | 141 | !error fatal error: PATH_ROOT empty or undefined.
 | 
|---|
| [8197] | 142 | !endif
 | 
|---|
 | 143 | 
 | 
|---|
 | 144 | 
 | 
|---|
| [8253] | 145 | # -----------------------------------------------------------------------------
 | 
|---|
 | 146 | # Common variables / Project variables
 | 
|---|
 | 147 | # -----------------------------------------------------------------------------
 | 
|---|
| [8197] | 148 | 
 | 
|---|
| [8253] | 149 | # The default definitions.
 | 
|---|
| [8333] | 150 | BUILD_DEFINES           = -D__WIN32OS2__ -D__WINE__ -D__i386__
 | 
|---|
 | 151 | BUILD_BLDLEVEL_FLAGS    = -V^"^#define=ODIN32_VERSION,$(PATH_ROOT)\include\odinbuild.h^" \
 | 
|---|
 | 152 |                           -M^"^#define=ODIN32_BUILD_NR,$(PATH_ROOT)\include\odinbuild.h^"
 | 
|---|
| [8253] | 153 | 
 | 
|---|
 | 154 | # This is the process file to include at end of the makefile.
 | 
|---|
 | 155 | MAKE_INCLUDE_PROCESS    = $(PATH_MAKE)\process.mak
 | 
|---|
 | 156 | 
 | 
|---|
 | 157 | 
 | 
|---|
 | 158 | 
 | 
|---|
 | 159 | # -----------------------------------------------------------------------------
 | 
|---|
 | 160 | # Include the setup.
 | 
|---|
 | 161 | #   First the default common tools setup is included.
 | 
|---|
 | 162 | #   The the environment specific setup.
 | 
|---|
 | 163 | # -----------------------------------------------------------------------------
 | 
|---|
 | 164 | 
 | 
|---|
 | 165 | !include $(PATH_MAKE)\setup.tools.mk
 | 
|---|
 | 166 | 
 | 
|---|
 | 167 | MAKE_INCLUDE_SETUP = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV).mk
 | 
|---|
 | 168 | !ifndef BUILD_QUIET
 | 
|---|
| [8291] | 169 | ! if [$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)]
 | 
|---|
| [8197] | 170 | ! endif
 | 
|---|
 | 171 | !endif
 | 
|---|
| [8253] | 172 | !include $(MAKE_INCLUDE_SETUP)
 | 
|---|
| [8197] | 173 | 
 | 
|---|
 | 174 | 
 | 
|---|
| [8253] | 175 | # -----------------------------------------------------------------------------
 | 
|---|
 | 176 | # Verify the environment setups.
 | 
|---|
 | 177 | # -----------------------------------------------------------------------------
 | 
|---|
| [8197] | 178 | 
 | 
|---|
 | 179 | !ifndef ENV_NAME
 | 
|---|
 | 180 | !error No environment signature has been defined ($(NAME_COMPLETE))
 | 
|---|
 | 181 | !endif
 | 
|---|
 | 182 | 
 | 
|---|
 | 183 | !ifndef MAKE_INCLUDE_SETUP
 | 
|---|
 | 184 | !error No setup to include has been determined (MAKE_INCLUDE_SETUP)
 | 
|---|
 | 185 | !endif
 | 
|---|
 | 186 | 
 | 
|---|
 | 187 | !if "$(ENV_STATUS)" != "OK"
 | 
|---|
 | 188 | !error Environment $(ENV_NAME) does work yet (ENV_STATUS is not OK).
 | 
|---|
 | 189 | !endif
 | 
|---|
 | 190 | 
 | 
|---|
 | 191 | !ifndef CC
 | 
|---|
 | 192 | !error Environment $(ENV_NAME) does not define variable (CC).
 | 
|---|
 | 193 | !endif
 | 
|---|
 | 194 | 
 | 
|---|
 | 195 | !ifndef CC_FLAGS_EXE
 | 
|---|
 | 196 | !error Environment $(ENV_NAME) does not define variable (CC_FLAGS_EXE).
 | 
|---|
 | 197 | !endif
 | 
|---|
 | 198 | 
 | 
|---|
 | 199 | !ifndef LINK
 | 
|---|
 | 200 | !error Environment $(ENV_NAME) does not define variable (LINK).
 | 
|---|
 | 201 | !endif
 | 
|---|
 | 202 | 
 | 
|---|
 | 203 | !ifndef LINK_FLAGS_EXE
 | 
|---|
 | 204 | !error Environment $(ENV_NAME) does not define variable (LINK_FLAGS_EXE).
 | 
|---|
 | 205 | !endif
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 | 
 | 
|---|
| [8253] | 208 | # -----------------------------------------------------------------------------
 | 
|---|
 | 209 | # Ensure the output path exists
 | 
|---|
 | 210 | # -----------------------------------------------------------------------------
 | 
|---|
 | 211 | !if "$(PATH_OBJ)" != ""
 | 
|---|
 | 212 | ! if [$(TOOL_EXISTS) $(PATH_OBJ)] != 0
 | 
|---|
 | 213 | !  ifndef BUILD_QUIET
 | 
|---|
 | 214 | !   if [$(ECHO) Target path $(PATH_OBJ) does NOT exist. Creating. $(CLRRST)]
 | 
|---|
 | 215 | !   endif
 | 
|---|
 | 216 | !  endif
 | 
|---|
 | 217 | !  if [$(TOOL_CREATEPATH) $(PATH_OBJ)]
 | 
|---|
 | 218 | !   error Fatal error: Could not create $(PATH_OBJ).
 | 
|---|
 | 219 | !  endif
 | 
|---|
 | 220 | ! endif
 | 
|---|
 | 221 | !endif
 | 
|---|
| [8197] | 222 | 
 | 
|---|
 | 223 | 
 | 
|---|
| [8253] | 224 | 
 | 
|---|
| [8294] | 225 | # -----------------------------------------------------------------------------
 | 
|---|
 | 226 | # Build the environments
 | 
|---|
 | 227 | # -----------------------------------------------------------------------------
 | 
|---|
 | 228 | 
 | 
|---|
 | 229 | # In the makefiles you're allowed to use the BUILD_ENVS_PRE,
 | 
|---|
 | 230 | # BUILD_ENV_FORCE, BUILD_ENVS_POST variables to make private changes to the
 | 
|---|
 | 231 | # environment. These are combined with the two base ones as follows:
 | 
|---|
 | 232 | #   $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
 | 
|---|
 | 233 | #
 | 
|---|
 | 234 | # BUILD_ENV_FORCE is used for changing the base compiler. Do *NOT* use
 | 
|---|
 | 235 | # BUILD_ENV for that! BUILD_ENV_FORCE isn't used directly but in the setup
 | 
|---|
 | 236 | # string above, but ENV_ENVS from the setup.[w]xyz.mk setup file is used.
 | 
|---|
 | 237 | #
 | 
|---|
 | 238 | 
 | 
|---|
 | 239 | # These strings are passed on to the BuildEnv.cmd script to setup the correct
 | 
|---|
 | 240 | # shell environment.
 | 
|---|
 | 241 | # TODO   Should these be overridable by setup.[w]xyz.mak ? (kso)
 | 
|---|
 | 242 | 
 | 
|---|
 | 243 | BUILD_ENVS_BASE_POST    = toolkit40
 | 
|---|
| [8299] | 244 | BUILD_ENVS_BASE_PRE     = odin32testcase
 | 
|---|
| [8294] | 245 | 
 | 
|---|
 | 246 | 
 | 
|---|
 | 247 | # Check if there is any change in the environment.
 | 
|---|
 | 248 | # If there are we will have to forward all target commands to the
 | 
|---|
 | 249 | # correct shell environment
 | 
|---|
 | 250 | !if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)" || "$(BUILD_ENVS_PRE)" != "" || "$(BUILD_ENVS_POST)" != ""
 | 
|---|
 | 251 | MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.forwarder.mak
 | 
|---|
 | 252 | 
 | 
|---|
 | 253 | 
 | 
|---|
 | 254 | # Compiler change or just environment change.
 | 
|---|
 | 255 | ! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
 | 
|---|
 | 256 | MAKE_INCLUDE_SETUP_FORCE = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENVFRC).mk
 | 
|---|
 | 257 | !  ifndef BUILD_QUIET
 | 
|---|
 | 258 | !   if [$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)]
 | 
|---|
 | 259 | !   endif
 | 
|---|
 | 260 | !  endif
 | 
|---|
 | 261 | !  include $(MAKE_INCLUDE_SETUP_FORCE)
 | 
|---|
 | 262 | BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
 | 
|---|
 | 263 | ! else
 | 
|---|
 | 264 | BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
 | 
|---|
 | 265 | ! endif
 | 
|---|
 | 266 | 
 | 
|---|
 | 267 | !endif
 | 
|---|
 | 268 | 
 | 
|---|
 | 269 | 
 | 
|---|
 | 270 | !endif # MAKE_SETUP_INCLUDED
 | 
|---|
 | 271 | 
 | 
|---|