# -*- mode: mak -*- ############################################################################### # File: TOOLSET/mri68k.rul[e] # Contents: MRI 68k rules # Make definitions for the Microtec tools. # # Version Who Date Description # APY 10/03/00 Error filtering # 20/03/00 LEAVETMP shall leave .src files # 22/03/00 NODEPDIRS # 05/06/00 __SOURCE__ # 26/02/02 Build system +v2 support. # - ; appended to several directives, forcing use of # 'sh.exe' during execution. Required by WIN32 # toolsets (see xx_term variables), # - added depend post processing to append OBJDIR # 27/05/02 - realpath # - quoted __SOURCE__, unquoted broke MRI 4.4 # 12/03/04 mkdepend -b -o -p # ############################################################################### ############################################################################### #.. Remove "undef" warnings # cc_includes += cc_defines += as_includes += as_defines += cxx_includes += cxx_defines += ############################################################################### #.. C Compiler definition # # -v detects and issue warnings for features in source files # that can cause problems. # -Gf Generate fully qualified pathnames for input files. # -nOc Pop stack after each function call. # -nQ Dont terminate compile based on error count. # -Kf Generate stack frame for all functions. # -Z4 4 byte alignment. # -Feo Writes diagnostic message to stdout. # # -nOl Disable local optimisation. # -nOR Disable automatic register variable assignment. # # -Og Enables global-flow optimisation. # -Or Enables intruction scheduling optimisation. # -Ob Assume memory will not be changed externally. # -Oe Generate only one from a return. # -Os Favor code size. # cc = mcc68k cc_init = cc_o_switch = cc_object = -o$@ cc_source = cc_cmdfile = $(basename $@).cmd cc_flags = -d$(cc_cmdfile) cc_term = ; # ';' forces use of 'sh.exe' cc_filter := "$(notdir $(wildcard $(GBE_ROOT)/warnings.mri*))" ifeq ($(strip $(cc_filter)), "warnings.mri") # dos cc_redirect = 1 cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.mri mri_flags += -nFee # Dont Output to stderr. endif cc_filter := "$(notdir $(wildcard $(GBE_ROOT)/WARNINGS.MRI*))" ifeq ($(strip $(cc_filter)), "WARNINGS.MRI") # WIN32 mixed case cc_redirect = 1 cc_error_filter = $(awk) -f $(GBE_ROOT)/WARNINGS.MRI mri_flags += -nFee # Dont Output to stderr. endif mri_includes += $(mri) mri_flags += -pCPU32 -c # Compile only mri_flags += -v -Gf -nOc -nQ -Kf -Z4 -Feo ifdef LEAVETMP mri_flags += -H -Fsm # Save assembly (with comments) endif ifdef MRI_NONANSI mri_flags += -nv # Non ANSI endif ifeq "$(DEBUG)" "1" mri_flags += -g -DDEBUG # Full debug mri_flags += -nOl -nOR -nOg # no optimisation else ifdef MRI_OPTIM mri_flags += -Og -Or -Ob -Oe -Os # Full optimisation else mri_flags += -nOl -nOR -nOg # Disable optimisation endif endif ifdef ALVL mri_flags += -DALVL=$(ALVL) endif ifdef DLVL mri_flags += -DDLVL=$(DLVL) endif mri_flags += -D__SOURCE__=\"$(notdir $<)\" define cc_pre @$(echo) '[$<] compiling..' ; \ $(cmdfile) -ko$(cc_cmdfile) "\ $(patsubst %,%\\n,$(CFLAGS)) \ $(patsubst %,-D%\\n,$(cc_defines)) \ $(patsubst %,%\\n,$(mri_flags)) \ -J$(subst /,\\\\,$(dir $<))\\n \ $(patsubst %,-J%\\n,$(subst /,\\\\,$(INCDIRS))) \ $(patsubst %,-J%\\n,$(subst /,\\\\,$(cc_includes))) \ $(patsubst %,-J%\\n,$(subst /,\\\\,$(mri_includes))) \ $(subst /,\\\\,$(cc_object))\\n\ @(realpath,$(subst /,\\,$<))" endef ifndef LEAVETMP define cc_post @$(rm) -f $(cc_cmdfile) endef else define cc_post endef endif cxx = cxx_init = cxx_o_switch = cxx_object = cxx_source = cxx_cmdfile = cxx_flags = cxx_term = ; # ';' forces use of 'sh.exe' ############################################################################### #.. C/C++ dependencies # depend and depend.err # mri_depend = -D__STDC__ -D_MCC68K ifeq "$(DEBUG)" "1" mri_depend += -DDEBUG endif ifdef ALVL mri_depend += -DALVL=$(ALVL) endif ifdef DLVL mri_depend += -DDLVL=$(DLVL) endif mri_depend += -D__SOURCE__=$(notdir $<) ccdep = $(XX_PRE) $(GBE_BIN)/mkdepend ccdep_init = ccdep_o_switch = -f - #ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.err ccdep_source = $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.err ccdep_flags = -MM -b -p '$$(OBJDIR)/' -o ".$(o)" \ $(patsubst %,%,$(CFLAGS)) \ $(patsubst %,-D%,$(cc_defines)) \ $(patsubst %,%,$(mri_depend)) \ $(patsubst %,-I %,$(INCDIRS)) \ $(patsubst %,-Y %,$(cc_includes)) \ $(patsubst %,-Y %,$(mri_includes)) \ $(patsubst %,-Y %,$(NODEPDIRS)) ccdep_pre = ccdep_post = #ifndef LEAVETMP #define ccdep_post # -sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | \ # grep \\.${o} > $(subst /,/,$@) # @rm $(subst /,/,$@).tmp #endef #else #define ccdep_post # -sed s/\^/\$$\(OBJDIR\)\\// $(subst /,/,$@).tmp | \ # grep \\.${o} > $(subst /,/,$@) #endef #endif ############################################################################### #.. Assembler definition # # Note: All the options go on the command line at present, as # such passes a minimal set of definitions. (v4.3 and v4.4) # # Switchs should be embedded within the target source. # as = asm68k as_init = as_i_switch = -I as_o_switch = -o$@ as_source = <$< as_cmdfile = as_term = ; # ';' forces use of 'sh.exe' asm68_flags = -f"P=CPU32,d" # embedded debug info #asm68_flags += -f"NOPCR" #ifeq "$(DEBUG)" "1" #asm68_flags += -DDEBUG #endif ifdef ASFLAGS asm68_flags += $(ASFLAGS) endif ifdef as_defines asm68_flags += $(addprefix -D,$(as_defines)) endif as_flags = $(asm68_flags) #ifdef INCDIRS #as_flags += "-I$(subst $(space),;,$(strip $(INCDIRS)))" #endif ifdef as_includes as_flags += "-I$(subst $(space),;,$(strip $(as_includes)))" endif define as_pre endef define as_post endef #.. Archiver # ar = lib68k ar_init = ar_cmdfile = $(basename $@).ar ar_flags = ar_o_switch = < $(ar_cmdfile) ar_term = ; # ';' forces use of 'sh.exe' define ar_pre -$(rm) -f $@ @$(cmdfile) -ko$(ar_cmdfile) \ create $@\\n\ $(patsubst %,addmod %\\n,$(filter %.obj, $^))\ save\\n end\\n endef ifndef LEAVETMP define ar_post @$(rm) -f $(ar_cmdfile) endef else define ar_post endef endif #.. Linker # ld = lnk68k ld_cmdfile = $(basename $@).ld ldabs_flags = -m -c$(ld_cmdfile) ldabs_o_switch = -o$@ > $(basename $@).map ldhex_flags = -m -Fs -c$(ld_cmdfile) ldhex_o_switch = -o$(basename $@).s > $(basename $@).map ld_term = ; # ';' forces use of 'sh.exe' rel_ld_term = ; define ld_pre @export MRI_LIB; \ MRI_LIB="$(subst $(space),;,$(LIBDIRS))"; \ $(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)" endef define ldabs_post @if [ -n "$$VISIONCLICK" ]; then \ $(est32)/convert "$@" -c -m arm -b; \ fi endef define ldhex_post endef ifndef LEAVETMP define ld_post @$(rm) -f $(ld_cmdfile) endef else define ld_post endef endif define LDDEPEND @export MRI_LIB; \ MRI_LIB="$(subst $(space),;,$(LIBDIRS))"; \ $(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)" endef define LDABS @$(show_environment) $(ld_pre) $(ld) $(ldabs_flags) $(ldabs_o_switch) $(ld_term) $(ldabs_post) $(ld_post) endef define LDBIN @$(show_environment) $(ld_pre) $(ld) $(ldhex_flags) $(ldhex_o_switch) $(ld_term) $(ldhex_post) $(ld_post) endef #