Shop OBEX P1 Docs P2 Docs Learn Events
Makefile noob — Parallax Forums

Makefile noob

OldFartRadiomanOldFartRadioman Posts: 30
edited 2013-11-12 12:21 in Propeller 1
Trying to port a library ( or at least functionality ) from PC GCC to Propgcc. The code compiles on the PC using this makefile:


mdc_test: mdc_test.c mdc_decode.o mdc_encode.o
cc -g -o mdc_test mdc_test.c mdc_decode.o mdc_encode.o
./mdc_test

mdc_decode.o: mdc_decode.c mdc_decode.h mdc_common.c
cc -c mdc_decode.c

mdc_encode.o: mdc_encode.c mdc_encode.h mdc_common.c
cc -c mdc_encode.c

clean:
rm -f mdc_decode.o mdc_encode.o mdc_test

This looks like just a straight forward multifile Make, any thoughts on how this would look for PropGCC? My last dealings with makefiles was in the heydays of the Amiga:smile: I have looked at the samples in the demo directory but quickly get lost in the maze of switches. The code will have to be highly modified to do anything useful on the Prop but I first have to get over the hurdle of getting my head around a multifile project.

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2013-11-12 08:30
    Try something like this:
    CC=propeller-elf-gcc
    CFLAGS=-mcmm -Os -Wall
    
    mdc_test: mdc_test.c mdc_decode.o mdc_encode.o
       $(CC) $(CFLAGS) -o mdc_test.elf mdc_test.c mdc_decode.o mdc_encode.o
       propeller-load mdc_test.elf -r -t
    
    mdc_decode.o: mdc_decode.c mdc_decode.h mdc_common.c
       $(CC) $(CFLAGS)  -c mdc_decode.c
    
    mdc_encode.o: mdc_encode.c mdc_encode.h mdc_common.c
       $(CC) $(CFLAGS)  -c mdc_encode.c
    
    clean:
       rm -f mdc_decode.o mdc_encode.o mdc_test.elf
    
    Note that the spaces at the beginnings of the lines within the rules should be actual hardware tab characters.
  • OldFartRadiomanOldFartRadioman Posts: 30
    edited 2013-11-12 11:44
    Thanks David! Compiles with just a couple of warnings. Makes me wish I had a Quickstart with me.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-11-12 12:21
    Glad it worked for you!
Sign In or Register to comment.