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.
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
Thanks!
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.
<Makefile>
CFLAGS = --model-large --xram-size 1792
CC = /usr/bin/sdcc
dcf77 : adcom.rel dispport.rel
$(CC) $(CFLAGS) -o dcf77.hex main.c dispport.rel
cat dcf77.mem
adcom.rel : adcom.c adcom.h
$(CC) $(CFLAGS) -c adcom.c
dispport.rel : dispport.c dispport.h
$(CC) $(CFLAGS) -c dispport.c
clean :
-rm *.rel
<!Makefile>
Regards
RaceMouse