Subversion Repositories DevTools

Rev

Rev 227 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

# -*- mode: mak -*-
###############################################################################
# Module name   : TOOLSET/gnupro_h8.rul
# Module type   : Makefile system
# Environment(s): GnuPro H8
#
# Version   Who   Date      Description
#           DDP   23-Nov-04 Created
#
###################################################################

###############################################################################
#..  Remove "undef" warnings
#
cc_includes     +=
cc_defines      +=
cxx_include     +=
cxx_defines     +=
as_includes     +=
as_defines      +=

###############################################################################
#..     Parse user options
#       Global options already parsed
#       These options extend the global options
#

ifdef OPTIONS

ifneq "$(findstring wall,$(OPTIONS))" ""            # Enable all warnings
USE_WALL        = 1
endif

endif


###############################################################################
#..  C Compiler definition
#
#    -ms                Generate code for the H8S chip.
#    -c                 Compile only
#    -0                 Optimize
#    -ffloat-store      Do not store floating point variables in registers
#                       and inhabit other options that might change whether
#                       floating point value is taken from register or
#                       memory.
#    -g3                The compiler debugging option, followed by the level.
#                       Level 3 included extra information.
#    -Wall              Issue warnings.
#    -r                 Elimates the use of built-in implicit rules.
#    -save-temps        Do not delete intermediate files
#    -mint32            Make int data 32 bits by default.
#    -malign-300        Align longs and floats on 2 byte boundaries.
#

cc              = $(CC_PRE) gcc
cc_init         =
cc_o_switch     = -o $@
cc_source       = $<
cc_flags        = \
                $(patsubst %,%,$(CFLAGS)) \
                $(patsubst %,-D%,$(cc_defines)) \
                $(patsubst %,%,$(gcc_flags)) \
                $(patsubst %,-I %,$(INCDIRS)) \
                $(patsubst %,-I %,$(cc_includes)) \
                $(patsubst %,-I %,$(gcc_includes))
cc_term         = ;                             # ';' forces use of 'sh.exe'

gcc_includes    += $(H8Dir)/Include
gcc_flags       = -c -ms -Wall -W -ffloat-store -r -mint32 -malign-300

ifdef USE_WALL
#gcc_flags      += -Wuninitialized              # only makes sense with `-O'
gcc_flags       += -Wwrite-strings
gcc_flags       += -Wcast-qual
gcc_flags       += -Wbad-function-cast
gcc_flags       += -Wpointer-arith
gcc_flags       += -Wstrict-prototypes
gcc_flags       += -Wmissing-prototypes
gcc_flags       += -Wmissing-declarations
gcc_flags       += -Wnested-externs
gcc_flags       += -Wtraditional
gcc_flags       += -Wconversion
gcc_flags       += -Wcomment
gcc_flags       += -Wcast-align
#gcc_flags      += -Winline
gcc_flags       += -Wshadow
gcc_flags       += -Wredundant-decls
gcc_flags       += -Wid-clash-31
endif

ifdef FORCE_C_COMPILE
gcc_flags       += -x c
endif

ifdef FORCE_CC_COMPILE
gcc_flags       += -x c++
endif

ifdef LEAVETMP
gcc_flags       += -save-temps
endif

ifdef USE_STRICT_ANSI
gcc_flags       += -ansi
endif

ifdef USE_OPTIMISE
gcc_flags       += -O3
else
gcc_flags       +=
endif

ifdef USE_DEBUGINFO
gcc_flags       += -g3 -DDEBUG
else
gcc_flags       += -DNDEBUG
endif

ifeq "$(DEBUG)" "1"
gcc_flags       +=
else
gcc_flags       +=
endif

ifdef ALVL
gcc_flags       += -DALVL=$(ALVL)
endif

ifdef DLVL
gcc_flags       += -DDLVL=$(DLVL)
endif

gcc_flags       += -D__SOURCE__=\"$(notdir $<)\"
ifdef LEAVETMP
gcc_flags       += -save-temps
endif

define cc_pre
        @echo [\$<] compiling..
endef

define cc_post
endef


###############################################################################
#..     C/C++ dependencies
#
#    -M         Generate make dependencies
#    -MM        As -M, but ignore system header files
#    -MG        Treat missing header files as generated
#

ifeq "$(DEBUG)" "1"
gcc_depend      += -DDEBUG
endif
ifdef ALVL
gcc_depend      += -DALVL=$(ALVL)
endif
ifdef DLVL
gcc_depend      += -DDLVL=$(DLVL)
endif

###############################################################################
#..     C/C++ dependencies
#       depend and depend.err
#
ccdep           = $(XX_PRE) $(GBE_BIN)/mkdepend
ccdep_o_switch  = -f -
ccdep_init      =
#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 %,%,$(gcc_depend)) \
                $(patsubst %,-I %,$(INCDIRS)) \
                $(patsubst %,-I %,$(cc_includes)) \
                $(patsubst %,-Y %,$(gcc_includes))
ccdep_pre       =
ccdep_post      =


###############################################################################
#..     C++ Compiler definition
#

cxx             = $(CC_PRE) gcc
cxx_init        =
cxx_switch      = -o $@
cxx_source      = $<
cxx_flags       = \
                $(patsubst %,%,$(CXXFLAGS)) \
                $(patsubst %,-d%,$(cxx_defines)) \
                $(patsubst %,%,$(gcc_flags)) \
                $(patsubst %,-I %,$(INCDIRS)) \
                $(patsubst %,-I %,$(cxx_includes)) \
                $(patsubst %,-I %,$(gcc_includes))
cxx_term        = ;                             # ';' forces use of 'sh.exe'

define cxx_pre
        @echo [\$<] compiling..
endef

define cxx_post
endef


###############################################################################
#..     Archiver
#
ar              = $(XX_PRE) $(H8Dir)/bin/ar
ar_o_switch     =
ar_flags        = -scvr $@ $(patsubst %,%,$^)

define ar_pre
        @$(echo) [\$@] Creating library archive..
endef

ar_post =


###############################################################################
#..     Archive Merge
#
arnull          = arnull.txt
armerge             = $(XX_PRE) $(GBE_TOOLS)/armerge
armerge_init    =
armerge_flags   = -d $(MLIBDIR)/merge -t unix -a ar -n $(arnull)
armerge_o_switch= $@ $^

define  armerge_pre
        @$(echo) [\$@] Merging library archive..
        $(XX_PRE) rm -f $@ $(arnull)
endef

ifndef LEAVETMP
define armerge_post
        @-$(rm) -rf $(arnull) $(OBJDIR)/merge
endef
else
define armerge_post
endef
endif

###############################################################################
#..     Assembler definition
#       Although the assembler is not currently supported the following
#       definition is required by the make system
#
as_init         =



#