Used SED to replace the assembler sources with the objects in the dependency file generated by the cc65 compiler. This allows to hide the assembler sources from GNU make which solves several issues. Now the cc65 toolchain behaves very similiar to gcc from the GNU make perspective.

This commit is contained in:
oliverschmidt 2007-04-21 13:23:47 +00:00
parent 48977bd89f
commit 5d62bbd039

View file

@ -29,7 +29,7 @@
# #
# Author: Oliver Schmidt <ol.sc@web.de> # Author: Oliver Schmidt <ol.sc@web.de>
# #
# $Id: Makefile.6502,v 1.4 2007/04/18 22:52:22 oliverschmidt Exp $ # $Id: Makefile.6502,v 1.5 2007/04/21 13:23:47 oliverschmidt Exp $
# #
####################### #######################
@ -58,8 +58,8 @@ LD = ld65
AR = ar65 AR = ar65
AFLAGS = -t $(TARGET) AFLAGS = -t $(TARGET)
CFLAGS += -t $(TARGET) -Or --create-dep $(INCLUDES) CFLAGS += -t $(TARGET) -Or $(INCLUDES)
LDFLAGS = -C $(CONTIKI)/platform/$(TARGET)/linker.cfg -m $(TARGET).map LDFLAGS = -C $(CONTIKI)/platform/$(TARGET)/linker.cfg -m contiki-$(TARGET).map
AROPTS = a AROPTS = a
CONTIKI_TARGET_MAIN = $(OBJECTDIR)/contiki-main.o CONTIKI_TARGET_MAIN = $(OBJECTDIR)/contiki-main.o
@ -75,27 +75,22 @@ $(OBJECTDIR)/%.o: %.S
@$(AS) $(AFLAGS) $< -o $@ @$(AS) $(AFLAGS) $< -o $@
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.s: %.c $(OBJECTDIR)/%.o: %.c
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) --create-dep $< -o $(@:.o=.s)
@mv $(@:.s=.u) $(@:.s=.d) @$(AS) $(AFLAGS) $(@:.o=.s) -o $@
$(OBJECTDIR)/%.o: $(OBJECTDIR)/%.s @sed 's!.s:!.o:!' < $(@:.o=.u) > $(@:.o=.d)
@$(AS) $(AFLAGS) $< -o $@ @rm -f $(@:.o=.s) $(@:.o=.u)
CUSTOM_RULE_C_TO_CO = 1 CUSTOM_RULE_C_TO_CO = 1
$(OBJECTDIR)/%.s: %.c %.co: %.c
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@ $(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $(@:.co=.s)
@mv $(@:.s=.u) $(@:.s=.d) @$(AS) $(AFLAGS) $(@:.co=.s) -o $@
%.co: $(OBJECTDIR)/%.s @rm -f $(@:.co=.s)
@$(AS) $(AFLAGS) $< -o $@
CUSTOM_RULE_C_TO_OBJECTDIR_D = 1 CUSTOM_RULE_C_TO_OBJECTDIR_D = 1
# No explicit dependency file generation necessary since it is done # No explicit dependency file generation necessary since it is done
# as compilation side effect using the --create-dep compiler option # as compilation side effect using the --create-dep compiler option
# Keep the assembler source files since they are the targets in the
# compiler generated dependency files
.SECONDARY:
################# #################
# Path Settings # # Path Settings #
################# #################