0

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?

4

1 回答 1

1

你在做什么是正确的。如果您从命令行运行“sdl-config --cflags”,它是否有效或者您是否获得了使用行?调试脚本问题的最佳方法是从 shell 提示符运行脚本。如果它在那里工作,它也将在 make 中工作。

于 2013-06-11T20:37:58.250 回答