I'm compiling a SDL program using a Makefile. Typically I can compile my SDL projects with gcc
like so:
# gcc -c test.c `sdl-config --cflags`
# gcc -o test test.o `sdl-config --libs`
# ./test
I'm having trouble executing sdl-config
in my Makefile however. This is what I have:
CFLAGS := $(shell sdl-config --cflags)
LDFLAGS := $(shell sdl-config --libs)
test : test.o
gcc $(CFLAGS) $(LDFLAGS) -o test test.o
test.o:
But I keep getting the sdl-config
usage line back rather than the respective output. I suspect the arguments (--cflags
and --libs
) are not being passed to sdl-config
.
How do I pass arguments to the shell
function? Is there a better way to achieve my end goal?