| 1 | # $Id: process.mak,v 1.5 2002-04-16 00:09:35 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 | !error Fatal error: You must include setup.mak before process.mak in the makefile.
|
|---|
| 21 | !endif
|
|---|
| 22 | !if "$(ENV_STATUS)" != "OK"
|
|---|
| 23 | !error Fatal error: The enironment is not valid. Bad setup.mak?
|
|---|
| 24 | !endif
|
|---|
| 25 |
|
|---|
| 26 | !if "$(TARGET_NAME)" == ""
|
|---|
| 27 | !error Fatal error: TARGET_NAME is not defined! Should be set in the makefile.
|
|---|
| 28 | !endif
|
|---|
| 29 |
|
|---|
| 30 | # -----------------------------------------------------------------------------
|
|---|
| 31 | # Provide overridable defaults
|
|---|
| 32 | # -----------------------------------------------------------------------------
|
|---|
| 33 |
|
|---|
| 34 | # Default target mode is executable.
|
|---|
| 35 | !ifndef TARGET_MODE
|
|---|
| 36 | TARGET_MODE = EXE
|
|---|
| 37 | !endif
|
|---|
| 38 |
|
|---|
| 39 | # Default extension corresponds to the target mode.
|
|---|
| 40 | !ifndef TARGET_EXT
|
|---|
| 41 | ! if "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "DLL"
|
|---|
| 42 | TARGET_EXT = $(EXT_DLL)
|
|---|
| 43 | ! endif
|
|---|
| 44 | ! if "$(TARGET_MODE)" == "SYS"
|
|---|
| 45 | TARGET_EXT = $(EXT_SYS)
|
|---|
| 46 | ! endif
|
|---|
| 47 | ! if "$(TARGET_MODE)" == "EXE"
|
|---|
| 48 | TARGET_EXT = $(EXT_EXE)
|
|---|
| 49 | ! endif
|
|---|
| 50 | ! if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 51 | TARGET_EXT = $(EXT_LIB)
|
|---|
| 52 | ! endif
|
|---|
| 53 | ! if "$(TARGET_MODE)" == "EMPTY"
|
|---|
| 54 | TARGET_EXT = empty
|
|---|
| 55 | ! endif
|
|---|
| 56 | ! ifndef TARGET_EXT
|
|---|
| 57 | !error Error: TARGET_EXT not set. (Probably invalid TARGET_MODE.)
|
|---|
| 58 | ! endif
|
|---|
| 59 | !endif
|
|---|
| 60 |
|
|---|
| 61 | # Default target path. (where all the generated stuff for this target goes)
|
|---|
| 62 | !ifndef PATH_TARGET
|
|---|
| 63 | PATH_TARGET = $(PATH_OBJ)\$(TARGET_NAME).$(TARGET_EXT)
|
|---|
| 64 | !endif
|
|---|
| 65 |
|
|---|
| 66 | # Default target file. (output)
|
|---|
| 67 | !ifndef TARGET
|
|---|
| 68 | ! if "$(TARGET_MODE)" != "EMPTY"
|
|---|
| 69 | TARGET = $(PATH_TARGET)\$(TARGET_NAME).$(TARGET_EXT)
|
|---|
| 70 | ! endif
|
|---|
| 71 | !endif
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 | # Default object file. (output)
|
|---|
| 75 | !ifndef TARGET_OBJS
|
|---|
| 76 | TARGET_OBJS = $(PATH_TARGET)\$(TARGET_NAME).$(EXT_OBJ)
|
|---|
| 77 | !endif
|
|---|
| 78 |
|
|---|
| 79 | # Default libraries. (input)
|
|---|
| 80 | !ifndef TARGET_LIBS
|
|---|
| 81 | TARGET_LIBS = $(LIB_C_DLL) $(LIB_OS) $(LIB_C_RTDLL)
|
|---|
| 82 | !endif
|
|---|
| 83 |
|
|---|
| 84 | # Default definition file. (input)
|
|---|
| 85 | !ifndef TARGET_DEF
|
|---|
| 86 | TARGET_DEF = $(MAKEDIR)\$(PATH_DEF)\$(TARGET_NAME).def
|
|---|
| 87 | !endif
|
|---|
| 88 |
|
|---|
| 89 | # Default definition file for generating the import library. (input)
|
|---|
| 90 | !ifndef TARGET_IDEF
|
|---|
| 91 | TARGET_IDEF = $(TARGET_DEF)
|
|---|
| 92 | !endif
|
|---|
| 93 |
|
|---|
| 94 | # Default map file. (output)
|
|---|
| 95 | !ifndef TARGET_MAP
|
|---|
| 96 | TARGET_MAP = $(PATH_TARGET)\$(TARGET_NAME).map
|
|---|
| 97 | !endif
|
|---|
| 98 |
|
|---|
| 99 | # Default link file. (output)
|
|---|
| 100 | !ifndef TARGET_LNK
|
|---|
| 101 | TARGET_LNK = $(PATH_TARGET)\$(TARGET_NAME).lnk
|
|---|
| 102 | !endif
|
|---|
| 103 |
|
|---|
| 104 | # Default import library file. (output)
|
|---|
| 105 | !ifndef TARGET_ILIB
|
|---|
| 106 | ! if "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "DLL"
|
|---|
| 107 | TARGET_ILIB =$(PATH_LIB)\$(TARGET_NAME).$(EXT_ILIB)
|
|---|
| 108 | ! endif
|
|---|
| 109 | !endif
|
|---|
| 110 |
|
|---|
| 111 | # Default public library name. (output)
|
|---|
| 112 | !ifndef TARGET_PUBLIB
|
|---|
| 113 | ! if "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 114 | TARGET_PUBLIB=$(PATH_LIB)\$(TARGET_NAME).$(TARGET_EXT)
|
|---|
| 115 | ! else
|
|---|
| 116 | TARGET_PUBLIB=
|
|---|
| 117 | ! endif
|
|---|
| 118 | !endif
|
|---|
| 119 |
|
|---|
| 120 | # Default depend filename.
|
|---|
| 121 | !ifndef TARGET_DEPEND
|
|---|
| 122 | TARGET_DEPEND = $(PATH_TARGET)\.depend
|
|---|
| 123 | !endif
|
|---|
| 124 |
|
|---|
| 125 | # Default makefile name.
|
|---|
| 126 | !ifndef MAKEFILE
|
|---|
| 127 | MAKEFILE = makefile
|
|---|
| 128 | !endif
|
|---|
| 129 |
|
|---|
| 130 | # Ignore linker warnings for some target modes.
|
|---|
| 131 | !ifndef TARGET_IGNORE_LINKER_WARNINGS
|
|---|
| 132 | ! if "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT"
|
|---|
| 133 | TARGET_IGNORE_LINKER_WARNINGS = 1
|
|---|
| 134 | ! endif
|
|---|
| 135 | !endif
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 | # Default stacksize
|
|---|
| 139 | #
|
|---|
| 140 | # BUGBUG/TODO/FIXME
|
|---|
| 141 | # kso: Not sure if this is the *right* way to represent it!
|
|---|
| 142 | # It can't be when we start changing it based on the
|
|---|
| 143 | # current build environment.
|
|---|
| 144 | !ifndef TARGET_STACKSIZE
|
|---|
| 145 | # check if 16-bit target compiler
|
|---|
| 146 | ! if "$(BUILD_ENV)" == "MSCV6"
|
|---|
| 147 | TARGET_STACKSIZE=0x2000
|
|---|
| 148 | ! else
|
|---|
| 149 | TARGET_STACKSIZE=0x10000
|
|---|
| 150 | ! endif
|
|---|
| 151 | !endif
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 | # -----------------------------------------------------------------------------
|
|---|
| 156 | # Tell user what we're building.
|
|---|
| 157 | # -----------------------------------------------------------------------------
|
|---|
| 158 | !ifndef BUILD_QUIET
|
|---|
| 159 | !if [$(ECHO) Target is $(CLRFIL)$(TARGET)$(CLRRST)]
|
|---|
| 160 | !endif
|
|---|
| 161 | !endif
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 | # -----------------------------------------------------------------------------
|
|---|
| 165 | # Ensure the platform-specific target path exists
|
|---|
| 166 | # -----------------------------------------------------------------------------
|
|---|
| 167 |
|
|---|
| 168 | !if "$(TARGET_MODE)" != "EMPTY"
|
|---|
| 169 | ! if "$(PATH_TARGET)" != ""
|
|---|
| 170 | ! if [$(TOOL_EXISTS) $(PATH_TARGET)] != 0
|
|---|
| 171 | ! ifndef BUILD_QUIET
|
|---|
| 172 | ! if [$(ECHO) Target path $(CLRFIL)$(PATH_TARGET)$(CLRTXT) does NOT exist. Creating. $(CLRRST)]
|
|---|
| 173 | ! endif
|
|---|
| 174 | ! endif
|
|---|
| 175 | ! if [$(TOOL_CREATEPATH) $(PATH_TARGET)]
|
|---|
| 176 | ! error Could not create $(PATH_TARGET)
|
|---|
| 177 | ! endif
|
|---|
| 178 | ! endif
|
|---|
| 179 | ! endif
|
|---|
| 180 | !endif
|
|---|
| 181 | # not 100% sure about the != EMPTY stuff, but this is way faster.
|
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 | # -----------------------------------------------------------------------------
|
|---|
| 186 | # Common inference rules
|
|---|
| 187 | # -----------------------------------------------------------------------------
|
|---|
| 188 |
|
|---|
| 189 | .SUFFIXES:
|
|---|
| 190 | .SUFFIXES: .$(EXT_OBJ) .c .cpp .asm .$(EXT_RES) .rc .pre-c .pre-cpp # .h .def
|
|---|
| 191 |
|
|---|
| 192 |
|
|---|
| 193 | # Assembling assembly source.
|
|---|
| 194 | .asm{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 195 | @$(ECHO) Assembling $(CLRFIL)$< $(CLRRST)
|
|---|
| 196 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 197 | @$(AS) $(AS_FLAGS_SYS) $< $(AS_OBJ_OUT)$@
|
|---|
| 198 | !else
|
|---|
| 199 | @$(AS) $(AS_FLAGS) $< $(AS_OBJ_OUT)$@
|
|---|
| 200 | !endif
|
|---|
| 201 |
|
|---|
| 202 | .asm.$(EXT_OBJ):
|
|---|
| 203 | @$(ECHO) Assembling $(CLRFIL)$< $(CLRRST)
|
|---|
| 204 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 205 | @$(AS) $(AS_FLAGS_SYS) $< $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
|
|---|
| 206 | !else
|
|---|
| 207 | @$(AS) $(AS_FLAGS) $< $(AS_OBJ_OUT)$(PATH_TARGET)\$(@F)
|
|---|
| 208 | !endif
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 | # Compiling C++ source.
|
|---|
| 212 | .cpp{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 213 | @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 214 | @$(CXX) \
|
|---|
| 215 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 216 | $(CXX_FLAGS_EXE) \
|
|---|
| 217 | !endif
|
|---|
| 218 | !if "$(TARGET_MODE)" == "CRT"
|
|---|
| 219 | $(CXX_FLAGS_CRT) \
|
|---|
| 220 | !endif
|
|---|
| 221 | !if "$(TARGET_MODE)" == "DLL"
|
|---|
| 222 | $(CXX_FLAGS_DLL) \
|
|---|
| 223 | !endif
|
|---|
| 224 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 225 | $(CXX_FLAGS_SYS) \
|
|---|
| 226 | !endif
|
|---|
| 227 | !if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 228 | $(CXX_FLAGS_IFS) \
|
|---|
| 229 | !endif
|
|---|
| 230 | !if "$(CXX_LST_OUT)" != ""
|
|---|
| 231 | $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
|
|---|
| 232 | !endif
|
|---|
| 233 | $(CXX_OBJ_OUT)$@ $<
|
|---|
| 234 |
|
|---|
| 235 | .cpp.$(EXT_OBJ):
|
|---|
| 236 | @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 237 | @$(CXX) \
|
|---|
| 238 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 239 | $(CXX_FLAGS_EXE) \
|
|---|
| 240 | !endif
|
|---|
| 241 | !if "$(TARGET_MODE)" == "CRT"
|
|---|
| 242 | $(CXX_FLAGS_CRT) \
|
|---|
| 243 | !endif
|
|---|
| 244 | !if "$(TARGET_MODE)" == "DLL"
|
|---|
| 245 | $(CXX_FLAGS_DLL) \
|
|---|
| 246 | !endif
|
|---|
| 247 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 248 | $(CXX_FLAGS_SYS) \
|
|---|
| 249 | !endif
|
|---|
| 250 | !if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 251 | $(CXX_FLAGS_IFS) \
|
|---|
| 252 | !endif
|
|---|
| 253 | !if "$(CXX_LST_OUT)" != ""
|
|---|
| 254 | $(CXX_LST_OUT)$(PATH_TARGET)\$(@B).s \
|
|---|
| 255 | !endif
|
|---|
| 256 | $(CXX_OBJ_OUT)$(PATH_TARGET)\$(@F) $<
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 | # Pre-Compiling C++ source.
|
|---|
| 260 | .cpp.pre-cpp:
|
|---|
| 261 | @$(ECHO) C++ Compiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 262 | @$(CXX) \
|
|---|
| 263 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 264 | $(CXX_FLAGS_EXE) \
|
|---|
| 265 | !endif
|
|---|
| 266 | !if "$(TARGET_MODE)" == "CRT"
|
|---|
| 267 | $(CXX_FLAGS_CRT) \
|
|---|
| 268 | !endif
|
|---|
| 269 | !if "$(TARGET_MODE)" == "DLL"
|
|---|
| 270 | $(CXX_FLAGS_DLL) \
|
|---|
| 271 | !endif
|
|---|
| 272 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 273 | $(CXX_FLAGS_SYS) \
|
|---|
| 274 | !endif
|
|---|
| 275 | !if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 276 | $(CXX_FLAGS_IFS) \
|
|---|
| 277 | !endif
|
|---|
| 278 | $(CXX_PC_2_STDOUT) $< > $@
|
|---|
| 279 |
|
|---|
| 280 |
|
|---|
| 281 | # Compiling C source.
|
|---|
| 282 | .c{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 283 | @$(ECHO) C Compiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 284 | @$(CC) \
|
|---|
| 285 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 286 | $(CC_FLAGS_EXE) \
|
|---|
| 287 | !endif
|
|---|
| 288 | !if "$(TARGET_MODE)" == "CRT"
|
|---|
| 289 | $(CC_FLAGS_CRT) \
|
|---|
| 290 | !endif
|
|---|
| 291 | !if "$(TARGET_MODE)" == "DLL"
|
|---|
| 292 | $(CC_FLAGS_DLL) \
|
|---|
| 293 | !endif
|
|---|
| 294 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 295 | $(CC_FLAGS_SYS) \
|
|---|
| 296 | !endif
|
|---|
| 297 | !if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 298 | $(CC_FLAGS_IFS) \
|
|---|
| 299 | !endif
|
|---|
| 300 | !if "$(CC_LST_OUT)" != ""
|
|---|
| 301 | $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
|
|---|
| 302 | !endif
|
|---|
| 303 | $(CC_OBJ_OUT)$@ $<
|
|---|
| 304 |
|
|---|
| 305 | .c.$(EXT_OBJ):
|
|---|
| 306 | @$(ECHO) C Compiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 307 | @$(CC) \
|
|---|
| 308 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 309 | $(CC_FLAGS_EXE) \
|
|---|
| 310 | !endif
|
|---|
| 311 | !if "$(TARGET_MODE)" == "CRT"
|
|---|
| 312 | $(CC_FLAGS_CRT) \
|
|---|
| 313 | !endif
|
|---|
| 314 | !if "$(TARGET_MODE)" == "DLL"
|
|---|
| 315 | $(CC_FLAGS_DLL) \
|
|---|
| 316 | !endif
|
|---|
| 317 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 318 | $(CC_FLAGS_SYS) \
|
|---|
| 319 | !endif
|
|---|
| 320 | !if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 321 | $(CC_FLAGS_IFS) \
|
|---|
| 322 | !endif
|
|---|
| 323 | !if "$(CC_LST_OUT)" != ""
|
|---|
| 324 | $(CC_LST_OUT)$(PATH_TARGET)\$(@B).s \
|
|---|
| 325 | !endif
|
|---|
| 326 | $(CC_OBJ_OUT)$(PATH_TARGET)\$(@F) $<
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 | # Pre-Compiling C source.
|
|---|
| 330 | .c.pre-c:
|
|---|
| 331 | @$(ECHO) C PreCompiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 332 | @$(CC) \
|
|---|
| 333 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 334 | $(CC_FLAGS_EXE) \
|
|---|
| 335 | !endif
|
|---|
| 336 | !if "$(TARGET_MODE)" == "CRT"
|
|---|
| 337 | $(CC_FLAGS_CRT) \
|
|---|
| 338 | !endif
|
|---|
| 339 | !if "$(TARGET_MODE)" == "DLL"
|
|---|
| 340 | $(CC_FLAGS_DLL) \
|
|---|
| 341 | !endif
|
|---|
| 342 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 343 | $(CC_FLAGS_SYS) \
|
|---|
| 344 | !endif
|
|---|
| 345 | !if "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 346 | $(CC_FLAGS_IFS) \
|
|---|
| 347 | !endif
|
|---|
| 348 | $(CC_PC_2_STDOUT) $< > $@
|
|---|
| 349 |
|
|---|
| 350 |
|
|---|
| 351 | # Compiling resources.
|
|---|
| 352 | .rc{$(PATH_TARGET)}.res:
|
|---|
| 353 | @$(ECHO) RC Compiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 354 | @$(RC) $(RC_FLAGS) $< $@
|
|---|
| 355 |
|
|---|
| 356 | .rc.res:
|
|---|
| 357 | @$(ECHO) RC Compiler $(CLRFIL)$< $(CLRRST)
|
|---|
| 358 | @$(RC) $(RC_FLAGS) $< $(PATH_TARGET)\$(@F)
|
|---|
| 359 |
|
|---|
| 360 |
|
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 | # -----------------------------------------------------------------------------
|
|---|
| 365 | # The all rule - The default one, as it's the first rule in the file.
|
|---|
| 366 | # -----------------------------------------------------------------------------
|
|---|
| 367 | all: build
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 | # -----------------------------------------------------------------------------
|
|---|
| 372 | # The build rule - Build the target.
|
|---|
| 373 | # Must take into account any subdirectories and makefiles which is is to be
|
|---|
| 374 | # made before and after the target. That makes it kind of messy, sorry.
|
|---|
| 375 | # -----------------------------------------------------------------------------
|
|---|
| 376 | !ifdef SUBDIRS
|
|---|
| 377 | SUBDIRS_BUILD = subbuild
|
|---|
| 378 | $(SUBDIRS_BUILD):
|
|---|
| 379 | @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) build
|
|---|
| 380 | !endif
|
|---|
| 381 |
|
|---|
| 382 | !ifdef PREMAKEFILES
|
|---|
| 383 | PREMAKEFILES_BUILD = premakefiles_build
|
|---|
| 384 | $(PREMAKEFILES_BUILD):
|
|---|
| 385 | @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) build
|
|---|
| 386 | !endif
|
|---|
| 387 |
|
|---|
| 388 | build: $(SUBDIRS_BUILD) $(PREMAKEFILES_BUILD) $(TARGET) $(TARGET_ILIB) $(TARGET_PUBLIB)
|
|---|
| 389 | @$(ECHO) Successfully Built $(CLRFIL)$(TARGET) $(TARGET_ILIB)$(CLRRST)
|
|---|
| 390 | !ifdef POSTMAKEFILES
|
|---|
| 391 | @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 392 | !endif
|
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 | # -----------------------------------------------------------------------------
|
|---|
| 397 | # The lib rule - Make Public libraries.
|
|---|
| 398 | # Must take into account any subdirectories and makefiles which is is to be
|
|---|
| 399 | # made before and after the target. That makes it kind of messy, sorry.
|
|---|
| 400 | # -----------------------------------------------------------------------------
|
|---|
| 401 | !ifdef SUBDIRS
|
|---|
| 402 | SUBDIRS_LIB = subdir_lib
|
|---|
| 403 | $(SUBDIRS_LIB):
|
|---|
| 404 | @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) lib
|
|---|
| 405 | !endif
|
|---|
| 406 |
|
|---|
| 407 | !ifdef PREMAKEFILES
|
|---|
| 408 | PREMAKEFILES_LIB = premakefiles_lib
|
|---|
| 409 | $(PREMAKEFILES_LIB):
|
|---|
| 410 | @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) lib
|
|---|
| 411 | !endif
|
|---|
| 412 |
|
|---|
| 413 | lib: $(SUBDIRS_LIB) $(TARGET_ILIB) $(TARGET_PUBLIB)
|
|---|
| 414 | !ifdef POSTMAKEFILES
|
|---|
| 415 | @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 416 | !endif
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 | # -----------------------------------------------------------------------------
|
|---|
| 421 | # The install rule - Copies target to main binary directory.
|
|---|
| 422 | # Installation order is not concidered vital, so subdirectories and
|
|---|
| 423 | # pre-makefiles are processed after this directory. This might be changed.
|
|---|
| 424 | # -----------------------------------------------------------------------------
|
|---|
| 425 | install:
|
|---|
| 426 | !if "$(TARGET_MODE)" == "EXE"
|
|---|
| 427 | if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_BIN)
|
|---|
| 428 | !endif
|
|---|
| 429 | !if "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT"
|
|---|
| 430 | if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_DLL)
|
|---|
| 431 | !endif
|
|---|
| 432 | !if "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 433 | if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_SYS)
|
|---|
| 434 | !endif
|
|---|
| 435 | !if 0
|
|---|
| 436 | # Nothing to do here currently. These are either private or they're allready where they should be.
|
|---|
| 437 | #
|
|---|
| 438 | # TODO/BUGBUG/FIXME:
|
|---|
| 439 | # The PUB stuff should be change to a separate variable.
|
|---|
| 440 | # It will make life easier to just state that this target,
|
|---|
| 441 | # what ever it is, should be public.
|
|---|
| 442 | #
|
|---|
| 443 | # That's allow project to install targets during make without
|
|---|
| 444 | # running the install command by setting some target modes
|
|---|
| 445 | # public by default.
|
|---|
| 446 | # (kso)
|
|---|
| 447 | #!if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB"
|
|---|
| 448 | # if exist $(TARGET) $(TOOL_COPY) $(TARGET) $(PATH_LIB)
|
|---|
| 449 | #!endif
|
|---|
| 450 | !endif
|
|---|
| 451 | !if "$(TARGET_DOCS)" != ""
|
|---|
| 452 | $(TOOL_COPY) $(TARGET_DOCS) $(PATH_DOC)
|
|---|
| 453 | !endif
|
|---|
| 454 | !ifdef SUBDIRS
|
|---|
| 455 | @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) $@
|
|---|
| 456 | !endif
|
|---|
| 457 | !ifdef PREMAKEFILES
|
|---|
| 458 | @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 459 | !endif
|
|---|
| 460 | !ifdef POSTMAKEFILES
|
|---|
| 461 | @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 462 | !endif
|
|---|
| 463 |
|
|---|
| 464 |
|
|---|
| 465 |
|
|---|
| 466 | # -----------------------------------------------------------------------------
|
|---|
| 467 | # The testcase rule - Execute testcases when present.
|
|---|
| 468 | # Testcases are either a testcase.mak file or a testcase subdirectory.
|
|---|
| 469 | # -----------------------------------------------------------------------------
|
|---|
| 470 | !ifndef BUILD_OWN_TESTCASE_RULE
|
|---|
| 471 | testcase: install
|
|---|
| 472 | !if [$(TOOL_EXISTS) testcase] == 0
|
|---|
| 473 | @$(TOOL_DODIRS) "testcase" $(TOOL_MAKE) $@
|
|---|
| 474 | !endif
|
|---|
| 475 | !if [$(TOOL_EXISTS) testcase.mak] == 0
|
|---|
| 476 | @$(TOOL_DOMAKES) "testcase.mak" $(TOOL_MAKE) $@
|
|---|
| 477 | !endif
|
|---|
| 478 | !ifdef SUBDIRS
|
|---|
| 479 | @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) $@
|
|---|
| 480 | !endif
|
|---|
| 481 | !ifdef PREMAKEFILES
|
|---|
| 482 | @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 483 | !endif
|
|---|
| 484 | !ifdef POSTMAKEFILES
|
|---|
| 485 | @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 486 | !endif
|
|---|
| 487 | !endif
|
|---|
| 488 |
|
|---|
| 489 |
|
|---|
| 490 |
|
|---|
| 491 | # -----------------------------------------------------------------------------
|
|---|
| 492 | # The dep rule - Make dependencies.
|
|---|
| 493 | # -----------------------------------------------------------------------------
|
|---|
| 494 | dep:
|
|---|
| 495 | @$(ECHO) Building dependencies $(CLRRST)
|
|---|
| 496 | @$(TOOL_DEP) $(TOOL_DEP_FLAGS) -o$$(PATH_TARGET) -d$(TARGET_DEPEND)\
|
|---|
| 497 | !ifdef TARGET_NO_DEP
|
|---|
| 498 | -x$(TARGET_NO_DEP: =;)\
|
|---|
| 499 | !endif
|
|---|
| 500 | $(TOOL_DEP_FILES)
|
|---|
| 501 | !ifdef SUBDIRS
|
|---|
| 502 | @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) NODEP=1 $@
|
|---|
| 503 | !endif
|
|---|
| 504 | !ifdef PREMAKEFILES
|
|---|
| 505 | @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) NODEP=1 $@
|
|---|
| 506 | !endif
|
|---|
| 507 | !ifdef POSTMAKEFILES
|
|---|
| 508 | @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) NODEP=1 $@
|
|---|
| 509 | !endif
|
|---|
| 510 |
|
|---|
| 511 |
|
|---|
| 512 |
|
|---|
| 513 | # -----------------------------------------------------------------------------
|
|---|
| 514 | # The clean rule - Clean up output files.
|
|---|
| 515 | # The current setup doesn't clean the installed ones.
|
|---|
| 516 | # -----------------------------------------------------------------------------
|
|---|
| 517 | clean:
|
|---|
| 518 | !if "$(PATH_TARGET)" != "" # paranoia
|
|---|
| 519 | $(TOOL_RM) \
|
|---|
| 520 | $(PATH_TARGET)\*.$(EXT_OBJ) \
|
|---|
| 521 | $(PATH_TARGET)\*.$(EXT_ILIB) \
|
|---|
| 522 | $(PATH_TARGET)\*.$(EXT_EXE) \
|
|---|
| 523 | $(PATH_TARGET)\*.$(EXT_DLL) \
|
|---|
| 524 | $(PATH_TARGET)\*.$(EXT_RES) \
|
|---|
| 525 | $(PATH_TARGET)\*.$(EXT_SYS) \
|
|---|
| 526 | $(PATH_TARGET)\*.$(EXT_LIB)
|
|---|
| 527 | $(TOOL_RM) \
|
|---|
| 528 | $(PATH_TARGET)\*.$(EXT_IFS) \
|
|---|
| 529 | $(PATH_TARGET)\*.map \
|
|---|
| 530 | $(PATH_TARGET)\*.s \
|
|---|
| 531 | $(PATH_TARGET)\*.lst \
|
|---|
| 532 | $(PATH_TARGET)\*.lnk \
|
|---|
| 533 | $(PATH_TARGET)\*.pre-c \
|
|---|
| 534 | $(PATH_TARGET)\*.pre-cpp \
|
|---|
| 535 | $(PATH_TARGET)\.depend
|
|---|
| 536 | !endif
|
|---|
| 537 | !ifdef SUBDIRS
|
|---|
| 538 | @$(TOOL_DODIRS) "$(SUBDIRS)" $(TOOL_MAKE) $@
|
|---|
| 539 | !endif
|
|---|
| 540 | !ifdef PREMAKEFILES
|
|---|
| 541 | @$(TOOL_DOMAKES) "$(PREMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 542 | !endif
|
|---|
| 543 | !ifdef POSTMAKEFILES
|
|---|
| 544 | @$(TOOL_DOMAKES) "$(POSTMAKEFILES)" $(TOOL_MAKE) $@
|
|---|
| 545 | !endif
|
|---|
| 546 |
|
|---|
| 547 |
|
|---|
| 548 |
|
|---|
| 549 | # -----------------------------------------------------------------------------
|
|---|
| 550 | # The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
|
|---|
| 551 | # -----------------------------------------------------------------------------
|
|---|
| 552 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS"
|
|---|
| 553 | $(TARGET): $(TARGET_OBJS) $(TARGET_RES) $(TARGET_DEF) $(TARGET_LNK) $(TARGET_DEPS)
|
|---|
| 554 | @$(ECHO) Linking $(TARGET_MODE) $(CLRFIL)$@ $(CLRRST)
|
|---|
| 555 | !ifdef TARGET_IGNORE_LINKER_WARNINGS
|
|---|
| 556 | -4 \
|
|---|
| 557 | !endif
|
|---|
| 558 | !if "$(TARGET_MODE)" == "EXE"
|
|---|
| 559 | $(LINK_CMD_EXE)
|
|---|
| 560 | !endif
|
|---|
| 561 | !if "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "CRT"
|
|---|
| 562 | @$(LINK_CMD_DLL)
|
|---|
| 563 | !endif
|
|---|
| 564 | !if "$(TARGET_MODE)" == "SYS"
|
|---|
| 565 | @$(LINK_CMD_SYS)
|
|---|
| 566 | !endif
|
|---|
| 567 | !if "$(TARGET_MODE)" == "IFS"
|
|---|
| 568 | @$(LINK_CMD_IFS)
|
|---|
| 569 | !endif
|
|---|
| 570 | !if "$(TARGET_RES)" != "" && "$(RL)" != ""
|
|---|
| 571 | @$(ECHO) Linking Resources $(CLRRST)
|
|---|
| 572 | @$(RL) $(RL_FLAGS) $(TARGET_RES) $@
|
|---|
| 573 | !endif
|
|---|
| 574 | !if "$(TARGET_DLLRNAME)" != ""
|
|---|
| 575 | @$(ECHO) Dll Rename $(TARGET_DLLRNAME)
|
|---|
| 576 | $(TOOL_DLLRNAME) $(TARGET) $(TARGET_DLLRNAME)
|
|---|
| 577 | !endif
|
|---|
| 578 |
|
|---|
| 579 |
|
|---|
| 580 | #
|
|---|
| 581 | # Linker parameter file.
|
|---|
| 582 | #
|
|---|
| 583 | $(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
|
|---|
| 584 | @$(ECHO) Creating Linker Input File $(CLRRST)<<$@
|
|---|
| 585 | $(LINK_LNK1)
|
|---|
| 586 | $(LINK_LNK2)
|
|---|
| 587 | $(LINK_LNK3)
|
|---|
| 588 | $(LINK_LNK4)
|
|---|
| 589 | $(LINK_LNK5)
|
|---|
| 590 | <<KEEP
|
|---|
| 591 |
|
|---|
| 592 |
|
|---|
| 593 |
|
|---|
| 594 | # -----------------------------------------------------------------------------
|
|---|
| 595 | # The $(TARGET) rule - For LIB, PUBLIB, and SYSLIB targets.
|
|---|
| 596 | # -----------------------------------------------------------------------------
|
|---|
| 597 | !if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "PUBLIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 598 | $(TARGET): $(TARGET_OBJS) $(TARGET_LNK) $(TARGET_DEPS)
|
|---|
| 599 | @$(ECHO) Creating Library $(CLRFIL)$@ $(CLRRST)
|
|---|
| 600 | $(TOOL_RM) $@
|
|---|
| 601 | $(AR_CMD)
|
|---|
| 602 |
|
|---|
| 603 |
|
|---|
| 604 | #
|
|---|
| 605 | # Lib parameter file.
|
|---|
| 606 | #
|
|---|
| 607 | $(TARGET_LNK): $(MAKE_INCLUDE_PROCESS) $(MAKE_INCLUDE_SETUP) $(PATH_MAKE)\setup.mak $(MAKEFILE)
|
|---|
| 608 | @$(ECHO) Creating Lib Input File $(CLRRST)<<$@
|
|---|
| 609 | $(AR_LNK1)
|
|---|
| 610 | $(AR_LNK2)
|
|---|
| 611 | $(AR_LNK3)
|
|---|
| 612 | $(AR_LNK4)
|
|---|
| 613 | $(AR_LNK5)
|
|---|
| 614 | <<KEEP
|
|---|
| 615 | !endif
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 | #
|
|---|
| 619 | # Copy rule for public libraries.
|
|---|
| 620 | # BUGBUG/TODO/FIXME: get rid of the PUBLIB stuff. see commet in install.
|
|---|
| 621 | #
|
|---|
| 622 | !if "$(TARGET_MODE)" == "PUBLIB"
|
|---|
| 623 | $(TARGET_PUBLIB): $(TARGET)
|
|---|
| 624 | @$(ECHO) Copying $(CLRFIL)$(TARGET)$(CLRTXT) to the Library Directory $(CLRRST)
|
|---|
| 625 | @$(TOOL_COPY) $** $@
|
|---|
| 626 | !endif
|
|---|
| 627 |
|
|---|
| 628 |
|
|---|
| 629 |
|
|---|
| 630 | # -----------------------------------------------------------------------------
|
|---|
| 631 | # The $(TARGET) rule - For EMPTY targets.
|
|---|
| 632 | # -----------------------------------------------------------------------------
|
|---|
| 633 | !if "$(TARGET_MODE)" == "EMPTY"
|
|---|
| 634 | $(TARGET):
|
|---|
| 635 | @$(ECHO) .
|
|---|
| 636 | !endif
|
|---|
| 637 |
|
|---|
| 638 |
|
|---|
| 639 |
|
|---|
| 640 | # -----------------------------------------------------------------------------
|
|---|
| 641 | # The $(TARGET_ILIB) rule - Make import library.
|
|---|
| 642 | # -----------------------------------------------------------------------------
|
|---|
| 643 | !ifdef TARGET_ILIB
|
|---|
| 644 | $(TARGET_ILIB): $(TARGET_IDEF)
|
|---|
| 645 | @$(ECHO) Creating Import Library $(CLRFIL)$@ $(CLRRST)
|
|---|
| 646 | $(IMPLIB) $(IMPLIB_FLAGS) $@ $(TARGET_IDEF)
|
|---|
| 647 | !endif
|
|---|
| 648 | !endif
|
|---|
| 649 |
|
|---|
| 650 |
|
|---|
| 651 |
|
|---|
| 652 | # -----------------------------------------------------------------------------
|
|---|
| 653 | # The .force rule - Force a remake of something everytime.
|
|---|
| 654 | # -----------------------------------------------------------------------------
|
|---|
| 655 | .force:
|
|---|
| 656 | @$(ECHO) .
|
|---|
| 657 |
|
|---|
| 658 |
|
|---|
| 659 |
|
|---|
| 660 | # -----------------------------------------------------------------------------
|
|---|
| 661 | # Read Dependencies.
|
|---|
| 662 | # -----------------------------------------------------------------------------
|
|---|
| 663 |
|
|---|
| 664 | !if "$(TARGET_MODE)" != "EMPTY"
|
|---|
| 665 |
|
|---|
| 666 | #
|
|---|
| 667 | # Read dependency file for current directory
|
|---|
| 668 | #
|
|---|
| 669 | !if [$(TOOL_EXISTS) $(TARGET_DEPEND)] == 0
|
|---|
| 670 | ! ifndef BUILD_QUIET
|
|---|
| 671 | ! if [$(ECHO) Including dependency $(CLRFIL)$(TARGET_DEPEND)$(CLRRST)]
|
|---|
| 672 | ! endif
|
|---|
| 673 | ! endif
|
|---|
| 674 | ! include $(TARGET_DEPEND)
|
|---|
| 675 | !else
|
|---|
| 676 | ! ifndef NODEP
|
|---|
| 677 | ! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(TARGET_DEPEND) is missing.$(CLRRST)]
|
|---|
| 678 | ! endif
|
|---|
| 679 | ! endif
|
|---|
| 680 | !endif
|
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 | #
|
|---|
| 684 | # Read global dependency files.
|
|---|
| 685 | #
|
|---|
| 686 | !ifdef BUILD_DEPEND1
|
|---|
| 687 | ! if [$(TOOL_EXISTS) $(BUILD_DEPEND1)] == 0
|
|---|
| 688 | ! ifndef BUILD_QUIET
|
|---|
| 689 | ! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND1)$(CLRRST)]
|
|---|
| 690 | ! endif
|
|---|
| 691 | ! endif
|
|---|
| 692 | ! include $(BUILD_DEPEND1)
|
|---|
| 693 | ! else
|
|---|
| 694 | ! ifndef NODEP
|
|---|
| 695 | ! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND1) is missing.$(CLRRST)]
|
|---|
| 696 | ! endif
|
|---|
| 697 | ! endif
|
|---|
| 698 | ! endif
|
|---|
| 699 | !endif
|
|---|
| 700 |
|
|---|
| 701 | !ifdef BUILD_DEPEND2
|
|---|
| 702 | ! if [$(TOOL_EXISTS) $(BUILD_DEPEND2)] == 0
|
|---|
| 703 | ! ifndef BUILD_QUIET
|
|---|
| 704 | ! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND2)$(CLRRST)]
|
|---|
| 705 | ! endif
|
|---|
| 706 | ! endif
|
|---|
| 707 | ! include $(BUILD_DEPEND2)
|
|---|
| 708 | ! else
|
|---|
| 709 | ! ifndef NODEP
|
|---|
| 710 | ! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND2) is missing.$(CLRRST)]
|
|---|
| 711 | ! endif
|
|---|
| 712 | ! endif
|
|---|
| 713 | ! endif
|
|---|
| 714 | !endif
|
|---|
| 715 |
|
|---|
| 716 |
|
|---|
| 717 | !ifdef BUILD_DEPEND3
|
|---|
| 718 | ! if [$(TOOL_EXISTS) $(BUILD_DEPEND3)] == 0
|
|---|
| 719 | ! ifndef BUILD_QUIET
|
|---|
| 720 | ! if [$(ECHO) Including dependency $(CLRFIL)$(BUILD_DEPEND3)$(CLRRST)]
|
|---|
| 721 | ! endif
|
|---|
| 722 | ! endif
|
|---|
| 723 | ! include $(BUILD_DEPEND3)
|
|---|
| 724 | ! else
|
|---|
| 725 | ! ifndef NODEP
|
|---|
| 726 | ! if [$(ECHO) $(CLRERR)WARNING: Please make dependencies first. $(BUILD_DEPEND3) is missing.$(CLRRST)]
|
|---|
| 727 | ! endif
|
|---|
| 728 | ! endif
|
|---|
| 729 | ! endif
|
|---|
| 730 | !endif
|
|---|
| 731 |
|
|---|
| 732 |
|
|---|
| 733 | !endif
|
|---|
| 734 |
|
|---|