How to include a file from another (parent) directory This is my structure
program/
  src/
    Makefile
    main.ino
    test.h
    ...
  lib/
    i2c.h

In main.ino I include test.h and in test.h I'm trying to include i2c.h but it is just not working, I keep getting:
make: *** No rule to make target 'i2c.h', needed by 'build-uno/main.ino.o'.  Stop.

I tried including like this
// test.h
#include &quot;../lib/i2c.h&quot;

I also tried making a symlink to my lib folder in arduino libraries and adding it as a library in Makefile
sudo ln -s /home/pi/program/lib /usr/share/arduino/libraries/GAVR
# Makefile
ARDUINO_DIR = /usr/share/arduino
BOARD_TAG = uno
ARDUINO_PORT = /dev/ttyAMA0
ARDUINO_LIBS = GAVR
include /usr/share/arduino/Arduino.mk

I also tried making a symlink to lib inside the src directory
ln -s /home/pi/program/lib /home/pi/program/src/lib
None of the above had any effect, the error message stays the same.
How can I include a file from another directory in my program?
This is definitely on the hacky side and not a proper solution to the problem, but it works nevertheless so I'm sharing it.
After making a symlink in the /usr/share/arduino/libraries directory you must make sure that there is a header file with the exact name of the directory, apparently that's how arduino is set up to include them.
In my case my symlink was named GAVR, so I had to create a GAVR.h file inside my lib directory, which would then go ahead and include my i2c.h file and possibly any other file that I'd need.
Also in test.h or anywhere I need to use i2c.h I must include &lt;GAVR.h&gt; instead.
Turns out Also 1 is false, you just need to include &lt;GAVR.h&gt; once in the .ino file and its members will be available everywhere, just like any other library.
Also 2, now that ARDUINO_LIBS is not empty in the Makefile you will need to manually declare all libraries that your code is using.