I'm trying to be a bit more grown-up with how I organise my projects. My game system has a library that contains all the hardware abstractions and currently I just copy it into the folder for each game I make. This has resulted in about 6 different versions of SPIKE.h and SPIKE.c where I make small improvements with each new game.
So, to that end I have created a separate repository for my library.
In my Makefile I've added a variable that points to the path, and added that to my compiler invocation with the -I parameter, but it doesn't work. I'm still not very experienced working with C.
SPIKELIB = ../spikelib
COMPILE = avr-gcc -Wall -O3 -mmcu=$(DEVICE) $(C_FLAGS) -I$(SPIKELIB)
I get 2 different errors depending on how I modify my Makefile. If I leave everything as-is except for adding the -I param, I get the error:
make: *** No rule to make target 'SPIKE.o', needed by 'main.elf'. Stop.
If I remove SPIKE.o from the list of objects to build, I get errors complaining that there are undefined references to functions that are defined in SPIKE.
I'm only just at the point where I'm comfortable using separate files for my code, putting them in different folders is just beyond reach :(