Rev 4538 | Blame | Compare with Previous | Last modification | View Log | RSS feed
# -*- mode: mak; -*-################################################################################ File: TOOLSET/sunworks.rul[e]# Contents: SunWorks rules################################################################################################################################################################.. Remove "undef" warnings#cc_includes +=cc_defines +=cxx_includes +=cxx_defines +=as_includes +=as_defines +=################################################################################.. Toolset defaults#################################################################################.. Parse user options# Global options already parsed# These options extend the global options#CC_PURIFY =suncc_filter := "$(notdir $(wildcard $(GBE_ROOT)/warnings.sunworks))"ifeq ($(strip $(suncc_filter)), "warnings.sunworks")suncc_filter = $(GBE_ROOT)/warnings.sunworkselsesuncc_filter =endififdef OPTIONSifneq "$(findstring warnings,$(OPTIONS))" "" # Show all warningssuncc_filter =endififneq "$(findstring purify,$(OPTIONS))" "" # Enable purifyCC_PURIFY += purifyendififneq "$(findstring purecov,$(OPTIONS))" "" # Enable pure coverageCC_PURIFY += purecovendififneq "$(findstring quantify,$(OPTIONS))" "" # Enable quantifyCC_PURIFY += quantifyendififneq "$(findstring ccdepend,$(OPTIONS))" "" # Build depends using CCUSE_CCDEPEND = 1endifendif################################################################################.. Common compiler and linker flags#ifdef THREADMODEcommon_flags += -mtendififdef MISALIGNcommon_flags += -misalignendififdef COMPILE32common_flags += -xtarget=genericendififdef COMPILE64common_flags += -m64 -KPICifndef ISA_SPARCcommon_flags += -xmodel=mediumendifendif################################################################################.. C Compiler definition#ifndef SUNWSPRO_SC$(error Internal: SUNWSPRO_SC has not been defined by the build system)endififndef AR_PATH$(error Internal: AR_PATH has not been defined by the build system)endif## Ensure that AR can be found in the path# Place the compiler in the path for good measure#PATH := $(AR_PATH):$(SUNWSPRO_SC)/bin:$(PATH)export PATHCCOMPILER := ccifdef FORCE_C_COMPILECCOMPILER := ccendififdef FORCE_CC_COMPILECCOMPILER := CCendififeq "$(CCOMPILER)" "cc"CFLAGS := $(CFLAGS) -erroff=E_WHITE_SPACE_IN_DIRECTIVEendifLIBDIRS += $(SUNWSPRO_SC)/libSHCFLAGS += -KPICSHCXXFLAGS += -KPICifdef suncc_filtercc_redirect_stderr = 1cc_error_filter = $(awk) -f $(suncc_filter)endifcc = $(CC_PRE)$(CC_PURIFY) $(SUNWSPRO_SC)/bin/$(CCOMPILER)cc_init =cc_o_switch = -o $@cc_source = $<cc_flags = \$(patsubst %,%,$(CFLAGS)) \$(patsubst %,-D%,$(cc_defines)) \$(patsubst %,%,$(suncc_flags)) \$(patsubst %,-I%,$(INCDIRS)) \$(patsubst %,-I%,$(cc_includes)) \$(patsubst %,-I%,$(suncc_includes))suncc_includes +=suncc_flags = -csuncc_flags += $(common_flags)ifdef suncc_filtersuncc_flags += +w2elsesuncc_flags += +wendififdef USE_DEBUGINFOsuncc_flags += -g -DDEBUG -xsendififdef USE_OPTIMISEsuncc_flags += -xO2endififdef ALVLsuncc_flags += -DALVL=$(ALVL)endififdef DLVLsuncc_flags += -DDLVL=$(DLVL)endifsuncc_flags += -D__SOURCE__=\"$(notdir $<)\"define cc_pre@echo '[$<] compiling..'endefdefine cc_postendef################################################################################.. C/C++ dependencies#suncc_depend +=ifndef USE_CCDEPENDsuncc_depend += -MM -D__STDC__ -Dunix -Dsun -D$(HOST_CPU)elsesuncc_depend += -xM1endififdef USE_DEBUGINFOsuncc_depend += -DDEBUGendififdef ALVLsuncc_depend += -DALVL=$(ALVL)endififdef DLVLsuncc_depend += -DDLVL=$(DLVL)endififndef USE_CCDEPENDccdep = $(XX_PRE) $(GBE_BIN)/mkdependccdep_init =ccdep_o_switch = -o.${o} -f -elseccdep = $(XX_PRE) $(SUNWSPRO_SC)/bin/CCccdep_init =ccdep_o_switch = -Eendifccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $(OBJDIR)/depend.errccdep_flags = \$(patsubst %,%,$(CFLAGS)) \$(patsubst %,-D%,$(cc_defines)) \$(patsubst %,%,$(suncc_depend))ifndef USE_CCDEPENDccdep_flags += \$(patsubst %,-I %,$(INCDIRS)) \$(patsubst %,-I %,$(cc_includes)) \$(patsubst %,-Y %,$(suncc_includes)) \-Y $(SUNWSPRO_SC)/include/CC/Cstd \-Y $(SUNWSPRO_SC)/include/CC \-Y /usr/includeelseccdep_flags += \$(patsubst %,-I%,$(INCDIRS)) \$(patsubst %,-I%,$(cc_includes))endif## Parse the depend output:## s/^.*/\(.*\.${o}\:\)/$(OBJDIR)/\1/g# replace all object rules which contain / seperated# subdirs with a stripped prefixed object name.## eg. subdir/dir/object.o: $(OBJDIR)/object.o## s/^\([^/].*\.${o}\:\)/$(OBJDIR)/\1/g# prefix all object rules without subdirs.## eg. object.o: $(OBJDIR)/object.o#..ccdep_pre =ccdep_sed = \-sed -e 's/^.*\/\(.*\.${o}\:\)/\$$\(OBJDIR\)\/\1/g' \-e 's/^\([^/]*\.${o}\:\)/\$$\(OBJDIR\)\/\1/g' \$(subst /,/,$@).tmp > $@ 2>> $(OBJDIR)/depend.err;ifdef SHNAMESccdep_sedsh = \sed -e 's/^.*\/\(.*\.${o}\:\)/\$$\(OBJDIR\)\/$(shname)\/\1/g' \-e 's/^\([^/]*\.${o}\:\)/\$$\(OBJDIR\)\/$(shname)\/\1/g' \$(subst /,/,$@).tmp >> $@ 2>> $(OBJDIR)/depend.err;ccdep_sed += \$(foreach shname,$(SHNAMES),$(ccdep_sedsh))endififndef LEAVETMPdefine ccdep_post@$(ccdep_sed)@rm $(subst /,/,$@).tmpendefelsedefine ccdep_post@$(ccdep_sed)endefendif#.. C++ Compiler definition#ifdef suncc_filtercxx_redirect_stderr = 1cxx_error_filter = $(awk) -f $(suncc_filter)endifcxx = $(CC_PRE)$(CC_PURIFY) $(SUNWSPRO_SC)/bin/CCcxx_init =cxx_o_switch = -o $@cxx_source = $<cxx_flags = \$(patsubst %,%,$(CXXFLAGS)) \$(patsubst %,-d%,$(cxx_defines)) \$(patsubst %,%,$(suncc_flags)) \$(patsubst %,-I%,$(INCDIRS)) \$(patsubst %,-I%,$(cxx_includes)) \$(patsubst %,-I%,$(suncc_includes))define cxx_pre@echo '[$<] compiling..'endefdefine cxx_postendef################################################################################.. Assembler definition##.. Assembler (CC)#as = $(XX_PRE) $(SUNWSPRO_SC)/bin/CCas_init =as_i_switch = -I$(space)as_o_switch =as_object = -o $@as_source = $<as_cmdfile = $(basename $@).cmdas_flags = @$(as_cmdfile)as_flags = -Wall -x assembler-with-cpp -cifdef USE_DEBUGINFOas_flags += -g -DDEBUGendififdef DLVLas_flags += -DDLVL=$(DLVL)endififdef ALVLas_flags += -DALVL=$(ALVL)endifas_defines := $(addprefix -D,$(as_defines))as_defines += $(as_flags)define as_pre@echo '[$@] compiling..'@$(cmdfile) -ko$(as_cmdfile) "\$(patsubst %,%\\n,$(ASFLAGS)) \$(patsubst %,%\\n,$(as_defines)) \$(patsubst %,$(as_i_switch)%\\n,$(INCDIRS)) \$(patsubst %,$(as_i_switch)%\\n,$(as_includes)) \$(as_object)\\n"endefifndef LEAVETMPdefine as_post@$(rm) -f $(as_cmdfile)endefelsedefine as_postendefendif################################################################################.. Archiver definition##.. Archiver#ar = $(XX_PRE) $(SUNWSPRO_SC)/bin/CCar_init =ar_flags = -xar -oar_o_switch = $@ $^define ar_pre@echo '[$@] Building library ..'endefdefine ar_postendef#.. Archive Merge#armerge = $(XX_PRE) $(GBE_TOOLS)/armergearmerge_init =armerge_flags = -d $(MLIBDIR) -t unixarmerge_o_switch= $@ $^define armerge_pre@echo '[$@] Building merged library ..'-@$(rm) -f $@endefarmerge_post =#.. Linked (shared library support)## The following are detailed within the context of TARGET definition:## SHNAME Defines the shared library soname (eg lib.so.1.1)# SHBASE Defines the base library linkname (eg lib.so)#shld = $(CC_PRE) $(SUNWSPRO_SC)/bin/CCshld_init =shld_o_switch = -o $@shld_flags += +w -G -h'$(SHNAME)'ifdef USE_DEBUGINFOshld_flags += -gendifshld_flags += $(common_flags)shld_flags += \$(patsubst %,-L%,$(LIBDIRS)) \$(patsubst %,-%,$(LDFLAGS)) \$($(notdir $(SHBASE))_shld)define shld_pre@echo '[$@] Linking shared library ..'endefdefine shld_postendefdefine SHLDDEPEND$(AA_PRE)export CC_LIB; \CC_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -o$@ "$($(DPLIST))"endef#.. Linker#ld = $(CC_PRE)$(CC_PURIFY) $(SUNWSPRO_SC)/bin/CCld_init =ld_o_switch = -o $@ld_flags += +wifdef USE_DEBUGINFOld_flags += -gendifld_flags += $(common_flags)ld_flags += \$(patsubst %,-L%,$(LIBDIRS)) \$(patsubst %,-%,$(LDFLAGS)) \$($(notdir $(basename $@))_ld)define ld_pre@echo '[$@] Linking application ..'endefdefine ld_postendefdefine LDDEPEND$(AA_PRE)export CC_LIB; \CC_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -o$@ "$($(DPLIST))"endef#