Rev 4488 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
################################################################################ Copyright (c) VIX TECHNOLOGY (AUST) LTD## File: TOOLSET/m16c.rul[e]# Contents: m16c rules# Make definitions for the m16c tools.## Description:# This file provides Toolset rules for the target makefiles# The file is dropped into the target makefile## Revision History:# 26-Oct-05 DDP Started Work###############################################################################################################################################################.. Remove "undef" warnings#cc_includes +=cc_defines +=cc_opts +=cxx_includes +=cxx_defines +=################################################################################.. Parse user options# Global options already parsed# These options extend the global options#ifdef OPTIONSendif################################################################################.. C Compiler definition### Compiler flags### -c - Compile only# -Dxxx - Preprocessor define# -Uxxx - Preprocessor undefine# -Ixxx - Extends include file path ( limit to 8 )# -g - Outputs debug info to an assembler source file (extension .a30).# -silent - Suppresses the copyright message display at startup.# -fETI - Extends char-type or signed char-type data to int-type# data to perform operation (extension as per ANSI rules)# -OS - Optimise for Speed# -OR - Optimise for Rom size# -dir xxx - Output directory name#cc = $(CC_PRE) $(Compiler)cc_init =cc_o_switch = -dir $(@D)cc_source_file = $<cc_source = $(subst /,\\,$(cc_source_file))cc_flags = -silent -c -fETI $(CFLAGS)cc_flags += $(cc_opts) $(cc_defines) $(cc_includes)cc_filter := $(wildcard $(GBE_ROOT)/warnings.m16c)ifdef cc_filtercc_redirect_stderr = 1cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.m16cendififneq ($(SHOWARGS),NONE)cc_opts += -vendififdef LEAVETMPcc_opts += -gendif#ifdef USE_STRICT_ANSI#cc_opts +=#else#cc_opts +=#endififdef USE_OPTIMISEcc_opts += -OSelseendififdef USE_DEBUGINFOcc_opts += -g -DDEBUGelsecc_opts += -DNDEBUG -UDEBUGendififeq "$(DEBUG)" "1"cc_opts += -DKD30=1elsecc_opts += -DKD30=0endififdef ALVLcc_opts += -DALVL=$(ALVL)endififdef DLVLcc_opts += -DDLVL=$(DLVL)endifcc_opts += -D__SOURCE__=$(notdir $<)cc_includes = $(patsubst %,-I%,$(INCDIRS))cc_pre = @$(echo) [$<] compiling..cc_post =################################################################################ Compiler sanity test# It can only handle 16 include paths# Create an error if there are too many#ifneq ($(word 17, $(INCDIRS)),)$(info ERROR. Too many included directories for the MCR compiler)$(info $(space) The limit is 16. Complete list is:)$(foreach aa,$(INCDIRS), $(info $(space) $(aa)))$(error Too many included directories for the MCR compiler)endif################################################################################.. C/C++ dependencies# depend and depend.err#ccdep = $(XX_PRE) $(GBE_BIN)/mkdependccdep_init =ccdep_o_switch = -f -ccdep_source = $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.errccdep_flags = -MM -b -p \$$\(OBJDIR\)/ \$(foreach shname,$(SHNAMES),-p '$$(OBJDIR)/$(shname)/') \-o .$(o) \$(patsubst %,%,$(CFLAGS)) \$(patsubst %,-D%,$(cc_defines)) \$(patsubst %,-I %,$(INCDIRS)) \$(patsubst %,-Y %,$(subst \,/,$(INC30))) \$(patsubst %,-Y %,$(NODEPDIRS))ccdep_pre =ccdep_post =################################################################################.. Assembler definition## Note: The assembler command line is limited in length and the command# does not accept a command file## Do not include INCDIRS as this will blow the command line length# The assumption is that assember use is trivial and does not# need include paths#as = $(XX_PRE) $(Assembler)as_init =as_o_switch = -O$(subst /,\\,$(@D))as_source = $(subst /,\\,$<)as_flags = -M -. -Las_flags += $(ASFLAGS)ifeq "$(DEBUG)" "1"as_flags += -DKD30=1elseas_flags += -DKD30=0endif#as_flags += $(patsubst %,-I%,$(INCDIRS))as_pre = @$(echo) [$@] Assembling file ...as_post =#.. Archiver#ar = $(XX_PRE) $(m16c_librarian)ar_init =ar_cmdfile = $(basename $@).arar_flags =ar_o_switch = @$(ar_cmdfile)define ar_pre@$(echo) [\$@] Creating library archive.. ; \$(rm) -f $@ ;\$(cmdfile) -ko$(ar_cmdfile) \-. -C $@\\n\$(subst /,\\\\,$(patsubst %,%\\n,$(filter %.R30, $^)))\\\nendefifndef LEAVETMPdefine ar_post@$(rm) -f $(ar_cmdfile)endefelsedefine ar_postendefendif#.. Archive Merge# Not currently supported# No reason for this - just no need yet#.. Linker#ld = $(XX_PRE) $(Linker)ld_cmdfile = $(basename $@).ldld_flags = @$(ld_cmdfile)ld_o_switch =define ld_pre$(echo) [$@] Linking program .. ;\export M16C_LIB; \M16C_LIB="$(subst /,\\,$(subst $(space),;,$(LIBDIRS)))"; \$(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(SHBASE))_ld)"endefifndef LEAVETMPdefine ld_post$(call MCRFLASHEND,$@,$(BINDIR)/${SHBASE}.map,$($(notdir $(SHBASE))_FlashEnd))@$(rm) -f $(ld_cmdfile)endefelsedefine ld_post$(call MCRFLASHEND,$@,$(BINDIR)/${SHBASE}.map,$($(notdir $(SHBASE))_FlashEnd))endefendif#.. Create Library dependency file#define LDDEPEND$(XX_PRE) export M16C_LIB; \M16C_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -ko$(@) "$($(DPLIST))";endef## Use the mcrflashend.pl tool to verify that the flash memory has not overflowed# $1 - Name of the build target# $2 - Map file# $3 - The first invalid flash address in hex#ifdef TOOL_MCRFLASHENDdefine MCRFLASHEND$(XX_PRE)$(GBE_PERL) $(TOOL_MCRFLASHEND) -n "$1" -m "$2" -e "$3"endefelsedefine MCRFLASHENDendefendif## Use the LMC utility to convert an .X30 file into a .mot file# $1 - Name of target .bin file#define LMC@$(echo) "[$@] Convert to binary.."$(XX_PRE)$(LinkerLMC) -. $<$(XX_PRE)$(TOOL_APPCRC) $(basename $@).mot$(XX_PRE)$(cp) $(basename $@).bin $(basename $@).raw$(XX_PRE)$(cp) $(basename $@).bin $1endef## Use the LMC_MOT utility to convert an .X30 file into a .mot file# $1 - Name of target .mot file#define LMC_MOT@$(echo) "[$@] Convert to MOT.."$(XX_PRE)$(LinkerLMC) -. $<$(XX_PRE)$(cp) $(basename $<).mot $1endef## Use the modcrc utility to convert an .raw file into a .thx file# $1 is the name 'rel' file#define MODCRC@$(echo) "[$@] Add CRC information.."$(XX_PRE)$(TOOL_MODCRC) -m=$(basename $@) -i=raw -o=thx -f=$1$(XX_PRE)( $(rm) -f dummy.thx; $(cp) -f $(basename $@).thx dummy.thx; $(chmod) -f +w dummy.thx )$(XX_PRE)$(TOOL_MODCRC) -m=dummy -i=thx -o=bin$(XX_PRE)$(mv) dummy.bin $(basename $@).mod$(XX_PRE)$(rm) -f dummy.thxendef## Convert a THX file to an R30 object file# This is done by# .thx -> modcrc -> .bin# .bin -> fontcrc -> .c# .c -> compiler -> .r30## $1 - source filename# $2 - target file ( without extension )## Note: Silly modcrc requires that its input file is writable# Must transfer it to another directory#define THX2R30@$(echo) "[$@] Convert THX to object.."$(XX_PRE)( $(rm) -f $2.thx; $(cp) -f $1 $2.thx; $(chmod) -f +w $2.thx )$(XX_PRE)$(TOOL_MODCRC) -m=$2 -i=thx -o=bin > $2.nul || rm -f $2.null$(XX_PRE)$(TOOL_FONTCONV) $2.bin$(CC)endef## Convert a BIN file into a PAYLOAD file## $1 - Version stringdefine MCRPLD@$(echo) "[$@] Convert BIN to Payload.."$(XX_PRE)$(GBE_PERL) $(TOOL_MCRPLD) -v $1 -i $< -o $@endef#