The SDCC user guide says that SDCC can compile only one file at a time.
How can I write a makefile in order to compile a whole project, made of several source files?
I need something like the makefile used with Visual Studio in order to use an external compiler.
It's all there in the manual of your chosen make utility and SDCC's manual. Define CC to point to sdcc for compiling (use -c). Define LINK or whatever to point to sdcc for linking. And construct dependency rules for .rel or .o objects from .c files using CC and a rule for the .ihx (or .s19 or whatever) file from the objects.
The following is a Makefile i've used in a small project. Maybe this could be of some inspiration for you.
CFLAGS = --model-large --xram-size 1792
CC = /usr/bin/sdcc
dcf77 : adcom.rel dispport.rel
$(CC) $(CFLAGS) -o dcf77.hex main.c dispport.rel
adcom.rel : adcom.c adcom.h
$(CC) $(CFLAGS) -c adcom.c
dispport.rel : dispport.c dispport.h
$(CC) $(CFLAGS) -c dispport.c
Log in to post a comment.