Subversion Repositories DevTools

Rev

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

# -*- mode: mak; -*-
###############################################################################
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
#
# File:         TOOLSET/dafbr.rul[e]
# Contents:     daf br compiler rules
#
# Description:
#       This file provides Toolset rules for the target makefiles
#       The file is dropped into the target makefile
#
# Revision History:
#       16-Dec-04   DDP     Started Work
###############################################################################

###############################################################################
#..     Remove "undef" warnings
#
cc_includes      +=
cc_defines       +=
brcc_flags   +=

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

###############################################################################
#..     Compiler definitions
#

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

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

cc_defines      += -D__SOURCE__=\"$(notdir $<)\"

br_includes = $(DAFBROPCODE_PATH) $(DAFBRCOMPILER_PATH)

    #
    # Compiler flags:
    #   /g file     - payload definition file
    #   /l path     - loads the specified opcode table file
    #   /little     - output endian
    #   /big        - output endian
    #   /d*         - All debug files
    #   /d          - Define debug maro only

ifeq "$(DEBUG)" "1"                             # debug/prod specific
cc_defines      += -D_DEBUG
brcc_flags      += /d
else
cc_defines      += -DNDEBUG
endif

brcc_flags += /e$(ENDIAN)

ifdef USE_OPTIMISE                              # default for production
brcc_flags      += /o
else
brcc_flags      +=
endif

ifdef DAFBR_V2                  # Version-2 compiler
brcc_flags      += /nopayload /g $(BRCC_DEF)
endif


        #   Command
        #..
cc              = $(CC_PRE) $(DAFBRCOMPILER)
cc_init         =
cc_o_switch     = /Fr $(subst /,\,$@)
cc_source       = $(subst /,\\,$<)
cc_flags    = \
                $(brcc_flags) \
                $(patsubst %,/l %,$(subst /,\,$(DAFBROPCODE))) \
                $(patsubst %,%,$(CFLAGS)) \
                $(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(INCDIRS)))) \
                $(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(cc_includes)))) \
                $(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(br_includes))))

cc_term         =

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

cc_post =

cc_filter       := "$(notdir $(wildcard $(GBE_ROOT)/warnings.dafbr))"
ifeq ($(strip $(cc_filter)), "warnings.dafbr")
cc_filter       = $(GBE_ROOT)/warnings.dafbr
else
cc_filter       =
endif

ifdef cc_filter
cc_redirect_stderr = 1
cc_error_filter = $(awk) -f $(cc_filter)
endif


###############################################################################
#..     C/C++ dependencies
#       depend and depend.err
#
cc_depend       =
ccdep           = $(XX_PRE) $(GBE_BIN)/mkdepend
ccdep_init      =
ccdep_o_switch  = -f -
ccdep_source    = $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.err
ccdep_flags     = -MM -b -We -p '$$(OBJDIR)/' \
                $(foreach shname,$(SHNAMES),-p '$$(OBJDIR)/$(shname)/') \
                -o ".$(o)" \
                $(patsubst %,%,$(cc_depend)) \
                $(patsubst %,%,$(cc_defines)) \
                $(patsubst %,%,$(CFLAGS)) \
                $(patsubst %,%,$(CXXFLAGS)) \
                $(patsubst %,-D%,$(cc_defines)) \
                $(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(INCDIRS)))) \
                $(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(cc_includes)))) \
                $(subst $(spacealt),$(space),$(patsubst %,-I"%",$(subst /,\,$(br_includes)))) \
                $(patsubst %,-Y %,$(NODEPDIRS))

ccdep_pre       =
ccdep_post      =


#..     Application
#       Link one or more .rul files into a single .bin file
#       The individual .rul files are not specified. The compiler is
#       instructed to look for them in the OBJECT directory
#
#       Note: BRLD_FLAGS and BRLD_DEF are target specific variables
#             They cannot be tested with a "ifdef", but can be used
#             in substitutions
#
#             Default values are set within the makefile and may
#             be overriden within the recipe
#

ld              = $(CC_PRE) $(DAFBRCOMPILER)
ld_o_switch     = $(patsubst %,/I %,$(sort $(^D))) /Fp $(subst /,\,$@)
ld_term         =
ld_flags        = \
        /nocompile \
                $(patsubst %,/%,$(BRLD_FLAGS)) \
        /e$(ENDIAN) \
        /g $(subst /,\,$(BRLD_DEF)) \
                $(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(INCDIRS)))) \
                $(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(cc_includes)))) \
                $(subst $(spacealt),$(space),$(patsubst %,/I %,$(subst /,\,$(br_includes))))
        

define ld_pre
        echo [$@] "Generating Payload .."
endef


ld_post     =