diff options
author | Richard J. Knight <rjknight@us.ibm.com> | 2017-10-13 15:49:25 -0500 |
---|---|---|
committer | Richard J. Knight <rjknight@us.ibm.com> | 2017-10-17 15:05:22 -0500 |
commit | 41e7df45e64f623499b8d286a4012e6e7d24eaf6 (patch) | |
tree | e7a54e4950d2610c3fddeaf2b74b53b424315bf1 /tools/build/rules.dir/cc.rules.mk | |
download | talos-hcode-41e7df45e64f623499b8d286a4012e6e7d24eaf6.tar.gz talos-hcode-41e7df45e64f623499b8d286a4012e6e7d24eaf6.zip |
Initial hcode commit
Change-Id: I2c6c9b05c6afbd7732f472ea9cf049d00c5cad45
Diffstat (limited to 'tools/build/rules.dir/cc.rules.mk')
-rw-r--r-- | tools/build/rules.dir/cc.rules.mk | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/tools/build/rules.dir/cc.rules.mk b/tools/build/rules.dir/cc.rules.mk new file mode 100644 index 00000000..173a1fdb --- /dev/null +++ b/tools/build/rules.dir/cc.rules.mk @@ -0,0 +1,132 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: tools/build/rules.dir/cc.rules.mk $ +# +# OpenPOWER HCODE Project +# +# COPYRIGHT 2015,2017 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG + +# Makefile that defines macros for calling various compiler tools: +# * __CALL_CXX for C++ compiler. +# * __CALL_CC for C compiler. +# * __CALL_LDSO for the .so linker. +# * __CALL_LD for the .exe linker. +# * __CALL_AR for the archiver. +# * __CALL_CXX_DEP for generating an include dependency via CXX. +# * __CALL_CC_DEP for generating an include dependency via CC. +# +# See the manpage if you want to understand these incantations more. + +define __CALL_CXX +ifeq "TARGET" "$(1)" + $(C2) " C++ $$(@F)" +else + $(C2) " C++$(1) $$(@F)" +endif + $(C1) mkdir -p $$(@D) + $(C1) $$($(1)_PREFIX)$$(CXX) $$(COMMONFLAGS) $$(CXXFLAGS) \ + $$(LOCALCOMMONFLAGS) $$(LOCALCXXFLAGS) \ + $$< -c -o $$@ +endef + +define __CALL_CC +ifeq "TARGET" "$(1)" + $(C2) " CC $$(@F)" +else + $(C2) " CC$(1) $$(@F)" +endif + $(C1) mkdir -p $$(@D) + $(C1) $$($(1)_PREFIX)$$(CC) $$(COMMONFLAGS) $$(CFLAGS) \ + $$(LOCALCOMMONFLAGS) $$(LOCALCFLAGS) \ + $$< -c -o $$@ +endef + +define __CALL_LDSO +ifeq "TARGET" "$(1)" + $(C2) " LDSO $$(@F)" +else + $(C2) " LDSO$(1) $$(@F)" +endif + $(C1) mkdir -p $$(@D) + $(C1) $$($(1)_PREFIX)$$(CXX) $$(LDFLAGS) \ + -shared $$(addprefix -L,$(FAPI2_PLAT_LIB)) $$(LOCALLDFLAGS) \ + $$(patsubst lib%.so,-l%, $$(notdir $$(filter %.so, $$^))) \ + -Wl,--whole-archive \ + $$(filter-out $$(CTEPATH)%, $$(filter %.a,$$^)) \ + -Wl,--no-whole-archive \ + $$(filter $$(CTEPATH)%, $$(filter %.a,$$^)) -o $$@ + $(C1) ln -sf $$@ \ + $$(addprefix $$(dir $$@),$$(patsubst lib%.so, %_x86_64.so,$$(notdir $$@))) +endef + +define __CALL_LD +ifeq "TARGET" "$(1)" + $(C2) " LD $$(@F)" +else + $(C2) " LD$(1) $$(@F)" +endif + $(C1) mkdir -p $$(@D) + $(C1) $$($(1)_PREFIX)$$(CXX) $$(LDFLAGS) \ + $$(addprefix -L,$(FAPI2_PLAT_LIB)) $$(LOCALLDFLAGS) \ + $$(patsubst lib%.so,-l%, $$(notdir $$(filter %.so, $$^))) \ + -Wl,--whole-archive \ + $$(filter-out $$(CTEPATH)%, $$(filter %.a,$$^)) \ + -Wl,--no-whole-archive \ + $$(filter $$(CTEPATH)%, $$(filter %.a,$$^)) \ + -o $$@ +endef + +define __CALL_AR +ifeq "TARGET" "$(1)" + $(C2) " AR $$(@F)" +else + $(C2) " AR$(1) $$(@F)" +endif + $(C1) mkdir -p $$(@D) + $(C1) rm -f $$@ + $(C1) $$($(1)_PREFIX)$$(AR) rcs $$@ $$^ +endef + +define __CALL_CXX_DEP +ifeq "TARGET" "$(1)" + $(C2) " DEP $$(@F:.o=.dep)" +else + $(C2) " DEP$(1) $$(@F:.o=.dep)" +endif + $(C1) mkdir -p $$(@D) + $(C1) $$($(1)_PREFIX)$$(CXX) -M -MP -MT $$@ \ + $$(COMMONFLAGS) $$(CXXFLAGS) \ + $$(LOCALCOMMONFLAGS) $$(LOCALCXXFLAGS) \ + $$< -o $$(subst .o,.dep,$$@) +endef + +define __CALL_CC_DEP +ifeq "TARGET" "$(1)" + $(C2) " DEP $$(@F:.o=.dep)" +else + $(C2) " DEP$(1) $$(@F:.o=.dep)" +endif + $(C1) mkdir -p $$(@D) + $(C1) $$($(1)_PREFIX)$$(CC) -M -MP -MT $$@ \ + $$(COMMONFLAGS) $$(CFLAGS) \ + $$(LOCALCOMMONFLAGS) $$(LOCALCFLAGS) \ + $$< -o $$(subst .o,.dep,$$@) + +endef |