Hi, > http://www.pascalschmidt.de/cc65/Makefile Now that I understand how to use cl65 the right way I changed the Makefile to do so thus turning it somewhat cleaner. Some more notes: - The -I $(SOURCEDIR) compiler option reflects the recent discussion about where #include "" searches for files. cc65 goes for the current directory and not for the directory of the file containing the #include directive. - Before the sed script just replaced .s with .o but now it replaces $(<:.c=.s) with $@ because it's not only about the file extension anymore but about the (later deleted) .s file residing in the source directory. - When using cl65 for compiling it seemed cleaner to use it as well for assembling and linking. Regards, Oliver SOURCEDIR := src OBJECTDIR := obj PROGRAM := foobar CFLAGS := -O ASFLAGS := LDFLAGS := ################################################################################ CC := $(CC65_HOME)/bin/cl65 SOURCES := $(wildcard $(SOURCEDIR)/*.c) DEPENDS := $(addsuffix .d,$(basename $(addprefix $(OBJECTDIR)/,$(notdir $(SOURCES))))) SOURCES += $(wildcard $(SOURCEDIR)/*.s) OBJECTS := $(addsuffix .o,$(basename $(addprefix $(OBJECTDIR)/,$(notdir $(SOURCES))))) .SUFFIXES: .PHONY: all clean all: $(PROGRAM) ifneq ($(MAKECMDGOALS),clean) -include $(DEPENDS) endif $(OBJECTDIR): mkdir $@ $(OBJECTDIR)/%.o: $(SOURCEDIR)/%.c | $(OBJECTDIR) $(CC) -t $(CC65_TARGET) -I $(SOURCEDIR) $(CFLAGS) --create-dep -c -o $@ $< @sed -e"s!$(<:.c=.s)!$@!p" -e"s![^\t]*\t\(.*\)!\1:!" < $(<:.c=.u) > $(@:.o=.d) @rm -f $(<:.c=.u) $(OBJECTDIR)/%.o: $(SOURCEDIR)/%.s | $(OBJECTDIR) $(CC) -t $(CC65_TARGET) -I $(SOURCEDIR) $(ASFLAGS) -c -o $@ $< $(PROGRAM): $(OBJECTS) $(CC) -t $(CC65_TARGET) $(LDFLAGS) -o $@ -m $@.map $^ clean: rm -f $(OBJECTS) $(DEPENDS) $(PROGRAM) $(PROGRAM).map rmdir $(OBJECTDIR) ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Fri Apr 23 00:05:05 2010
This archive was generated by hypermail 2.1.8 : 2010-04-23 00:05:07 CEST