sdcc-custom-rule has been added to makefile.z80

This commit is contained in:
matsutsuka 2007-09-10 15:09:28 +00:00
parent 0e5a8968dd
commit cd971ff8cc

View File

@ -2,7 +2,7 @@
# Makefile for z80/SDCC # Makefile for z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org> # @author Takahide Matsutsuka <markn@markn.org>
# #
# $Id: Makefile.z80,v 1.4 2007/09/09 13:41:15 matsutsuka Exp $ # $Id: Makefile.z80,v 1.5 2007/09/10 15:09:28 matsutsuka Exp $
# #
### Compiler definitions ### Compiler definitions
@ -14,19 +14,50 @@ AR = sdcclib
OBJCOPY = objcopy OBJCOPY = objcopy
STRIP = strip STRIP = strip
### Custom rules
CUSTOM_RULE_C_TO_OBJECTDIR_D=1
CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1
CUSTOM_RULE_LINK=1
### Default flags
CFLAGS += --std-c99 --vc -mz80 CFLAGS += --std-c99 --vc -mz80
ASFLAGS += -l ASFLAGS += -l
LDFLAGS += -mz80 LDFLAGS += -mz80
AROPTS = -a AROPTS = -a
### CPU-dependent directories
CONTIKI_CPU_DIRS = . dev lib CONTIKI_CPU_DIRS = . dev lib
### CPU-dependent source files
CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c uip_arch.c \ CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c uip_arch.c \
libconio_arch.c log-conio.c rs232.c libconio_arch.c log-conio.c rs232.c
CONTIKI_ASMFILES += uip_arch-asm.S CONTIKI_ASMFILES += uip_arch-asm.S
contiki-$(TARGET).o: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES) CONTIKI_HASMOBJECTFILES = ${addprefix $(OBJECTDIR)/,$(CONTIKI_HASMFILES:.hS=.o)}
CONTIKI_PLATFORM_DIRS = $(PLATFORM_APPDIRS) \
${addprefix $(CONTIKI)/platform/$(TARGET)/, $(CONTIKI_TARGET_DIRS)}
#".hS" suffix means assembler file with #include directive
#so that a developer can use definitions of C-style include file
#in assembler file. Make sure the header file contains only compiler
#directives. (i.e. #define, etc.)
vpath %.hS $(CONTIKI_PLATFORM_DIRS)
ifndef CUSTOM_RULE_HS_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.hS
cp $< $(OBJECTDIR)/$*.c
$(CC) $(CFLAGS) -E $(OBJECTDIR)/$*.c > $(OBJECTDIR)/tmp
perl -pe "s/^#(.*)/;$$1/" $(OBJECTDIR)/tmp > $(OBJECTDIR)/$*.S
$(AS) $(ASFLAGS) -o $@ $(OBJECTDIR)/$*.S
rm -f $(OBJECTDIR)/tmp
endif
#CUSTOM_RULE_ALLOBJS_TO_TARGETLIB
contiki-$(TARGET).o: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES) $(CONTIKI_HASMOBJECTFILES)
for target in $^; do $(AR) $(AROPTS) $@ $$target; done for target in $^; do $(AR) $(AROPTS) $@ $$target; done
#CUSTOM_RULE_LINK
contiki.ihex: contiki-$(TARGET).o contiki.ihex: contiki-$(TARGET).o
$(LD) $(LDFLAGS) -DAUTOSTART_ENABLE $(CONTIKI_TARGET_MAIN) -lcontiki-$(TARGET).o -o $@ $(LD) $(LDFLAGS) -DAUTOSTART_ENABLE $(CONTIKI_TARGET_MAIN) -lcontiki-$(TARGET).o -o $@