Menu

SDCC Compiler and multiple files projects

djordj
2004-12-04
2013-03-12
  • djordj

    djordj - 2004-12-04

    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!

     
    • Maarten Brock

      Maarten Brock - 2004-12-06

      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.

       
    • RaceMouse

      RaceMouse - 2004-12-11

      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

       

Log in to post a comment.