Changeset 380 for trunk/kBuild
- Timestamp:
- Dec 18, 2005, 2:52:47 PM (20 years ago)
- Location:
- trunk/kBuild
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kBuild/footer.kmk
r353 r380 47 47 _DEPFILES := 48 48 49 # included dependency files. 50 _DEPFILES_INCLUDED := 51 52 49 53 # All kind of output files except for _OBJS and _DEPFILES. 50 54 # Compiling or linking definition outputting other things that $@ and any … … 63 67 _SYSMODS := 64 68 _INSTALLS := 69 _INSTALLS_DIRS := 65 70 _OTHERS := 66 _DIRS := $(PATH_TARGET)/ 71 _DIRS := $(PATH_TARGET)/ $(PATH_TARGET) 67 72 _IMPORT_LIBS := 68 73 … … 366 371 $(foreach sdk, $(_SDKS), $(eval $(value def_sdks_include_one))) 367 372 373 368 374 # 369 375 # Object processing. 370 376 # 371 377 372 ## Generates the '::' rule for building all objects of a source file. 378 ## wrapper the compile command dependency check. 379 ifndef NO_COMPILE_CMDS_DEPS 380 _DEP_COMPILE_CMDS = $(if $(subst $(strip $($(target)_$(source)_CMDS_PREV_)),,$(strip $($(target)_$(source)_CMDS_))),FORCE,) 381 else 382 _DEP_COMPILE_CMDS = 383 endif 384 385 ## Generates the rules for building a specific object, and the '::' aliases 386 # for building a source file. 373 387 # @param $(obj) The object file. 374 define def_target_obj_rule 388 define def_target_source_rule 389 $(obj) $($(target)_$(source)_OUTPUT_): \ 390 $($(target)_$(source)_DEPEND_) \ 391 $(_DEP_COMPILE_CMDS) \ 392 | \ 393 $($(target)_$(source)_DEPORD_) 394 $(call MSG_L1,Creating $$@) 395 $(RM) -f $(dep) $(out) $($(target)_$(source)_OUTPUT_) 396 $(custom_pre) 397 398 $($(target)_$(source)_CMDS_) 399 400 $(custom_post) 401 ifndef NO_COMPILE_CMDS_DEPS 402 @$(APPEND) "$(dep)" 403 @$(APPEND) "$(dep)" 'define $(target)_$(source)_CMDS_PREV_' 404 @$(APPEND) "$(dep)" '$(subst $(NL),'$(NL)$(TAB)@$(APPEND) "$(dep)" ',$($(target)_$(source)_CMDS_))' 405 @$(APPEND) "$(dep)" 'endef' 406 endif 407 375 408 $(basename $(notdir $(obj))).o:: 376 409 + $$(MAKE) -B -f $$(MAKEFILE) $(obj) … … 378 411 + $$(MAKE) -B -f $$(MAKEFILE) $(obj) 379 412 endef 413 414 415 ## wrapper the link command dependency check. 416 ifndef NO_COMPILE_CMDS_DEPS 417 _DEP_LINK_CMDS = $(if $(subst $(strip $($(target)_CMDS_PREV_)),,$(strip $($(target)_CMDS_))),FORCE,) 418 else 419 _DEP_LINK_CMDS = 420 endif 421 422 ## Generate the link rule for a target. 423 # @param $(target) The normalized target name. 424 # @param $(dirdep) Directories we depend upon begin created before linking. 425 # @param $(dep) The name of the dependency file. 426 # @param $(out) 427 # @param $($(target)_OUTPUT_) Output files from the link. 428 # @param $($(target)_DEPEND_) Dependencies. 429 # @param $($(target)_DEPORD_) Dependencies which should only affect build order. 430 # @param $($(target)_CMDS_) The link commands. 431 # @param $($(target)_CMDS_PREV_) The link commands from the previous run. 432 define def_link_rule 433 $(out) $($(target)_OUTPUT_): \ 434 $($(target)_DEPEND_) \ 435 $(_DEP_LINK_CMDS) \ 436 | \ 437 $($(target)_DEPORD_) 438 $(call MSG_L1,Creating $$@) 439 $(RM) -f $(dep) $($(target)_OUTPUT_) 440 $(custom_pre) 441 442 $($(target)_CMDS_) 443 444 $(custom_post) 445 ifndef NO_LINK_CMDS_DEP 446 @$(APPEND) "$(dep)" 'define $(target)_CMDS_PREV_' 447 @$(APPEND) "$(dep)" '$(subst $(NL),'$(NL)$(TAB)@$(APPEND) "$(dep)" ',$($(target)_CMDS_))' 448 @$(APPEND) "$(dep)" 'endef' 449 endif 450 451 $(basename $(notdir $(out))):: 452 + $$(MAKE) -B -f $$(MAKEFILE) $(out) 453 endef 454 455 456 ## Generate the link & lib install rule 457 # @param $(target) Normalized target name. 458 # @param $(out) The build target. 459 # @param $(INSTARGET_$(target)) The installation targets. 460 # @param $(mode) The file mode (optional) 461 define def_link_install_rule 462 $(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target)))) 463 $(INSTALL) $$(if $(mode),-m $(mode)) $(out) $$@ 464 endef 465 380 466 381 467 … … 628 714 $(SUFF_OBJ)) 629 715 obj := $(outbase)$(objsuff) 630 dep := $(outbase)$(SUFF_DEP)631 716 deps := \ 632 717 $($(target)_$(source)_DEPS)\ … … 645 730 $($(target)_DEPS.$(bld_trg_cpu)) 646 731 732 # dependencies 733 dep := $(obj)$(SUFF_DEP) 734 ifndef NO_COMPILE_DEPS 735 _DEPFILES_INCLUDED += $(dep) 736 $(if $(wildcard $(dep)),$(eval include $(dep))) 737 endif 647 738 648 739 #$ (warning dbg: target=$(target) source=$(source) tool=$(tool) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 649 ifndef TOOL_$(tool)_COMPILE_$(type) 740 ifndef TOOL_$(tool)_COMPILE_$(type)_CMDS 650 741 $(warning kBuild: tools: \ 651 742 1 $($(target)_$(source)_$(type)TOOL.$(bld_trg)) \ … … 665 756 15 $(TOOL.$(bld_trg)) \ 666 757 16 $(TOOL) ) 667 $(error kBuild: TOOL_$(tool)_COMPILE_$(type) is not defined. source=$(source) target=$(target) ) 668 endif 669 670 # generate the rules 671 $(eval $(TOOL_$(tool)_COMPILE_$(type))) 672 673 $(eval $(def_target_obj_rule)) 674 758 $(error kBuild: TOOL_$(tool)_COMPILE_$(type)_CMDS is not defined. source=$(source) target=$(target) ) 759 endif 760 761 # call the tool 762 $(target)_$(source)_CMDS_ := $(TOOL_$(tool)_COMPILE_$(type)_CMDS) 763 $(target)_$(source)_OUTPUT_ := $(TOOL_$(tool)_COMPILE_$(type)_OUTPUT) 764 $(target)_$(source)_DEPEND_ := $(TOOL_$(tool)_COMPILE_$(type)_DEPEND) $(deps) $(source) 765 $(target)_$(source)_DEPORD_ := $(TOOL_$(tool)_COMPILE_$(type)_DEPORD) $(dirdep) 766 767 # generate the compile rule. 768 $(eval $(def_target_source_rule)) 769 770 _OUT_FILES += $($(target)_$(source)_OUTPUT_) 675 771 $(target)_OBJS_ += $(obj) 676 _DEPFILES += $(dep)677 772 678 773 endef … … 697 792 ,$(eval $(value def_target_source_c_cpp_asm)) ) 698 793 699 endef700 701 ## Generate the link & lib install rule702 # @param $(target) Normalized target name.703 # @param $(out) The build target.704 # @param $(INSTARGET_$(target)) The installation targets.705 define def_link_install_rule706 $(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))707 $(RM) -f $$@708 $(CP) $(out) $$@709 794 endef 710 795 … … 804 889 deps := $($(target)_DEPS) 805 890 806 lib := $(out) 807 libsuff := $(suff) 808 $(eval $(TOOL_$(tool)_LINK_LIBRARY)) 891 # dependency file 892 dep := $(out)$(SUFF_DEP) 893 ifndef NO_LINK_CMDS_DEP 894 _DEPFILES_INCLUDED += $(dep) 895 $(if $(wildcard $(dep)),$(eval include $(dep))) 896 endif 897 898 # check that the tool is defined. 899 ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS 900 $(warning kBuild: tools: \ 901 1 $($(target)_$(source)TOOL.$(bld_trg)) \ 902 2 $($(target)_$(source)TOOL) \ 903 3 $($(target)_TOOL.$(bld_trg)) \ 904 4 $($(target)_TOOL) \ 905 5 $($(source)TOOL) \ 906 6 $($(source)TOOL.$(bld_trg)) \ 907 7 $(TOOL.$(bld_trg)) \ 908 8 $(TOOL) ) 909 $(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) ) 910 endif 911 912 # call the tool 913 $(target)_CMDS_ := $(TOOL_$(tool)_LINK_LIBRARY_CMDS) 914 $(target)_OUTPUT_ := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT) 915 $(target)_DEPEND_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $(objs) 916 $(target)_DEPORD_ := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep) 917 918 # generate the link rule. 919 $(eval $(def_link_rule)) 809 920 810 921 # installing and globals 811 922 definst := $(PATH_LIB) 812 typevar := _LIBS923 typevar := _LIBS 813 924 $(eval $(value def_target_install_pluss)) 814 925 endef 815 926 816 927 # Process libraries 928 mode := 0644 817 929 $(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)), $(eval $(value def_lib))) 818 930 … … 829 941 # @param $(definst) The default _INST value. 830 942 # @param $(typevar) The name of the variable with all the root targets of its type. 831 define def_link_ prolog943 define def_link_common 832 944 # basics 833 945 bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE)) … … 989 1101 endif # NOINST 990 1102 991 endef 992 993 994 ## 995 # Typical link epilog. 996 # 997 # @param $(target) Normalized target name. 998 # @param $(out) The output file. 999 define def_link_epilog 1000 1001 _INSTALLS += $(INSTARGET_$(target)) 1002 _OBJS += $($(target)_OBJS_) 1003 _OUT_FILES += $(out) 1004 _CLEAN_FILES += $($(target)_CLEAN) 1005 1006 endef 1007 1008 1009 # 1010 # BLDPROGS 1011 # 1012 1013 ## Build program (one). 1014 # @param $(target) Normalized target (program) name. 1015 define def_bldprog 1016 1017 # set NOINST if not forced installation. 1018 ifndef $(target)_INST 1019 $(target)_NOINST := 1 1020 endif 1021 1022 # prolog 1023 $(eval $(value def_link_prolog)) 1024 1025 # body 1026 ifndef TOOL_$(tool)_LINK_PROGRAM 1027 $(warning kBuild: tools: \ 1028 1 $($(target)_$(source)TOOL.$(bld_trg)) \ 1029 2 $($(target)_$(source)TOOL) \ 1030 3 $($(target)_TOOL.$(bld_trg)) \ 1031 4 $($(target)_TOOL) \ 1032 5 $(TOOL.$(bld_trg)) \ 1033 6 $(TOOL) ) 1034 $(error kBuild: TOOL_$(tool)_LINK_PROGRAM is not defined. target=$(target) ) 1035 endif 1036 $(eval $(TOOL_$(tool)_LINK_PROGRAM)) 1037 1038 # epilog 1039 $(eval $(value def_link_epilog)) 1040 1041 endef 1042 1043 # Process build programs. 1044 EXT := EXE 1045 EXTPRE := HOST 1046 definst := $(PATH_BIN) 1047 typevar := _BLDPROGS 1048 bld_trg_base_var := PLATFORM 1049 $(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)), $(eval $(value def_bldprog))) 1050 1051 1052 1053 # 1054 # DLLS 1055 # 1056 1057 ## DLL (one). 1058 # @param $(target) Normalized target (program) name. 1059 define def_dll 1060 1061 # prolog 1062 $(eval $(value def_link_prolog)) 1063 1064 # body 1065 ifndef TOOL_$(tool)_LINK_DLL 1103 # dependency file 1104 dep := $(outbase)$(SUFF_DEP) 1105 ifndef NO_LINK_CMDS_DEP 1106 _DEPFILES_INCLUDED += $(dep) 1107 $(if $(wildcard $(dep)),$(eval include $(dep))) 1108 endif 1109 1110 # check that the tool is defined. 1111 ifndef TOOL_$(tool)_$(tool_do)_CMDS 1066 1112 $(warning kBuild: tools: \ 1067 1113 1 $($(target)_$(source)TOOL.$(bld_trg)) \ … … 1073 1119 7 $(TOOL.$(bld_trg)) \ 1074 1120 8 $(TOOL) ) 1075 $(error kBuild: TOOL_$(tool)_LINK_DLL is not defined. target=$(target) ) 1076 endif 1077 $(eval $(TOOL_$(tool)_LINK_DLL)) 1078 1079 # epilog 1080 $(eval $(value def_link_epilog)) 1081 1082 endef 1121 $(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) ) 1122 endif 1123 1124 # call the tool 1125 $(target)_CMDS_ := $(TOOL_$(tool)_$(tool_do)_CMDS) 1126 $(target)_OUTPUT_ := $(TOOL_$(tool)_$(tool_do)_OUTPUT) 1127 $(target)_DEPEND_ := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $(objs) 1128 $(target)_DEPORD_ := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) 1129 1130 # generate the link rule. 1131 $(eval $(def_link_rule)) 1132 1133 1134 # Update globals. 1135 _OBJS += $($(target)_OBJS_) 1136 _OUT_FILES += $($(target)_OUTPUT_) $(out) 1137 _CLEAN_FILES += $($(target)_CLEAN) 1138 _INSTALLS += $(INSTARGET_$(target)) 1139 1140 endef 1141 1142 1143 # 1144 # BLDPROGS 1145 # 1146 1147 ## Build program (one). 1148 # @param $(target) Normalized target (program) name. 1149 define def_bldprog 1150 1151 # set NOINST if not forced installation. 1152 ifndef $(target)_INST 1153 $(target)_NOINST := 1 1154 endif 1155 1156 # do the usual stuff. 1157 $(eval $(value def_link_common)) 1158 1159 endef 1160 1161 # Process build programs. 1162 EXT := EXE 1163 EXTPRE := HOST 1164 tool_do := LINK_PROGRAM 1165 definst := $(PATH_BIN) 1166 typevar := _BLDPROGS 1167 mode := 0755 1168 bld_trg_base_var := PLATFORM 1169 $(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)), $(eval $(value def_bldprog))) 1170 1171 1172 1173 # 1174 # DLLS 1175 # 1083 1176 1084 1177 # Process dlls 1085 1178 EXT := DLL 1086 1179 EXTPRE := 1180 tool_do := LINK_DLL 1087 1181 definst := $(PATH_DLL) 1088 1182 typevar := _DLLS 1183 mode := 0755 1089 1184 bld_trg_base_var := TARGET 1090 $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)), $(eval $(value def_dll))) 1091 1185 $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)), $(eval $(value def_link_common))) 1092 1186 1093 1187 … … 1100 1194 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval $(value def_lib))) 1101 1195 else 1102 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval $(value def_ dll)))1196 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), $(eval $(value def_link_common))) 1103 1197 endif 1104 1198 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)), \ … … 1109 1203 # PROGRAMS 1110 1204 # 1111 1112 ## Program (one).1113 # @param $(target) Normalized target (program) name.1114 define def_program1115 1116 # prolog1117 $(eval $(value def_link_prolog))1118 1119 # body1120 ifndef TOOL_$(tool)_LINK_PROGRAM1121 $(warning kBuild: tools: \1122 1 $($(target)_$(source)TOOL.$(bld_trg)) \1123 2 $($(target)_$(source)TOOL) \1124 3 $($(target)_TOOL.$(bld_trg)) \1125 4 $($(target)_TOOL) \1126 5 $($(source)TOOL) \1127 6 $($(source)TOOL.$(bld_trg)) \1128 7 $(TOOL.$(bld_trg)) \1129 8 $(TOOL) )1130 $(error kBuild: TOOL_$(tool)_LINK_PROGRAM is not defined. target=$(target) )1131 endif1132 $(eval $(TOOL_$(tool)_LINK_PROGRAM))1133 1134 # epilog1135 $(eval $(value def_link_epilog))1136 1137 endef1138 1205 1139 1206 # Process programs 1140 1207 EXT := EXE 1141 1208 EXTPRE := 1209 tool_do := LINK_PROGRAM 1142 1210 definst := $(PATH_BIN) 1143 1211 typevar := _PROGRAMS 1212 mode := 0755 1144 1213 bld_trg_base_var := TARGET 1145 $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)), $(eval $(value def_ program)))1214 $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)), $(eval $(value def_link_common))) 1146 1215 1147 1216 … … 1150 1219 # SYSMODS 1151 1220 # 1152 1153 ## System module (one).1154 # @param $(target) Normalized target (program) name.1155 define def_sysmod1156 1157 # prolog1158 $(eval $(value def_link_prolog))1159 1160 # body1161 ifndef TOOL_$(tool)_LINK_SYSMOD1162 $(warning kBuild: tools: \1163 1 $($(target)_$(source)TOOL.$(bld_trg)) \1164 2 $($(target)_$(source)TOOL) \1165 3 $($(target)_TOOL.$(bld_trg)) \1166 4 $($(target)_TOOL) \1167 5 $($(source)TOOL) \1168 6 $($(source)TOOL.$(bld_trg)) \1169 7 $(TOOL.$(bld_trg)) \1170 8 $(TOOL) )1171 $(error kBuild: TOOL_$(tool)_LINK_SYSMOD is not defined. target=$(target) )1172 endif1173 $(eval $(TOOL_$(tool)_LINK_SYSMOD))1174 1175 # epilog1176 $(eval $(value def_link_epilog))1177 1178 endef1179 1221 1180 1222 # Process sysmods 1181 1223 EXT := SYS 1182 1224 EXTPRE := 1225 tool_do := LINK_SYSMOD 1183 1226 definst := $(PATH_SYS) 1184 1227 typevar := _SYSMODS 1228 mode := 0644 1185 1229 bld_trg_base_var := TARGET 1186 $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)), $(eval $(value def_ sysmod)))1230 $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)), $(eval $(value def_link_common))) 1187 1231 1188 1232 … … 1201 1245 # the install rule 1202 1246 $(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst))) 1203 $$( RM) -f $$@1247 $$(if $$(filter $(INSTALL),$(inscmd)),,$$(RM) -f $$@) 1204 1248 $(inscmd) 1205 1249 endef … … 1226 1270 # _INST 1227 1271 ifdef $(srcsrc)_INST 1228 inst = $(srcsrc)_INST1272 inst := $(patsubst %/,%,$($(srcsrc)_INST))/$(dir $(srcdst)) 1229 1273 else 1230 1274 ifdef $(target)_INST 1231 inst = $(target)_INST1232 else 1233 inst =1275 inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(srcdst)) 1276 else 1277 inst := $(dir $(srcdst)) 1234 1278 endif 1235 1279 endif 1236 1280 1237 1281 # calc target 1238 insdst := $(call $(instfun),$(srcdst),$(target),$( $(inst)),$(PATH_INS))1282 insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS)) 1239 1283 #$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) srcdst=$(srcsrc) inst=$(inst) => insdst=$(insdst)) 1240 1284 … … 1246 1290 inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target)) 1247 1291 else 1248 inscmd := $$( CP) $(srcsrc) $(insdst)1292 inscmd := $$(INSTALL) $(srcsrc) $(insdst) 1249 1293 endif 1250 1294 endif … … 1262 1306 $(insdst) : | $(call DIRDEP,$(dir $(insdst))) 1263 1307 $$(RM) -f $$@ 1264 $$(LN_SYMLINK) $(s rcsrc) $(insdst)1308 $$(LN_SYMLINK) $(symdst) $(insdst) 1265 1309 endef 1266 1310 … … 1269 1313 1270 1314 # deal with '=>' in the source file name. 1271 s rcdst := $(subst =>, ,$(src))1272 s rcsrc := $(firstword $(srcdst))1273 s rcdst := $(word $(words $(srcdst)),$(srcdst))1315 symdst := $(subst =>, ,$(src)) 1316 symlnk := $(firstword $(symdst)) 1317 symdst := $(word $(words $(symdst)),$(symdst)) 1274 1318 1275 1319 # _INSTFUN 1276 ifdef $(s rcsrc)_INSTFUN1277 instfun := $(s rcsrc)_INSTFUN1320 ifdef $(symlnk)_INSTFUN 1321 instfun := $(symlnk)_INSTFUN 1278 1322 else 1279 1323 ifdef $(target)_INSTFUN … … 1285 1329 1286 1330 # _INST 1287 ifdef $(s rcsrc)_INST1288 inst = $(srcsrc)_INST1331 ifdef $(symlnk)_INST 1332 inst := $(patsubst %/,%,$($(symlnk)_INST))/$(dir $(symlnk)) 1289 1333 else 1290 1334 ifdef $(target)_INST 1291 inst = $(target)_INST1292 else 1293 inst =1335 inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(symlnk)) 1336 else 1337 inst := $(dir $(symlnk)) 1294 1338 endif 1295 1339 endif 1296 1340 1297 1341 # calc target 1298 insdst := $(call $(instfun),$(s rcdst),$(target),$(inst),$(PATH_INS))1299 #$(warning s rcsrc=$(srcsrc) srcdst=$(srcdst) insdst=$(insdst))1342 insdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS)) 1343 #$(warning symlnk=$(symlnk) symdst=$(symdst) insdst=$(insdst) instfun=$(instfun) inst='$(inst)') 1300 1344 1301 1345 # generate the rule (need double evaluation here) … … 1304 1348 INSTARGET_$(target) += $(insdst) 1305 1349 endef 1350 1351 1352 ## generate the install rule 1353 define def_install_directory_rule 1354 # the install rule 1355 $(insdst): 1356 $(INSTALL) -d \ 1357 $(if $(uid),-o $(uid))\ 1358 $(if $(gid),-g $(gid))\ 1359 $(if $(mode),-m $(mode))\ 1360 $(insdst) 1361 1362 .NOTPARALLEL: $(insdst) 1363 endef 1364 1365 1366 ## create one directory 1367 define def_install_directory 1368 1369 # _INST 1370 ifdef $(directory)_INST 1371 inst := $(PATH_INS)/$(patsubst %/,%,$($(directory)_INST)) 1372 else 1373 ifdef $(target)_INST 1374 inst := $(PATH_INS)/$(patsubst %/,%,$($(target)_INST)) 1375 else 1376 inst := $(PATH_INS) 1377 endif 1378 endif 1379 1380 mode := $(firstword \ 1381 $($(target)_$(directory)_MODE.$(bld_trg)) \ 1382 $($(target)_$(directory)_MODE) \ 1383 $($(directory)_MODE.$(bld_trg)) \ 1384 $($(directory)_MODE) \ 1385 $($(target)_MODE.$(bld_trg)) \ 1386 $($(target)_MODE)) 1387 uid := $(firstword \ 1388 $($(target)_$(directory)_UID.$(bld_trg)) \ 1389 $($(target)_$(directory)_UID) \ 1390 $($(directory)_UID.$(bld_trg)) \ 1391 $($(directory)_UID) \ 1392 $($(target)_UID.$(bld_trg)) \ 1393 $($(target)_UID)) 1394 gid := $(firstword \ 1395 $($(target)_$(directory)_GID.$(bld_trg)) \ 1396 $($(target)_$(directory)_GID) \ 1397 $($(directory)_GID.$(bld_trg)) \ 1398 $($(directory)_GID) \ 1399 $($(target)_GID.$(bld_trg)) \ 1400 $($(target)_GID)) 1401 1402 insdst := $(inst)/$(directory)/ 1403 #$(warning directory=$(directory) inst=$(inst) insdst=$(insdst) mode=$(mode) gid=$(gid) uid=$(uid)) 1404 1405 # generate the rule (need double evaluation here) 1406 $(eval $(def_install_directory_rule)) 1407 1408 INSTARGET_DIRS_$(target) += $(insdst) 1409 endef 1410 1306 1411 1307 1412 ## process one install target. … … 1313 1418 1314 1419 INSTARGET_$(target) := 1420 INSTARGET_DIRS_$(target) := 1421 1422 $(foreach directory,$($(target)_DIRS) $($(target)_DIRS.$(bld_trg)) $($(target)_DIRS.$(bld_trg_arch)) $($(target)_DIRS.$(bld_trg_cpu)) $($(target)_DIRS.$(bld_type)), \ 1423 $(eval $(value def_install_directory))) 1424 1315 1425 $(foreach src,$($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)), \ 1316 1426 $(eval $(value def_install_src))) … … 1319 1429 $(eval $(value def_install_symlink))) 1320 1430 1321 _INSTALLS += $(INSTARGET_$(target)) 1431 _INSTALLS += $(INSTARGET_$(target)) $($(target)_GOALS) 1432 _INSTALLS_DIRS += $(INSTARGET_DIRS_$(target)) 1322 1433 endef 1323 1434 … … 1342 1453 # 1343 1454 _DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS))) 1455 $(foreach directory,$(_INSTALLS_DIRS), $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL)))) 1456 1344 1457 1345 1458 define def_mkdir_rule … … 1363 1476 # 1364 1477 do-clean: 1365 $(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_ CLEAN_FILES) $(OTHER_CLEAN)1478 $(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN) 1366 1479 1367 1480 … … 1435 1548 $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_makefile))) 1436 1549 1437 ifdef KBUILD_SAFE_PARALLEL L1550 ifdef KBUILD_SAFE_PARALLEL 1438 1551 .NOTPARALLEL: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this 1439 1552 .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_after pass_$(pass)_this pass_$(pass)_doit … … 1466 1579 # @param $(prev_pass) The previous pass name. 1467 1580 define def_pass_order 1468 ifdef KBUILD_SAFE_PARALLEL L1581 ifdef KBUILD_SAFE_PARALLEL 1469 1582 .NOTPARALLEL: pass_$(pass)_order 1470 1583 .PHONY: pass_$(pass)_order … … 1501 1614 + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive 1502 1615 1616 # @todo make this a non-default pass! 1503 1617 uninstall: 1504 1618 $(RM) -f $(_INSTALLS) 1619 1620 install: pass_installs 1505 1621 1506 1622 # misc shortcuts. 1507 targets: bldprogs libraries dlls programs sysmods others install 1623 targets: bldprogs libraries dlls programs sysmods others installs 1508 1624 objects: $(_OBJS) 1509 1625 bldprogs: $(_BLDPROGS) … … 1513 1629 sysmods: $(_SYSMODS) 1514 1630 others: $(_OTHERS) 1515 install :$(_INSTALLS)1631 installs: $(_INSTALLS_DIRS) $(_INSTALLS) 1516 1632 1517 1633 … … 1532 1648 @$(ECHO) " TARGET_$(target)=$(TARGET_$(target))" $(NLTAB)\ 1533 1649 @$(ECHO) " INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\ 1534 $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE) OBJS_ , \1650 $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE) OBJS_ CLEAN, \ 1535 1651 $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(BUILD_TARGET))) \ 1536 1652 $(if $($(target)_$(prop).$(_tmp)),\ -
trunk/kBuild/header.kmk
r353 r380 34 34 35 35 # 36 # The FORCE rule. 37 # 38 FORCE: 39 40 # 36 41 # Try avoid inference rules. 37 42 # … … 49 54 lastword = $(word $(words $(1)), $(1)) 50 55 56 ## 57 # Newline character(s). 58 define NL 59 60 61 endef 62 63 ## 64 # Tab character. 65 TAB := $(subst ., ,.) 66 67 ## 68 # Space character. 69 SP := $(subst ., ,.) 70 71 ## 72 # Checks if two strings are equal. 73 # @returns blank if equal 74 # @returns non-blank if not equal. 75 # @param $1 String 1. 76 # @param $2 String 2 77 STRCMP = $( 51 78 52 79 # … … 337 364 # Standard kBuild tools. 338 365 # 339 DEP := $(PATH_TOOLS)/kDep$(HOSTSUFF_EXE)340 DEP_PRE := $(PATH_TOOLS)/kDepPre$(HOSTSUFF_EXE)341 366 ifeq ($(MAKE),kmk) 342 MAKE := $(PATH_TOOLS)/kmk$(HOSTSUFF_EXE) 343 endif 344 345 # Standard Unix shell utils 346 ifdef KMK_BUILTIN 347 ECHO := kmk_builtin_echo 348 MKDIR := kmk_builtin_mkdir 349 RM := kmk_builtin_rm 350 CP := kmk_builtin_cp 351 else 352 ECHO := echo 353 MKDIR := $(PATH_TOOLS)/mkdir$(HOSTSUFF_EXE) 354 RM := $(PATH_TOOLS)/rm$(HOSTSUFF_EXE) 355 CP := $(PATH_TOOLS)/cp$(HOSTSUFF_EXE) 356 APPEND := $(PATH_TOOLS)/append$(HOSTSUFF_EXE) 357 endif 358 CP_EXT := $(PATH_TOOLS)/cp$(HOSTSUFF_EXE) 359 MV := $(PATH_TOOLS)/mv$(HOSTSUFF_EXE) 360 SED := $(PATH_TOOLS)/sed$(HOSTSUFF_EXE) 361 CAT := $(PATH_TOOLS)/cat$(HOSTSUFF_EXE) 362 LN_SYMLINK := $(CP) 363 #LN_SYMLINK := ln -s 364 # Bourn shell clone. 365 MAKESHELL := $(PATH_TOOLS)/ash$(HOSTSUFF_EXE) 366 SHELL := $(MAKESHELL) 367 MAKE := $(PATH_TOOLS)/kmk$(HOSTSUFF_EXE) 368 endif 369 370 DEP_EXT := $(PATH_TOOLS)/kDep$(HOSTSUFF_EXE) 371 ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep) 372 DEP := kmk_builtin_kDepPre 373 else 374 DEP := $(DEP_EXT) 375 endif 376 377 DEP_PRE_EXT := $(PATH_TOOLS)/kDepPre$(HOSTSUFF_EXE) 378 ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre) 379 DEP_PRE := $(if kmk_builtin_kDepPre 380 else 381 DEP_PRE := $(DEP_PRE_EXT) 382 endif 383 384 APPEND_EXT := $(PATH_TOOLS)/kmk_append$(HOSTSUFF_EXE) 385 ifeq ($(filter append,$(KMK_BUILTIN)),append) 386 APPEND := kmk_builtin_append 387 else 388 APPEND := $(APPEND_EXT) 389 endif 390 391 CAT_EXT := $(PATH_TOOLS)/kmk_cat$(HOSTSUFF_EXE) 392 ifeq ($(filter cat,$(KMK_BUILTIN)),cat) 393 CAT := kmk_builtin_cat 394 else 395 CAT := $(CAT_EXT) 396 endif 397 398 CP_EXT := $(PATH_TOOLS)/kmk_cp$(HOSTSUFF_EXE) 399 ifeq ($(filter cp,$(KMK_BUILTIN)),cp) 400 CP := kmk_builtin_cp 401 else 402 CP := $(CP_EXT) 403 endif 404 405 ECHO_EXT := $(PATH_TOOLS)/kmk_echo$(HOSTSUFF_EXE) 406 ifeq ($(filter echo,$(KMK_BUILTIN)),echo) 407 ECHO := kmk_builtin_echo 408 else 409 ECHO := $(ECHO_EXT) 410 endif 411 412 INSTALL_EXT := $(PATH_TOOLS)/kmk_install$(HOSTSUFF_EXE) 413 ifeq ($(filter install,$(KMK_BUILTIN)),install) 414 INSTALL := kmk_builtin_install 415 else 416 INSTALL := $(INSTALL_EXT) 417 endif 418 419 LN_EXT := $(PATH_TOOLS)/kmk_ln$(HOSTSUFF_EXE) 420 ifeq ($(filter ln,$(KMK_BUILTIN)),ln) 421 LN := kmk_builtin_ln 422 else 423 LN := $(LN_EXT) 424 endif 425 426 MKDIR_EXT := $(PATH_TOOLS)/kmk_mkdir$(HOSTSUFF_EXE) 427 ifeq ($(filter mkdir,$(KMK_BUILTIN)),mkdir) 428 MKDIR := kmk_builtin_mkdir 429 else 430 MKDIR := $(MKDIR_EXT) 431 endif 432 433 MV_EXT := $(PATH_TOOLS)/kmk_mv$(HOSTSUFF_EXE) 434 ifeq ($(filter mv,$(KMK_BUILTIN)),mv) 435 MV := kmk_builtin_mv 436 else 437 MV := $(MV_EXT) 438 endif 439 440 RM_EXT := $(PATH_TOOLS)/kmk_rm$(HOSTSUFF_EXE) 441 ifeq ($(filter rm,$(KMK_BUILTIN)),rm) 442 RM := kmk_builtin_rm 443 else 444 RM := $(RM_EXT) 445 endif 446 447 SED_EXT := $(PATH_TOOLS)/kmk_sed$(HOSTSUFF_EXE) 448 ifeq ($(filter sed,$(KMK_BUILTIN)),sed) 449 SED := kmk_builtin_sed 450 else 451 SED := $(SED_EXT) 452 endif 453 454 # Our default shell is the Almquist shell from *BSD. 455 ASH := $(PATH_TOOLS)/kmk_ash$(HOSTSUFF_EXE) 456 MAKESHELL := $(ASH) 457 SHELL := $(ASH) 367 458 export SHELL MAKESHELL 368 459 369 # kBuild utils. 370 ifeq ($(filter append,$(KMK_BUILTIN)),append) 371 APPEND := kmk_builtin_append 372 else 373 APPEND := $(PATH_TOOLS)/append$(HOSTSUFF_EXE) 374 endif 460 # Symlinking is problematic on some platforms... 461 LN_SYMLINK := $(LN) -s 462 375 463 376 464 … … 539 627 PASS_INSTALLS := Install 540 628 PASS_INSTALLS_trgs := 541 PASS_INSTALLS_vars := _INSTALLS 629 PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS 542 630 PASS_INSTALLS_pass := installs 543 631 -
trunk/kBuild/tools/ALP.kmk
r353 r380 55 55 # @param $(outbase) Output basename (full). Use this for list files and such. 56 56 # @param $(objsuff) Object suffix. 57 define TOOL_ALP_COMPILE_AS 58 #$ (warning dbg: TOOL_ALP_COMPILE_AS: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 59 $(obj) $(outbase).lst: $(deps) $(source) | $(dirdep) 60 $(call MSG_L2,Compiling $$@ using ALP) 61 $(TOOL_ALP_AS) 57 TOOL_ALP_COMPILE_AS_OUTPUT = $(outbase).lst 58 TOOL_ALP_COMPILE_AS_DEPEND = 59 TOOL_ALP_COMPILE_AS_DEPORD = 60 define TOOL_ALP_COMPILE_AS_CMDS 61 $(TOOL_ALP_AS)\ 62 62 $(flags) $(addsuffix /,$(addprefix -I:, $(incs))) $(addprefix -D:, $(defs))\ 63 $(source) 64 -Fl:$(outbase).lst 65 -Fd:$(dep) 63 $(source)\ 64 -Fl:$(outbase).lst\ 65 -Fd:$(dep)\ 66 66 -Fo:$(obj) 67 _OUT_FILES += $(outbase).lst68 69 67 endef 70 68 -
trunk/kBuild/tools/GCC.kmk
r353 r380 76 76 # @param $(dirdep) Directory creation dependency. 77 77 # @param $(deps) Other dependencies. 78 #79 78 # @param $(outbase) Output basename (full). Use this for list files and such. 80 79 # @param $(objsuff) Object suffix. 81 define TOOL_GCC_COMPILE_C 82 #$ (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) deps=$(deps)) 83 $(obj): $(deps) $(source) | $(dirdep) 84 $(call MSG_L2,Compiling $$@ using GCC) 80 # 81 TOOL_GCC_COMPILE_C_OUTPUT = 82 TOOL_GCC_COMPILE_C_DEPEND = 83 TOOL_GCC_COMPILE_C_DEPORD = 84 define TOOL_GCC_COMPILE_C_CMDS 85 85 $(TOOL_GCC_CC) -c\ 86 86 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 87 -Wp,-MD,$(dep) -Wp,-MT,$ $@\88 -o $ $@\87 -Wp,-MD,$(dep) -Wp,-MT,$(out) \ 88 -o $(out)\ 89 89 $(call ABSPATH,$(source)) 90 91 90 endef 92 91 … … 105 104 # @param $(outbase) Output basename (full). Use this for list files and such. 106 105 # @param $(objsuff) Object suffix. 107 define TOOL_GCC_COMPILE_CXX 108 #$ (warning dbg: TOOL_GCC_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 109 $(obj): $(deps) $(source) | $(dirdep) 110 $(call MSG_L2,Compiling $$@ using GCC) 106 TOOL_GCC_COMPILE_CXX_OUTPUT = 107 TOOL_GCC_COMPILE_CXX_DEPEND = 108 TOOL_GCC_COMPILE_CXX_DEPORD = 109 define TOOL_GCC_COMPILE_CXX_CMDS 111 110 $(TOOL_GCC_CXX) -c\ 112 111 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 113 -Wp,-MD,$(dep) -Wp,-MT,$ $@\114 -o $ $@\112 -Wp,-MD,$(dep) -Wp,-MT,$(out) \ 113 -o $(out)\ 115 114 $(call ABSPATH,$(source)) 116 117 115 endef 118 116 … … 120 118 ## Link library 121 119 # @param $(target) Normalized main target name. 122 # @param $( lib)Library name.120 # @param $(out) Library name. 123 121 # @param $(objs) Object files to put in the library. 124 122 # @param $(flags) Flags. … … 127 125 # 128 126 # @param $(outbase) Output basename (full). Use this for list files and such. 129 define TOOL_GCC_LINK_LIBRARY 130 #$ (warning dbg: TOOL_GCC_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase)) 131 $(lib): $(deps) $(objs) | $(dirdep) 132 $(call MSG_L1,Creating Library $$@) 133 $(RM) -f $$@ 134 $(TOOL_GCC_AR) $(flags) $$@ $(objs) 135 127 TOOL_GCC_LINK_LIBRARY_OUTPUT = 128 TOOL_GCC_LINK_LIBRARY_DEPEND = 129 TOOL_GCC_LINK_LIBRARY_DEPORD = 130 define TOOL_GCC_LINK_LIBRARY_CMDS 131 $(TOOL_GCC_AR) $(flags) $(out) $(objs) 136 132 endef 137 133 … … 151 147 # 152 148 # @param $(outbase) Output basename (full). Use this for list files and such. 153 define TOOL_GCC_LINK_PROGRAM 154 #$ (warning dbg: TOOL_GCC_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 155 $(out): $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep) 156 $(call MSG_L1,Creating Program $$@) 157 ifneq ($(custom_pre),) 158 $(eval $(custom_pre)) 159 endif 160 $(TOOL_GCC_LD) $(flags) -o $$@ $(objs) \ 161 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) 162 ifneq ($(custom_post),) 163 $(eval $(custom_post)) 164 endif 165 149 TOOL_GCC_LINK_PROGRAM_OUTPUT = 150 TOOL_GCC_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) 151 TOOL_GCC_LINK_PROGRAM_DEPORD = 152 define TOOL_GCC_LINK_PROGRAM_CMDS 153 $(TOOL_GCC_LD) $(flags) -o $(out) $(objs) \ 154 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) 166 155 endef 167 156 … … 179 168 # @param $(custom_pre) Custom step invoked before linking. 180 169 # @param $(custom_post) Custom step invoked after linking. 181 # 182 # @param $(outbase) Output basename (full). Use this for list files and such. 183 define TOOL_GCC_LINK_DLL 184 #$ (warning dbg: TOOL_GCC_LINK_DLL: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 185 $(out): $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep) 186 $(call MSG_L1,Creating Program $$@) 187 ifneq ($(custom_pre),) 188 $(eval $(custom_pre)) 189 endif 190 $(TOOL_GCC_LD) $(TOOL_GCC_LDFLAGS.dll) $(flags) -o $$@ $(objs) \ 170 # @param $(outbase) Output basename (full). Use this for list files and such. 171 TOOL_GCC_LINK_DLL_OUTPUT = 172 TOOL_GCC_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) 173 TOOL_GCC_LINK_DLL_DEPORD = 174 define TOOL_GCC_LINK_DLL_CMDS 175 $(TOOL_GCC_LD) $(TOOL_GCC_LDFLAGS.dll) $(flags) -o $(out) $(objs) \ 191 176 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) 192 ifneq ($(custom_post),)193 $(eval $(custom_post))194 endif195 196 177 endef 197 178 -
trunk/kBuild/tools/GCC3.kmk
r353 r380 94 94 # @param $(outbase) Output basename (full). Use this for list files and such. 95 95 # @param $(objsuff) Object suffix. 96 define TOOL_GCC3_COMPILE_C 97 #$ (warning dbg: TOOL_GCC3_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff)) 98 $(obj): $(deps) $(source) | $(dirdep) 99 $(call MSG_L2,Compiling $$@ using GCC3) 96 TOOL_GCC3_COMPILE_C_OUTPUT = 97 TOOL_GCC3_COMPILE_C_DEPEND = 98 TOOL_GCC3_COMPILE_C_DEPORD = 99 define TOOL_GCC3_COMPILE_C_CMDS 100 100 $(TOOL_GCC3_CC) -c\ 101 101 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 102 -Wp,-MD,$(dep) -Wp,-MT,$ $@ -Wp,-MP\103 -o $ $@\102 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ 103 -o $(obj)\ 104 104 $(call ABSPATH,$(source)) 105 106 105 endef 107 106 … … 117 116 # @param $(dirdep) Directory creation dependency. 118 117 # @param $(deps) Other dependencies. 119 #120 118 # @param $(outbase) Output basename (full). Use this for list files and such. 121 119 # @param $(objsuff) Object suffix. 122 define TOOL_GCC3_COMPILE_CXX 123 #$ (warning dbg: TOOL_GCC3_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff)) 124 $(obj): $(deps) $(source) | $(dirdep) 125 $(call MSG_L2,Compiling $$@ using GCC3) 120 TOOL_GCC3_COMPILE_CXX_OUTPUT = 121 TOOL_GCC3_COMPILE_CXX_DEPEND = 122 TOOL_GCC3_COMPILE_CXX_DEPORD = 123 define TOOL_GCC3_COMPILE_CXX_CMDS 126 124 $(TOOL_GCC3_CXX) -c\ 127 125 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 128 -Wp,-MD,$(dep) -Wp,-MT,$ $@ -Wp,-MP\129 -o $ $@\126 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ 127 -o $(obj)\ 130 128 $(call ABSPATH,$(source)) 131 132 129 endef 133 130 … … 135 132 ## Link library 136 133 # @param $(target) Normalized main target name. 137 # @param $( lib) Library name.134 # @param $(out) Library name. 138 135 # @param $(objs) Object files to put in the library. 139 136 # @param $(flags) Flags. … … 141 138 # @param $(deps) Other dependencies. 142 139 # @param $(othersrc) Unhandled sources. 143 # 144 # @param $(outbase) Output basename (full). Use this for list files and such. 145 146 define TOOL_GCC3_LINK_LIBRARY_ADDMOD 147 148 echo "ADDMOD $(o)" >> $(lib).ar-script 149 endef 150 151 define TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB 152 153 $(MKDIR) -p $(dir $(outbase))ar.extract/$(notdir $(srclib)) 154 cd $(dir $(outbase))ar.extract/$(notdir $(srclib)) && $(TOOL_GCC3_AR) x $(srclib) 155 for o in `$(TOOL_GCC3_AR) t $(srclib)`; do echo "ADDMOD $(dir $(outbase))ar.extract/$(notdir $(srclib))/$$$${o}" >> $(lib).ar-script; done 156 endef 157 158 define TOOL_GCC3_LINK_LIBRARY 159 #$ (warning dbg: TOOL_GCC3_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase)) 160 $(lib): $(deps) $(objs) $(filter %.a %.lib,$(othersrc)) | $(dirdep) 161 $(call MSG_L1,Creating Library $$@) 162 $(RM) -f $$@ 163 ifneq ($(strip $(filter %.a %.lib,$(othersrc))),) 164 echo "CREATE $$@" > $(lib).ar-script 165 $(foreach o, $(objs),$(TOOL_GCC3_LINK_LIBRARY_ADDMOD)) 166 $(foreach srclib, $(filter %.a %.lib,$(othersrc)),$(TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB)) 167 echo "SAVE" >> $(lib).ar-script 168 echo "END" >> $(lib).ar-script 169 $(TOOL_GCC3_AR) -M < $(lib).ar-script 170 $(RM) -Rf "$(dir $(outbase))ar.extract/" 171 172 _OUT_FILES += $(lib).ar-script 173 else 174 $(TOOL_GCC3_AR) $(flags) $$@ $(objs) 175 endif 176 140 # @param $(outbase) Output basename (full). Use this for list files and such. 141 TOOL_GCC3_LINK_LIBRARY_OUTPUT = $(out).ar-script 142 TOOL_GCC3_LINK_LIBRARY_DEPEND = $(filter %.a %.lib,$(othersrc)) 143 TOOL_GCC3_LINK_LIBRARY_DEPORD = 144 define TOOL_GCC3_LINK_LIBRARY_CMDS 145 $(APPEND) $(out).ar-script "CREATE $(out)" 146 $(foreach o, $(objs)\ 147 ,$(NL)$(TAB)$(APPEND) $(out).ar-script "ADDMOD $(o)") 148 $(foreach srclib, $(filter %.a %.lib,$(othersrc))\ 149 ,$(NL)$(TAB)$(APPEND) $(out).ar-script "ADDLIB $(srclib)") 150 $(APPEND) $(out).ar-script "SAVE" 151 $(APPEND) $(out).ar-script "END" 152 $(TOOL_GCC3_AR) -M < $(out).ar-script 177 153 endef 178 154 … … 190 166 # @param $(custom_pre) Custom step invoked before linking. 191 167 # @param $(custom_post) Custom step invoked after linking. 192 # 193 # @param $(outbase) Output basename (full). Use this for list files and such. 194 define TOOL_GCC3_LINK_PROGRAM 195 #$ (warning dbg: TOOL_GCC3_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 196 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep) 197 $(call MSG_L1,Creating Program $$@) 198 ifneq ($(custom_pre),) 199 $(eval $(custom_pre)) 200 endif 201 $(RM) -f $$@ 202 $(TOOL_GCC3_LD) $(flags) -o $$@ $(objs) \ 203 $(foreach p,$(libpath), -L$(p)) \ 204 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \ 168 # @param $(outbase) Output basename (full). Use this for list files and such. 169 TOOL_GCC3_LINK_PROGRAM_OUTPUT = $(outbase).map 170 TOOL_GCC3_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) 171 TOOL_GCC3_LINK_PROGRAM_DEPORD = 172 define TOOL_GCC3_LINK_PROGRAM_CMDS 173 $(TOOL_GCC3_LD) $(flags) -o $(out) $(objs)\ 174 $(foreach p,$(libpath), -L$(p))\ 175 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\ 205 176 $(call TOOL_GCC3_LD_MAP,$(outbase).map) 206 ifneq ($(custom_post),)207 $(eval $(custom_post))208 endif209 _OUT_FILES += $(outbase).map210 211 177 endef 212 178 … … 224 190 # @param $(custom_pre) Custom step invoked before linking. 225 191 # @param $(custom_post) Custom step invoked after linking. 226 # 227 # @param $(outbase) Output basename (full). Use this for list files and such. 228 define TOOL_GCC3_LINK_DLL 229 #$ (warning dbg: TOOL_GCC3_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 230 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep) 231 $(call MSG_L1,Creating Program $$@) 232 ifneq ($(custom_pre),) 233 $(eval $(custom_pre)) 234 endif 235 $(RM) -f $$@ 236 $(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $$@ \ 237 $(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out))) \ 238 $(objs) \ 239 $(foreach p,$(libpath), -L$(p)) \ 240 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \ 192 # @param $(outbase) Output basename (full). Use this for list files and such. 193 TOOL_GCC3_LINK_DLL_OUTPUT = $(outbase).map 194 TOOL_GCC3_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) 195 TOOL_GCC3_LINK_DLL_DEPORD = 196 define TOOL_GCC3_LINK_DLL_CMDS 197 $(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $(out)\ 198 $(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out)))\ 199 $(objs)\ 200 $(foreach p,$(libpath), -L$(p))\ 201 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\ 241 202 $(call TOOL_GCC3_LD_MAP,$(outbase).map) 242 ifneq ($(custom_post),) 243 $(eval $(custom_post)) 244 endif 245 _OUT_FILES += $(outbase).map 246 247 endef 203 endef 204 248 205 249 206 ## Link system module (windows aka driver, linux aka kernel module) … … 259 216 # @param $(custom_pre) Custom step invoked before linking. 260 217 # @param $(custom_post) Custom step invoked after linking. 261 # 262 # @param $(outbase) Output basename (full). Use this for list files and such. 263 define TOOL_GCC3_LINK_SYSMOD 264 #$ (warning dbg: TOOL_GCC3_LINK_SYSMOD: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase)) 265 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep) 266 $(call MSG_L1,Creating Program $$@) 267 ifneq ($(custom_pre),) 268 $(eval $(custom_pre)) 269 endif 270 $(RM) -f $$@ 271 $(TOOL_GCC3_LD_SYSMOD) $(TOOL_GCC3_LDFLAGS.sysmod) $(flags) -o $$@ $(objs) \ 272 $(foreach p,$(libpath), -L$(p)) \ 273 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \ 218 # @param $(outbase) Output basename (full). Use this for list files and such. 219 TOOL_GCC3_LINK_SYSMOD_OUTPUT = $(outbase).map 220 TOOL_GCC3_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) 221 TOOL_GCC3_LINK_SYSMOD_DEPORD = 222 define TOOL_GCC3_LINK_SYSMOD_CMDS 223 $(TOOL_GCC3_LD_SYSMOD) $(TOOL_GCC3_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\ 224 $(foreach p,$(libpath), -L$(p))\ 225 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\ 274 226 $(call TOOL_GCC3_LD_SYSMOD_MAP,$(outbase).map) 275 ifneq ($(custom_post),) 276 $(eval $(custom_post)) 277 endif 278 _OUT_FILES += $(outbase).map 279 280 endef 281 227 endef 228 -
trunk/kBuild/tools/GCC3OMF.kmk
r353 r380 87 87 # @param $(outbase) Output basename (full). Use this for list files and such. 88 88 # @param $(objsuff) Object suffix. 89 define TOOL_GCC3OMF_COMPILE_C 90 #$ (warning dbg: TOOL_GCC3OMF_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 91 $(obj): $(deps) $(source) | $(dirdep) 92 $(call MSG_L2,Compiling $$@ using GCC3) 89 TOOL_GCC3OMF_COMPILE_C_OUTPUT = 90 TOOL_GCC3OMF_COMPILE_C_DEPEND = 91 TOOL_GCC3OMF_COMPILE_C_DEPORD = 92 define TOOL_GCC3OMF_COMPILE_C_CMDS 93 93 $(TOOL_GCC3OMF_CC) -c\ 94 94 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 95 -Wp,-MD,$(dep) -Wp,-MT,$ $@-Wp,-MP \96 -o $ $@\95 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP \ 96 -o $(obj)\ 97 97 $(call ABSPATH,$(source)) 98 99 98 endef 100 99 … … 113 112 # @param $(outbase) Output basename (full). Use this for list files and such. 114 113 # @param $(objsuff) Object suffix. 115 define TOOL_GCC3OMF_COMPILE_CXX 116 #$ (warning dbg: TOOL_GCC3OMF_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 117 $(obj): $(deps) $(source) | $(dirdep) 118 $(call MSG_L2,Compiling $$@ using GCC3) 114 TOOL_GCC3OMF_COMPILE_CXX_OUTPUT = 115 TOOL_GCC3OMF_COMPILE_CXX_DEPEND = 116 TOOL_GCC3OMF_COMPILE_CXX_DEPORD = 117 define TOOL_GCC3OMF_COMPILE_CXX_CMDS 119 118 $(TOOL_GCC3OMF_CXX) -c\ 120 119 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 121 -Wp,-MD,$(dep) -Wp,-MT,$ $@-Wp,-MP \122 -o $ $@\120 -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP \ 121 -o $(obj)\ 123 122 $(call ABSPATH,$(source)) 124 125 123 endef 126 124 … … 128 126 ## Link library 129 127 # @param $(target) Normalized main target name. 130 # @param $( lib) Library name.128 # @param $(out) Library name. 131 129 # @param $(objs) Object files to put in the library. 132 130 # @param $(flags) Flags. … … 136 134 # 137 135 # @param $(outbase) Output basename (full). Use this for list files and such. 138 define TOOL_GCC3OMF_LINK_LIBRARY 139 #$ (warning dbg: TOOL_GCC3OMF_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase)) 140 $(lib): $(deps) $(objs) $(filter %.a %.lib %.def %.imp,$(othersrc)) | $(dirdep) 141 $(call MSG_L1,Creating Library $$@) 142 $(RM) -f $$@ 143 $(if $(filter %.def %.imp,$(othersrc)),$(TOOL_GCC3OMF_AR_IMP) -o $$@ $(filter %.def %.imp,$(othersrc)),) 144 $(TOOL_GCC3OMF_AR) $(flags) $$@ $(objs) $(filter %.a %.lib,$(othersrc)) 145 136 TOOL_GCC3OMF_LINK_LIBRARY_OUTPUT = 137 TOOL_GCC3OMF_LINK_LIBRARY_DEPEND = $(filter %.a %.lib %.def %.imp,$(othersrc)) 138 TOOL_GCC3OMF_LINK_LIBRARY_DEPORD = 139 define TOOL_GCC3OMF_LINK_LIBRARY_CMDS 140 $(if $(filter %.def %.imp,$(othersrc)),$(TOOL_GCC3OMF_AR_IMP) -o $(out) $(filter %.def %.imp,$(othersrc)),) 141 $(TOOL_GCC3OMF_AR) $(flags) $(out) $(objs) $(filter %.a %.lib,$(othersrc)) 146 142 endef 147 143 … … 161 157 # 162 158 # @param $(outbase) Output basename (full). Use this for list files and such. 163 define TOOL_GCC3OMF_LINK_PROGRAM 164 #$ (warning dbg: TOOL_GCC3OMF_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 165 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(filter %.def, $(othersrc)) | $(dirdep) 166 $(call MSG_L1,Creating Program $$@) 167 ifneq ($(custom_pre),) 168 $(eval $(custom_pre)) 169 endif 170 $(TOOL_GCC3OMF_LD) $(flags) -o $$@ $(objs) \ 171 $(filter %.def, $(othersrc)) \ 172 $(foreach p,$(libpath), -L$(p)) \ 173 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \ 159 TOOL_GCC3OMF_LINK_PROGRAM_OUTPUT = $(outbase).map 160 TOOL_GCC3OMF_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\ 161 $(filter %.def, $(othersrc)) 162 TOOL_GCC3OMF_LINK_PROGRAM_DEPORD = 163 define TOOL_GCC3OMF_LINK_PROGRAM_CMDS 164 $(TOOL_GCC3OMF_LD) $(flags) -o $(out) $(objs)\ 165 $(filter %.def, $(othersrc))\ 166 $(foreach p,$(libpath), -L$(p))\ 167 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\ 174 168 $(call TOOL_GCC3_LD_MAP,$(outbase).map) 175 ifneq ($(custom_post),)176 $(eval $(custom_post))177 endif178 _OUT_FILES += $(outbase).map179 180 169 endef 181 170 … … 195 184 # 196 185 # @param $(outbase) Output basename (full). Use this for list files and such. 197 define TOOL_GCC3OMF_LINK_DLL 198 #$ (warning dbg: TOOL_GCC3OMF_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 199 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(filter %.def, $(othersrc)) | $(dirdep) 200 $(call MSG_L1,Creating Program $$@) 201 ifneq ($(custom_pre),) 202 $(eval $(custom_pre)) 203 endif 204 $(TOOL_GCC3OMF_LD) $(TOOL_GCC3OMF_LDFLAGS.dll) $(flags) -o $$@ $(objs) \ 205 $(filter %.def, $(othersrc)) \ 206 $(foreach p,$(libpath), -L$(p)) \ 207 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \ 208 $(call TOOL_GCC3_LD_MAP,$(outbase).map) 209 ifneq ($(custom_post),) 210 $(eval $(custom_post)) 211 endif 212 _OUT_FILES += $(outbase).map 213 186 TOOL_GCC3OMF_LINK_DLL_OUTPUT = $(outbase).map 187 TOOL_GCC3OMF_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\ 188 $(filter %.def, $(othersrc)) 189 TOOL_GCC3OMF_LINK_DLL_DEPORD = 190 define TOOL_GCC3OMF_LINK_DLL_CMDS 191 $(TOOL_GCC3OMF_LD) $(TOOL_GCC3OMF_LDFLAGS.dll) $(flags) -o $(out) $(objs)\ 192 $(filter %.def, $(othersrc))\ 193 $(foreach p,$(libpath), -L$(p))\ 194 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\ 195 $(call TOOL_GCC3_LD_MAP,$(outbase).map) 214 196 endef 215 197 … … 228 210 # 229 211 # @param $(outbase) Output basename (full). Use this for list files and such. 230 define TOOL_GCC3OMF_LINK_SYSMOD 231 #$ (warning dbg: TOOL_GCC3OMF_LINK_SYSMOD: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase)) 232 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(filter %.def, $(othersrc)) | $(dirdep) 233 $(call MSG_L1,Creating Program $$@) 234 ifneq ($(custom_pre),) 235 $(eval $(custom_pre)) 236 endif 237 $(TOOL_GCC3OMF_LD_SYSMOD) $(TOOL_GCC3OMF_LDFLAGS.sysmod) $(flags) -o $$@ $(objs) \ 238 $(filter %.def, $(othersrc)) \ 239 $(foreach p,$(libpath), -L$(p)) \ 240 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \ 212 TOOL_GCC3OMF_LINK_SYSMOD_OUTPUT = $(outbase).map 213 TOOL_GCC3OMF_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\ 214 $(filter %.def, $(othersrc)) 215 TOOL_GCC3OMF_LINK_SYSMOD_DEPORD = 216 define TOOL_GCC3OMF_LINK_SYSMOD_CMDS 217 $(TOOL_GCC3OMF_LD_SYSMOD) $(TOOL_GCC3OMF_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\ 218 $(filter %.def, $(othersrc))\ 219 $(foreach p,$(libpath), -L$(p))\ 220 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\ 241 221 $(call TOOL_GCC3_LD_SYSMOD_MAP,$(outbase).map) 242 ifneq ($(custom_post),) 243 $(eval $(custom_post)) 244 endif 245 _OUT_FILES += $(outbase).map 246 247 endef 248 222 endef 223 -
trunk/kBuild/tools/MINGW32.kmk
r353 r380 106 106 # @param $(dirdep) Directory creation dependency. 107 107 # @param $(deps) Other dependencies. 108 #109 108 # @param $(outbase) Output basename (full). Use this for list files and such. 110 109 # @param $(objsuff) Object suffix. 111 define TOOL_MINGW32_COMPILE_C 112 #$ (warning dbg: TOOL_MINGW32_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 113 $(obj): $(deps) $(source) | $(dirdep) 114 $(call MSG_L2,Compiling $$@ using MINGW32) 110 TOOL_MINGW32_COMPILE_C_OUTPUT = 111 TOOL_MINGW32_COMPILE_C_DEPEND = 112 TOOL_MINGW32_COMPILE_C_DEPORD = 113 define TOOL_MINGW32_COMPILE_C_CMDS 115 114 $(TOOL_MINGW32_CC) -c\ 116 115 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 117 -Wp,-MD,$(dep) -Wp,-MT,$ $@\118 -o $ $@\116 -Wp,-MD,$(dep) -Wp,-MT,$(obj)\ 117 -o $(obj)\ 119 118 $(call ABSPATH,$(source)) 120 121 119 endef 122 120 … … 132 130 # @param $(dirdep) Directory creation dependency. 133 131 # @param $(deps) Other dependencies. 134 #135 132 # @param $(outbase) Output basename (full). Use this for list files and such. 136 133 # @param $(objsuff) Object suffix. 137 define TOOL_MINGW32_COMPILE_CXX 138 #$ (warning dbg: TOOL_MINGW32_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 139 $(obj): $(deps) $(source) | $(dirdep) 140 $(call MSG_L2,Compiling $$@ using MINGW32) 134 TOOL_MINGW32_COMPILE_CXX_OUTPUT = 135 TOOL_MINGW32_COMPILE_CXX_DEPEND = 136 TOOL_MINGW32_COMPILE_CXX_DEPORD = 137 define TOOL_MINGW32_COMPILE_CXX_CMDS 141 138 $(TOOL_MINGW32_CXX) -c\ 142 139 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ 143 -Wp,-MD,$(dep) -Wp,-MT,$ $@\144 -o $ $@\140 -Wp,-MD,$(dep) -Wp,-MT,$(obj)\ 141 -o $(obj)\ 145 142 $(call ABSPATH,$(source)) 146 147 143 endef 148 144 … … 157 153 # 158 154 # @param $(outbase) Output basename (full). Use this for list files and such. 159 define TOOL_MINGW32_LINK_LIBRARY 160 #$ (warning dbg: TOOL_MINGW32_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase)) 161 $(lib): $(deps) $(objs) | $(dirdep) 162 $(call MSG_L1,Creating Library $$@) 163 $(RM) -f $$@ 164 $(TOOL_MINGW32_AR) $(flags) $$@ $(objs) 165 155 TOOL_MINGW32_LINK_LIBRARY_OUTPUT = $(lib).ar-script 156 TOOL_MINGW32_LINK_LIBRARY_DEPEND = $(filter %.a %.lib,$(othersrc)) 157 TOOL_MINGW32_LINK_LIBRARY_DEPORD = 158 define TOOL_MINGW32_LINK_LIBRARY_CMDS 159 $(APPEND) $(lib).ar-script "CREATE $(out)" 160 $(foreach o, $(objs)\ 161 ,$(NL)$(TAB)$(APPEND) $(lib).ar-script "ADDMOD $(o)") 162 $(foreach srclib, $(filter %.a %.lib,$(othersrc))\ 163 ,$(NL)$(TAB)$(APPEND) $(lib).ar-script "ADDLIB $(srclib)") 164 $(APPEND) $(lib).ar-script "SAVE" 165 $(APPEND) $(lib).ar-script "END" 166 $(TOOL_MINGW32_AR) -M < $(lib).ar-script 166 167 endef 167 168 … … 181 182 # 182 183 # @param $(outbase) Output basename (full). Use this for list files and such. 183 define TOOL_MINGW32_LINK_PROGRAM 184 #$ (warning dbg: TOOL_MINGW32_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase)) 185 $(out): $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep) 186 $(call MSG_L1,Creating Program $$@) 187 ifneq ($(custom_pre),) 188 $(eval $(custom_pre)) 189 endif 190 $(TOOL_MINGW32_LD) $(flags) -o $$@ $(objs) \ 191 $(foreach p,$(libpath), -L$(p)) \ 192 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) 193 ifneq ($(custom_post),) 194 $(eval $(custom_post)) 195 endif 196 184 TOOL_MINGW32_LINK_PROGRAM_OUTPUT = 185 TOOL_MINGW32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) 186 TOOL_MINGW32_LINK_PROGRAM_DEPORD = 187 define TOOL_MINGW32_LINK_PROGRAM_CMDS 188 $(TOOL_MINGW32_LD) $(flags) -o $(out) $(objs)\ 189 $(foreach p,$(libpath), -L$(p))\ 190 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) 197 191 endef 198 192 … … 210 204 # @param $(custom_pre) Custom step invoked before linking. 211 205 # @param $(custom_post) Custom step invoked after linking. 212 # 213 # @param $(outbase) Output basename (full). Use this for list files and such. 214 define TOOL_MINGW32_LINK_DLL 215 #$ (warning dbg: TOOL_MINGW32_LINK_DLL: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase)) 216 $(out) $(outbase).a $(outbase).exp: \ 217 $(deps) $(call DIRDEP,$(PATH_LIB)) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep) 218 $(call MSG_L1,Creating Program $$@) 219 ifneq ($(custom_pre),) 220 $(eval $(custom_pre)) 221 endif 222 $(TOOL_MINGW32_DLLWRAP) $(flags) \ 223 --dllname=$(out) \ 224 --output-exp=$(outbase).exp \ 225 --output-lib=$(outbase).a \ 226 $(foreach def,$(filter %.def,$(othersrc)), --def $(def)) \ 227 $(filter %.res,$(othersrc)) \ 228 $(objs) \ 229 $(foreach p,$(libpath), -L$(p)) \ 206 # @param $(outbase) Output basename (full). Use this for list files and such. 207 TOOL_MINGW32_LINK_DLL_OUTPUT = $(outbase).a $(outbase).exp 208 TOOL_MINGW32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\ 209 $(filter %.def %.res,$(othersrc)) 210 TOOL_MINGW32_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB)) 211 define TOOL_MINGW32_LINK_DLL_CMDS 212 $(TOOL_MINGW32_DLLWRAP) $(flags)\ 213 --dllname=$(out)\ 214 --output-exp=$(outbase).exp\ 215 --output-lib=$(outbase).a\ 216 $(foreach def,$(filter %.def,$(othersrc)), --def $(def))\ 217 $(filter %.res,$(othersrc))\ 218 $(objs)\ 219 $(foreach p,$(libpath), -L$(p))\ 230 220 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) 231 ifeq ($(filter %.exp .def,$(othersrc)),)232 221 $(CP) $(outbase).exp $(outbase).a $(PATH_LIB)/ 233 endif 234 ifneq ($(custom_post),) 235 $(eval $(custom_post)) 236 endif 237 _OUT_FILES += $(outbase).a $(outbase).exp 238 239 endef 240 222 endef 223 ## @todo seperate install stuff! -
trunk/kBuild/tools/NASM.kmk
r353 r380 52 52 # @param $(dirdep) Directory creation dependency. 53 53 # @param $(deps) Other dependencies. 54 #55 54 # @param $(outbase) Output basename (full). Use this for list files and such. 56 55 # @param $(objsuff) Object suffix. 57 define TOOL_NASM_COMPILE_AS 58 #$ (warning dbg: TOOL_NASM_COMPILE_AS: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps)) 59 $(obj) $(outbase).lst: $(deps) $(source) | $(dirdep) 60 $(call MSG_L2,Compiling $$@ using NASM) 61 $(TOOL_NASM_AS) \ 56 # 57 TOOL_NASM_COMPILE_AS_OUTPUT = $(outbase).lst 58 TOOL_NASM_COMPILE_AS_DEPEND = 59 TOOL_NASM_COMPILE_AS_DEPORD = 60 define TOOL_NASM_COMPILE_AS_CMDS 61 $(TOOL_NASM_AS)\ 62 62 $(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\ 63 -l $(outbase).lst 64 -o $(obj) 63 -l $(outbase).lst\ 64 -o $(obj)\ 65 65 $(call ABSPATH,$(source)) 66 _OUT_FILES += $(outbase).lst67 68 66 endef 69 67 -
trunk/kBuild/tools/VCC70.kmk
r353 r380 82 82 # @param $(outbase) Output basename (full). Use this for list files and such. 83 83 # @param $(objsuff) Object suffix. 84 define TOOL_VCC70_COMPILE_C 85 #$ (warning dbg: TOOL_VCC70_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff)) 86 $(obj) $(call TOOL_VCC70_PDB, $(outbase)-obj): $(deps) $(source) | $(dirdep) 87 $(call MSG_L2,Compiling $$@ using VCC70) 84 TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj) 85 TOOL_VCC70_COMPILE_C_DEPEND = 86 TOOL_VCC70_COMPILE_C_DEPORD = 87 define TOOL_VCC70_COMPILE_C_CMDS 88 88 $(TOOL_VCC70_CC) -c\ 89 89 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ … … 95 95 $(subst /,\\,$(call ABSPATH,$(source)))\ 96 96 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) - 97 _OUT_FILES += $(call TOOL_VCC70_PDB, $(outbase)-obj)98 99 97 endef 100 98 … … 113 111 # @param $(outbase) Output basename (full). Use this for list files and such. 114 112 # @param $(objsuff) Object suffix. 115 define TOOL_VCC70_COMPILE_CXX 116 #$ (warning dbg: TOOL_VCC70_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff)) 117 $(obj) $(call TOOL_VCC70_PDB, $(outbase)-obj): $(deps) $(source) | $(dirdep) 118 $(call MSG_L2,Compiling $$@ using VCC70) 113 TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj) 114 TOOL_VCC70_COMPILE_CXX_DEPEND = 115 TOOL_VCC70_COMPILE_CXX_DEPORD = 116 define TOOL_VCC70_COMPILE_CXX_CMDS 119 117 $(TOOL_VCC70_CXX) -c\ 120 118 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ … … 126 124 $(subst /,\\,$(call ABSPATH,$(source)))\ 127 125 | $(DEP_PRE) -f -s -o $(dep) -t $(obj) - 128 _OUT_FILES += $(call TOOL_VCC70_PDB, $(outbase)-obj)129 130 126 endef 131 127 … … 133 129 ## Link library 134 130 # @param $(target) Normalized main target name. 135 # @param $( lib)Library name.131 # @param $(out) Library name. 136 132 # @param $(objs) Object files to put in the library. 137 133 # @param $(flags) Flags. 138 134 # @param $(dirdep) Directory creation dependency. 139 # @param $(deps) 135 # @param $(deps) Other dependencies. 140 136 # @param $(othersrc) Unhandled sources. 141 # 142 # @param $(outbase) Output basename (full). Use this for list files and such. 143 define TOOL_VCC70_LINK_LIBRARY 144 #$ (warning dbg: TOOL_VCC70_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase)) 145 $(lib) $(outbase).lst $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)): $(deps) $(objs) $(othersrc) | $(dirdep) 146 $(call MSG_L1,Creating Library $$@) 147 $(RM) -f $$@ 148 $(TOOL_VCC70_AR) $(flags) /OUT:$(lib) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \ 137 # @param $(outbase) Output basename (full). Use this for list files and such. 138 # 139 TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) 140 TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc) 141 TOOL_VCC70_LINK_LIBRARY_DEPORD = 142 define TOOL_VCC70_LINK_LIBRARY_CMDS 143 $(TOOL_VCC70_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \ 149 144 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) 150 _OUT_FILES += $(outbase).lst $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase))151 152 145 endef 153 146 … … 165 158 # @param $(custom_pre) Custom step invoked before linking. 166 159 # @param $(custom_post) Custom step invoked after linking. 167 # 168 # @param $(outbase) Output basename (full). Use this for list files and such. 169 define TOOL_VCC70_LINK_PROGRAM 170 #$ (warning dbg: TOOL_VCC70_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase)) 171 $(out) $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk: \ 172 $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep) 173 $(call MSG_L1,Creating Program $$@) 174 ifneq ($(custom_pre),) 175 $(eval $(custom_pre)) 176 endif 160 # @param $(outbase) Output basename (full). Use this for list files and such. 161 # 162 TOOL_VCC70_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk 163 TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) 164 TOOL_VCC70_LINK_PROGRAM_DEPORD = 165 define TOOL_VCC70_LINK_PROGRAM_CMDS 177 166 $(TOOL_VCC70_LD) $(flags) \ 178 167 /OUT:$(out) \ … … 184 173 $(subst /,\\,$(objs)) \ 185 174 $(subst /,\\,$(libs)) 186 ifneq ($(custom_post),)187 $(eval $(custom_post))188 endif189 _OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk190 191 endef192 193 194 ## Link system module (windows aka driver, linux aka kernel module)195 # @param $(target) Normalized main target name.196 # @param $(out) System module name.197 # @param $(objs) Object files to link together.198 # @param $(libs) Libraries to search.199 # @param $(libpath) Library search paths.200 # @param $(flags) Flags.201 # @param $(dirdep) Directory creation dependency.202 # @param $(deps) Other dependencies.203 # @param $(othersrc) Unhandled sources.204 # @param $(custom_pre) Custom step invoked before linking.205 # @param $(custom_post) Custom step invoked after linking.206 #207 # @param $(outbase) Output basename (full). Use this for list files and such.208 define TOOL_VCC70_LINK_SYSMOD209 #$ (warning dbg: TOOL_VCC70_LINK_SYSMOD: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))210 $(out) $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk: \211 $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep)212 $(call MSG_L1,Creating Program $$@)213 ifneq ($(custom_pre),)214 $(eval $(custom_pre))215 endif216 $(TOOL_VCC70_LD) $(flags) \217 /OUT:$(out) \218 /MAPINFO:EXPORTS /MAPINFO:LINES \219 /MAP:$(outbase).map \220 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \221 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \222 $(foreach p,$(libpath), /LIBPATH:$(p)) \223 $(subst /,\\,$(objs)) \224 $(subst /,\\,$(libs))225 ifneq ($(custom_post),)226 $(eval $(custom_post))227 endif228 _OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk229 230 175 endef 231 176 … … 245 190 # 246 191 # @param $(outbase) Output basename (full). Use this for list files and such. 247 define TOOL_VCC70_LINK_DLL 248 #$ (warning dbg: TOOL_VCC70_LINK_DLL: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase)) 249 $(out) $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk: \ 250 $(deps) $(call DIRDEP,$(PATH_LIB)) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) | $(dirdep) 251 $(call MSG_L1,Creating Program $$@) 252 ifneq ($(custom_pre),) 253 $(eval $(custom_pre)) 254 endif 192 TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk 193 TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) 194 TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB)) 195 define TOOL_VCC70_LINK_DLL_CMDS 255 196 $(TOOL_VCC70_LD) $(flags) \ 256 197 /OUT:$(out) \ … … 268 209 if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi 269 210 endif 270 ifneq ($(custom_post),) 271 $(eval $(custom_post)) 272 endif 273 _OUT_FILES += $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk 274 _DIRS += $(PATH_LIB) 275 276 endef 277 211 $(eval _DIRS += $(PATH_LIB)) 212 endef 213 214 215 ## Link system module (windows aka driver, linux aka kernel module) 216 # @param $(target) Normalized main target name. 217 # @param $(out) System module name. 218 # @param $(objs) Object files to link together. 219 # @param $(libs) Libraries to search. 220 # @param $(libpath) Library search paths. 221 # @param $(flags) Flags. 222 # @param $(dirdep) Directory creation dependency. 223 # @param $(deps) Other dependencies. 224 # @param $(othersrc) Unhandled sources. 225 # @param $(custom_pre) Custom step invoked before linking. 226 # @param $(custom_post) Custom step invoked after linking. 227 # 228 # @param $(outbase) Output basename (full). Use this for list files and such. 229 TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase)) $(outbase).ilk 230 TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc) 231 TOOL_VCC70_LINK_SYSMOD_DEPORD = 232 define TOOL_VCC70_LINK_SYSMOD_CMDS 233 $(TOOL_VCC70_LD) $(flags) \ 234 /OUT:$(out) \ 235 /MAPINFO:EXPORTS /MAPINFO:LINES \ 236 /MAP:$(outbase).map \ 237 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \ 238 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \ 239 $(foreach p,$(libpath), /LIBPATH:$(p)) \ 240 $(subst /,\\,$(objs)) \ 241 $(subst /,\\,$(libs)) 242 endef 243
Note:
See TracChangeset
for help on using the changeset viewer.