Reputation: 5
So, I have a simple c program on my Raspberry Pi, that is using the GPIO pins. When I compile it, i have to add -l bcm2835
after the gcc for the library of the GPIO.
Now I have another program which I have to compile with make, so I have to edit my Makefile to include this bcm2835
library.
I know the basics of a makefile but wherever I try to put it in my makefile, it's not working.
Can I have a simple answer to where I have to edit my makefile, it would be highly appreciated.
Upvotes: 0
Views: 473
Reputation: 1538
You can pass it as you would with any other flag.
#makefile
CC=gcc
CFLAGS= -g -c -Wall
MYLIB= -lbcm2835
program: dependencies
< TAB IT!>${CC} ${CFLAGS} ${MYLIB} -o Obj dependencies
Upvotes: 1