Changeset 380 for trunk/kBuild/tools/GCC3.kmk
- Timestamp:
- Dec 18, 2005, 2:52:47 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.