Hi, > http://www.pascalschmidt.de/cc65/Makefile Some remarks: 1. Based on the scenario in which the Makefile is used one would remove everything above the '####' line and rather supply those values on the GNU make cmdline. That would then bring it quite close to the "universal" idea pointed out in postings above. 2. If actually using the Makefile one should turn it somewhat less verbose by prefixing the last three commands in the C source file compilation recipe with a '@'. 3. Even if the Makefile shouldn't be readable well after going through some email formatting I'm reproducing it below (with the '@'s) for the sake of the completeness of the mailing list archive... SOURCEDIR := src OBJECTDIR := obj PROGRAM := foobar CFLAGS := -O ASFLAGS := LDFLAGS := ################################################################################ CC := $(CC65_HOME)/bin/cc65 CA := $(CC65_HOME)/bin/ca65 LD := $(CC65_HOME)/bin/ld65 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 $< -o $(@:.o=.s) @$(CA) -t $(CC65_TARGET) $(@:.o=.s) -o $@ @sed -e"s!.s:!.o:!p" -e"s![^\t]*\t\(.*\)!\1:!" < $(@:.o=.u) > $(@:.o=.d) @rm -f $(@:.o=.s) $(@:.o=.u) $(OBJECTDIR)/%.o: $(SOURCEDIR)/%.s | $(OBJECTDIR) $(CA) -t $(CC65_TARGET) -I $(SOURCEDIR) $(ASFLAGS) $< -o $@ $(PROGRAM): $(OBJECTS) $(LD) -t $(CC65_TARGET) $(LDFLAGS) $^ $(CC65_TARGET).lib -m $@.map -o $@ 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 Thu Apr 22 12:10:04 2010
This archive was generated by hypermail 2.1.8 : 2010-04-22 12:10:06 CEST