- Timestamp:
- May 31, 2004 2:19:05 AM (21 years ago)
- Location:
- trunk/kBuild
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/footer.kmk
r73 r74 60 60 # @param $1 source file 61 61 # @param $2 normalized main target 62 _SOURCE_TOOL = $(firstword $($1_$2_TOOL) $($1_TOOL) $($2_TOOL) )62 _SOURCE_TOOL = $(firstword $($1_$2_TOOL) $($1_TOOL) $($2_TOOL) $(TOOL)) 63 63 64 64 ## Figure out where to put object files. … … 92 92 endef 93 93 $(foreach template, $(_TEMPLATES), $(eval $(def_templates))) 94 94 95 95 96 96 # … … 102 102 # @param $(target) Target name. 103 103 define def_inherit_defaults_one 104 ifndef $ 1_$(prop)104 ifndef $(target)_$(prop) 105 105 ifdef $(prop) 106 $ 1_$(prop) := $($(prop))106 $(target)_$(prop) := $($(prop)) 107 107 endif 108 108 endif … … 215 215 $(eval tool:=$(call _SOURCE_TOOL,$(source),$(target))) 216 216 $(eval defs :=\ 217 $(TOOL_$(tool)_$(type)DEFS)\ 218 $(TOOL_$(tool)_$(type)DEFS.$(BUILD_TYPE))\ 219 $(DEFS)\ 220 $(DEFS.$(BUILD_TYPE))\ 221 $($(target)_DEFS)\ 222 $($(target)_DEFS.$(BUILD_TYPE))\ 223 $($(target)_DEFS.$(BUILD_TARGET))\ 224 $($(source)_DEFS)\ 225 $($(source)_DEFS.$(BUILD_TYPE))\ 226 $($(source)_DEFS.$(BUILD_TARGET))\ 227 $($(source)_$(type)DEFS)\ 228 $($(source)_$(type)DEFS.$(BUILD_TYPE))\ 229 $($(source)_$(type)DEFS.$(BUILD_TARGET))\ 230 $($(target)_$(type)DEFS)\ 231 $($(target)_$(type)DEFS.$(BUILD_TYPE))\ 232 $($(target)_$(type)DEFS.$(BUILD_TARGET))\ 233 $($(target)_$(source)_DEFS)\ 234 $($(target)_$(source)_DEFS.$(BUILD_TYPE))\ 235 $($(target)_$(source)_DEFS.$(BUILD_TARGET))\ 217 236 $($(target)_$(source)_$(type)DEFS)\ 218 $($(target)_$(source)_DEFS)\ 219 $($(source)_$(type)DEFS)\ 220 $($(source)_DEFS)\ 221 $($(target)_$(type)DEFS)\ 222 $($(target)_DEFS)\ 223 $(DEFS)\ 224 $(TOOL_$(tool)_$(type)DEFS)\ 237 $($(target)_$(source)_$(type)DEFS.$(BUILD_TYPE))\ 238 $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET))\ 225 239 ) 226 240 $(eval incs :=\ 241 $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET))\ 242 $($(target)_$(source)_$(type)INCS.$(BUILD_TYPE))\ 227 243 $($(target)_$(source)_$(type)INCS)\ 244 $($(target)_$(source)_INCS.$(BUILD_TARGET))\ 245 $($(target)_$(source)_INCS.$(BUILD_TYPE))\ 228 246 $($(target)_$(source)_INCS)\ 247 $($(source)_$(type)INCS.$(BUILD_TARGET))\ 248 $($(source)_$(type)INCS.$(BUILD_TYPE))\ 229 249 $($(source)_$(type)INCS)\ 250 $($(source)_INCS.$(BUILD_TARGET))\ 251 $($(source)_INCS.$(BUILD_TYPE))\ 230 252 $($(source)_INCS)\ 253 $($(target)_$(type)INCS.$(BUILD_TARGET))\ 254 $($(target)_$(type)INCS.$(BUILD_TYPE))\ 231 255 $($(target)_$(type)INCS)\ 256 $($(target)_INCS.$(BUILD_TARGET))\ 257 $($(target)_INCS.$(BUILD_TYPE))\ 232 258 $($(target)_INCS)\ 259 $(INCS.$(BUILD_TARGET))\ 260 $(INCS.$(BUILD_TYPE))\ 233 261 $(INCS)\ 262 $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET))\ 263 $(TOOL_$(tool)_$(type)INCS.$(BUILD_TYPE))\ 234 264 $(TOOL_$(tool)_$(type)INCS)\ 235 265 ) … … 237 267 $(TOOL_$(tool)_$(type)FLAGS)\ 238 268 $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TYPE))\ 269 $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET))\ 239 270 $($(type)FLAGS)\ 240 271 $($(type)FLAGS.$(BUILD_TYPE))\ 272 $($(type)FLAGS.$(BUILD_TARGET))\ 241 273 $($(target)_$(type)FLAGS)\ 242 274 $($(target)_$(type)FLAGS.$(BUILD_TYPE))\ 275 $($(target)_$(type)FLAGS.$(BUILD_TARGET))\ 243 276 $($(source)_$(type)FLAGS)\ 244 277 $($(source)_$(type)FLAGS.$(BUILD_TYPE))\ 278 $($(source)_$(type)FLAGS.$(BUILD_TARGET))\ 245 279 $($(target)_$(source)_$(type)FLAGS)\ 246 280 $($(target)_$(source)_$(type)FLAGS.$(BUILD_TYPE))\ 281 $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET))\ 247 282 ) 248 283 $(eval outbase := $(call _OBJECT_BASE,$(source),$(target))) 249 284 $(eval dirdep := $(dir $(outbase)).dir_created) 250 $(eval objsuff := $(firstword $($(target)_$(source)_OBJSUFF) $($(source)_OBJSUFF) $($(target)_OBJSUFF) $(TOOL_$(tool)_$(type)OBJSUFF) $(SUFF_OBJ))) 285 $(eval objsuff := $(firstword \ 286 $($(target)_$(source)_OBJSUFF.$(BUILD_TARGET))\ 287 $($(target)_$(source)_OBJSUFF)\ 288 $($(source)_OBJSUFF.$(BUILD_TARGET))\ 289 $($(source)_OBJSUFF)\ 290 $($(target)_OBJSUFF.$(BUILD_TARGET))\ 291 $($(target)_OBJSUFF)\ 292 $(TOOL_$(tool)_$(type)OBJSUFF.$(BUILD_TARGET))\ 293 $(TOOL_$(tool)_$(type)OBJSUFF)\ 294 $(SUFF_OBJ)\ 295 )) 251 296 $(eval obj := $(outbase)$(objsuff)) 252 $(eval dep file:= $(outbase)$(SUFF_DEP))297 $(eval dep := $(outbase)$(SUFF_DEP)) 253 298 254 299 #$ (warning dbg: target=$(target) source=$(source) tool=$(tool) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff)) … … 261 306 262 307 ## Generic macro for processing all target sources. 263 # @param $ targetNormalized target name.308 # @param $(target) Normalized target name. 264 309 define def_target_sources 265 310 #$ (warning def_target_sources) … … 283 328 284 329 ## Library (one). 285 # @param $( lib) Library name330 # @param $(target) Normalized library (target) name. 286 331 define def_lib 287 332 # source -> object … … 290 335 # library 291 336 $(eval tool := $(firstword $($(target)_TOOL) $(TOOL))) 292 $(eval flags := $($(target)_ARFLAGS) $(ARFLAGS) $(TOOL_$(tool)_ARFLAGS)) 293 $(eval libsuff := $(firstword $($(target)_LIBSUFF) $($(target)_LIBSUFF) $(TOOL_$(tool)_ARLIBSUFF) $(SUFF_LIB))) 337 $(eval flags :=\ 338 $(TOOL_$(tool)_ARFLAGS)\ 339 $(TOOL_$(tool)_ARFLAGS.$(BUILD_TYPE))\ 340 $(ARFLAGS)\ 341 $(ARFLAGS.$(BUILD_TYPE))\ 342 $($(target)_ARFLAGS)\ 343 $($(target)_ARFLAGS.$(BUILD_TYPE))\ 344 ) 345 $(eval libsuff := $(firstword\ 346 $($(target)_LIBSUFF.$(BUILD_TARGET))\ 347 $($(target)_LIBSUFF)\ 348 $(TOOL_$(tool)_ARLIBSUFF.$(BUILD_TARGET))\ 349 $(TOOL_$(tool)_ARLIBSUFF)\ 350 $(SUFF_LIB)\ 351 )) 294 352 ## @todo prefix 295 353 $(eval outbase := $(call _TARGET_BASE,$(target),$(target))) … … 315 373 # 316 374 375 ## Program (one). 376 # @param $(target) Normalized target (program) name. 377 define def_program 378 # source -> object 379 $(eval $(def_target_sources)) 380 381 # library 382 $(eval tool := $(firstword $($(target)_TOOL) $(TOOL))) 383 $(eval flags :=\ 384 $(TOOL_$(tool)_LDFLAGS)\ 385 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\ 386 $(LDFLAGS)\ 387 $(LDFLAGS.$(BUILD_TYPE))\ 388 $($(target)_LDFLAGS)\ 389 $($(target)_LDFLAGS.$(BUILD_TYPE))\ 390 ) 391 $(eval exesuff := $(firstword $($(target)_EXESUFF) $($(target)_EXESUFF) $(TOOL_$(tool)_LDEXESUFF) $(SUFF_EXE))) 392 $(eval outbase := $(call _TARGET_BASE,$(target),$(target))) 393 $(eval exe := $(outbase)$(exesuff)) 394 $(eval objs = $(_OBJS_$(target))) 395 $(eval libs :=\ 396 $($(target)_LIBS.$(BUILD_TYPE))\ 397 $($(target)_LIBS)\ 398 $(LIBS.$(BUILD_TYPE))\ 399 $(LIBS)\ 400 $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\ 401 $(TOOL_$(tool)_LIBS)\ 402 ) 403 $(eval libpath :=\ 404 $($(target)_LIBPATH.$(BUILD_TYPE))\ 405 $($(target)_LIBPATH)\ 406 $(LIBPATH.$(BUILD_TYPE))\ 407 $(LIBPATH)\ 408 $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\ 409 $(TOOL_$(tool)_LIBPATH)\ 410 ) 411 $(eval dirdep := $(dir $(exe)).dir_created) 412 ## @todo fix dependencies 413 $(eval deps := ) 414 # 415 $(eval deffile := $(strip $(firstword 416 $($(target)_DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\ 417 $($(target)_DEFFILE.$(BUILD_TARGET))\ 418 $($(target)_DEFFILE.$(BUILD_TYPE))\ 419 $($(target)_DEFFILE)\ 420 $(DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\ 421 $(DEFFILE.$(BUILD_TARGET))\ 422 $(DEFFILE.$(BUILD_TYPE))\ 423 $(DEFFILE)\ 424 ))) 425 $(eval custom_pre := $(strip $(firstword 426 $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\ 427 $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\ 428 $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\ 429 $($(target)_CUSTOM_PRE)\ 430 $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\ 431 $(CUSTOM_PRE.$(BUILD_TARGET))\ 432 $(CUSTOM_PRE.$(BUILD_TYPE))\ 433 $(CUSTOM_PRE)\ 434 ))) 435 $(eval custom_post := $(strip $(firstword 436 $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\ 437 $($(target)_CUSTOM_POST.$(BUILD_TARGET))\ 438 $($(target)_CUSTOM_POST.$(BUILD_TYPE))\ 439 $($(target)_CUSTOM_POST)\ 440 $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\ 441 $(CUSTOM_POST.$(BUILD_TARGET))\ 442 $(CUSTOM_POST.$(BUILD_TYPE))\ 443 $(CUSTOM_POST)\ 444 ))) 445 446 $(eval $(TOOL_$(tool)_LINK_PROGRAM)) 447 448 _OBJS += $(_OBJS_$(target)) 449 _EXES += $(exe) 450 endef 451 452 # Process libraries 453 $(foreach target, $(PROGRAMS), $(eval $(def_program))) 454 317 455 318 456 … … 360 498 361 499 362 obj s: $(_OBJS)500 objects: $(_OBJS) 363 501 echo "dbg: _OBJS = $(_OBJS)" 364 502 365 lib s: $(_LIBS)503 libraries: $(_LIBS) 366 504 echo "dbg: _LIBS = $(_LIBS)" 505 506 programs: $(_EXES) 507 echo "dbg: _EXES = $(_EXES)" 367 508 368 509 -
trunk/kBuild/tools/GCC.kmk
r73 r74 26 26 27 27 28 TOOL_GCC := Generic GCC28 TOOL_GCC := Generic GCC 29 29 30 TOOL_GCC_CC := gcc$(HOSTSUFF_EXE)31 TOOL_GCC_COBJSUFF := .o32 TOOL_GCC_CFLAGS := -g33 TOOL_GCC_CFLAGS.debug := -O034 TOOL_GCC_CFLAGS.release := -O235 TOOL_GCC_CFLAGS.profile := -pg36 TOOL_GCC_CINCS :=37 TOOL_GCC_CDEFS :=30 TOOL_GCC_CC := gcc$(HOSTSUFF_EXE) 31 TOOL_GCC_COBJSUFF := .o 32 TOOL_GCC_CFLAGS := -g 33 TOOL_GCC_CFLAGS.debug := -O0 34 TOOL_GCC_CFLAGS.release := -O2 35 TOOL_GCC_CFLAGS.profile := -pg 36 TOOL_GCC_CINCS := 37 TOOL_GCC_CDEFS := 38 38 39 TOOL_GCC_CC := gcc$(HOSTSUFF_EXE) 40 TOOL_GCC_CXXOBJSUFF := .o 39 TOOL_GCC_CXX := g++$(HOSTSUFF_EXE) 40 TOOL_GCC_CXXOBJSUFF := .o 41 TOOL_GCC_CXXOBJSUFF := .o 42 TOOL_GCC_CXXFLAGS := -g 43 TOOL_GCC_CXXFLAGS.debug := -O0 44 TOOL_GCC_CXXFLAGS.release := -O2 45 TOOL_GCC_CXXFLAGS.profile := -pg 46 TOOL_GCC_CXXINCS := 47 TOOL_GCC_CXXDEFS := 41 48 42 TOOL_GCC_AS := as$(HOSTSUFF_EXE)43 TOOL_GCC_ASOBJSUFF := .o49 TOOL_GCC_AS := as$(HOSTSUFF_EXE) 50 TOOL_GCC_ASOBJSUFF := .o 44 51 45 TOOL_GCC_AR := ar$(HOSTSUFF_EXE) 46 TOOL_GCC_ARFLAGS := cr 47 TOOL_GCC_ARLIBSUFF := .a 52 TOOL_GCC_AR := ar$(HOSTSUFF_EXE) 53 TOOL_GCC_ARFLAGS := cr 54 TOOL_GCC_ARLIBSUFF := .a 55 56 TOOL_GCC_LD := g++$(HOSTSUFF_EXE) 57 TOOL_GCC_LDFLAGS := 58 TOOL_GCC_LDFLAGS.debug := -g 59 TOOL_GCC_LDFLAGS.release := -s 48 60 49 61 … … 61 73 # @param $(objsuff) Object suffix. 62 74 define TOOL_GCC_COMPILE_C 63 #$ (warning dbg: GCC: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))75 #$ (warning dbg: TOOL_GCC_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff)) 64 76 $(obj): $(dirdep) $(PATH_CURRENT)/$(source) 65 77 $(call MSG_L2,Compiling $$@ using GCC) … … 68 80 -Wp,-MT,$(dep) -Wp,-MD,$$@\ 69 81 -o $$@\ 70 82 $(PATH_CURRENT)/$(source) 71 83 72 84 endef … … 83 95 # @param $(outbase) Output basename (full). Use this for list files and such. 84 96 define TOOL_GCC_LINK_LIBRARY 85 #$ (warning dbg: GCC: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase))97 #$ (warning dbg: TOOL_GCC_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase)) 86 98 $(lib): $(dirdep) $(objs) $(deps) 87 99 $(call MSG_L1,Creating Library $$@) … … 91 103 endef 92 104 105 106 ## Link program 107 # @param $(target) Normalized main target name. 108 # @param $(exe) Program name. 109 # @param $(objs) Object files to link together. 110 # @param $(libs) Libraries to search. 111 # @param $(libpath) Library search paths. 112 # @param $(flags) Flags. 113 # @param $(dirdep) Directory creation dependency. 114 # @param $(deps) Other dependencies. 115 # @param $(deffile) Definition file. (optional, PC only) 116 # @param $(custom_pre) Custom step invoked before linking. 117 # @param $(custom_post) Custom step invoked after linking. 118 # 119 # @param $(outbase) Output basename (full). Use this for list files and such. 120 define TOOL_GCC_LINK_PROGRAM 121 #$ (warning dbg: TOOL_GCC_LINK_PROGRAM: target=$(target) exe=$(exe) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 122 $(exe): $(dirdep) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(deps) 123 $(call MSG_L1,Creating Program $$@) 124 ifneq ($(custom_pre),) 125 $(eval $(custom_pre)) 126 endif 127 $(TOOL_GCC_LD) $(flags) -o $$@ $(objs) \ 128 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) 129 ifneq ($(custom_post),) 130 $(eval $(custom_post)) 131 endif 132 133 endef 134
Note:
See TracChangeset
for help on using the changeset viewer.