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