On 2010-04-23, at 00:04, Oliver Schmidt wrote: > Hi, > >> http://www.pascalschmidt.de/cc65/Makefile First of all - thanks a lot for that! I checked and it seems to be working already quite well. > > Now that I understand how to use cl65 the right way I changed the > Makefile to do so thus turning it somewhat cleaner. > > [...] > > - When using cl65 for compiling it seemed cleaner to use it as well > for assembling and linking. So the first trick I never tried (I guess I didn't even notice that "Compile & Link" utility can be used as "Compile & Assemble Only" one) is to use cl65 rather than cc65/ca65, which makes it easier for the start. I added conditionals below so that default values are supplied instead of failing when some variables are not defined. Target choice is following the defaults of cc65 utilities. Few comments: - currently the objects get re-linked every time, even if no changes were made - using the cl65 instead of cc65/ca65 can (AFAIR) impose some limitations. I don't recall now what those are but if the same could be achieved with the cc/ca combo, then people could easier adapt the process using full power of the tools. The question - is that feasible? ********************************************************** PROGRAM := foobar SOURCEDIR := src OBJECTDIR := obj CFLAGS := ASFLAGS := LDFLAGS := ################################################################################ ifdef $(CC65_HOME) CC := $(CC65_HOME)/bin/cl65 else CC := cl65 endif ifndef $(CC65_TARGET) CC65_TARGET := c64 endif 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) -- SD! ---------------------------------------------------------------------- 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 12:12:16 2010
This archive was generated by hypermail 2.1.8 : 2010-04-23 12:12:19 CEST