Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
# -*- mode: mak -*-################################################################################ Module name : TOOLSET/KeilC51V41# Module type : Makefile system# Environment(s): KeilC51V41## Version Who Date Description# DDP 04-Jan-05 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 OPTIONSifneq "$(findstring wall,$(OPTIONS))" "" # Enable all warningsUSE_WALL = 1endifendifcc_filter := $(wildcard $(GBE_ROOT)/warnings.keil)ifdef cc_filtercc_redirect = 1cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.keilendif################################################################################.. C Compiler definition# Notes:# The Keil compiler has a specific ordering of files on the command line# The standard definitions are bent to fit## The compiler does not support specification of include directories# on the command line. They are done via the C51INC environment variable## The compiler defines __C51__## The shell used by make needs the XX() constructs to be esacped## The compiler does not take include files on the command line# These MUST be passed via the environment variable C51INC## Convert user CFLAGS from -Dxxxx -> DF(xxxx)## The command line is VERY limited# Use abbreviations at all times##cc = $(CC_PRE) export C51INC;\C51INC="$(subst $(space),$(semicolon),$(INCDIRS) $(strip $(cc_includes) $(keil_includes)))";\$(C51BIN)/C51.EXEcc_init =cc_o_switch =cc_source =cc_flags = $(cc_ksource) $(cc_kflags) 'OJ($@)'cc_term = ; rv=$$?;if [ $$rv -gt 1 ] ; then false; else true; ficc_ksource = $<## Process CFLAGS into those with a -D prefix and all others# Merge the -Ddefinition into one argument to save command line space#cc_kdefs = $(subst $(space),$(comma),$(patsubst -D%,%,$(filter -D%,$(CFLAGS)$(cc_defines))))cc_kother = $(filter-out -D%,$(CFLAGS))cc_kflags = \$(patsubst %,'DF(%),$(cc_kdefs))' \$(patsubst %,'%',$(cc_kother)) \$(patsubst %,'%',$(keil_flags))keil_flags = LA RB(0)ifdef USE_WALLkeil_flags +=endififdef USE_STRICT_ANSIkeil_flags += NOEXTENDendififdef USE_OPTIMISEkeil_flags += OT(5,SIZE)elsekeil_flags += OT(5,SIZE)endififdef USE_DEBUGINFOkeil_flags += DBcc_defines += -DDEBUGelsecc_defines += -DNDEBUGendififeq "$(DEBUG)" "1"keil_flags +=elsekeil_flags +=endif# Removed due to command line limitations##ifdef ALVL#cc_defines += ALVL=$(ALVL)#endif##ifdef DLVL#cc_defines += DLVL=$(DLVL)#endif##cc_defines += __SOURCE__=\"$(notdir $<)\"ifdef LEAVETMP#keil_flags += PRINTelsekeil_flags += NOPRendifdefine cc_pre@echo [\$<] compiling..endefdefine cc_postendef################################################################################.. C/C++ dependencies# depend and depend.err## -M Generate make dependencies# -MM As -M, but ignore system header files# -MG Treat missing header files as generated#ifeq "$(DEBUG)" "1"cc_depend += -DDEBUGendififdef ALVLcc_depend += -DALVL=$(ALVL)endififdef DLVLcc_depend += -DDLVL=$(DLVL)endifccdep = $(XX_PRE) $(GBE_BIN)/mkdependccdep_o_switch = -f -ccdep_init =#ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,/,$@).tmp 2> $@.errccdep_source = $(filter %.c %.cc %.cpp, $+) > $@ 2> $@.errccdep_flags = -MM -b -p '$$(OBJDIR)/' -o ".$(o)" \-D__C51__ \$(patsubst %,%,$(CFLAGS)) \$(patsubst %,-D%,$(cc_defines)) \$(patsubst %,%,$(cc_depend)) \$(patsubst %,-I %,$(INCDIRS)) \$(patsubst %,-I %,$(cc_includes)) \$(patsubst %,-Y %,$(keil_includes))ccdep_pre =ccdep_post =################################################################################.. Archiver# The librarian appears to only handle one command at a time# The librarian has severe command line length limits#ar = $(XX_PRE) $(C51BIN)/LIB51 create $@ ;\for obj in $(filter %.o51, $^); do \$(C51BIN)/LIB51 ADD $$obj to $@ ;\rv=$$?;\if [ $$rv -gt 0 ] ; then \echo "Error creating library: $@";\rm -f $@;\exit 1 ;\fi;\donear_init =ar_flags =ar_o_switch =ar_term =define ar_pre$(echo) [\$@] Creating library archive.. ; \$(rm) -f $@endefar_post =################################################################################.. Archive Merge# The librarian appears to only handle one command at a time# It does not appear to handle multiple libraries in a merge#armerge = $(XX_PRE) $(C51BIN)/LIB51 create $@ ;\for lib in $(filter %.lib, $^); do \$(C51BIN)/LIB51 ADD $$lib to $@ ;\rv=$$?;\if [ $$rv -gt 0 ] ; then \echo "Error creating Merge library: $@";\rm -f $@;\exit 1 ;\fi;\donearmerge_init =armerge_flags =armerge_o_switch=define armerge_pre@$(echo) [\$@] Merging library archive..$(XX_PRE) rm -f $@endefarmerge_post =################################################################################.. Assembler definition# Although the assembler is not currently supported the following# definition is required by the make system#as_init =#