makefile - Make file targetting all C files in a directory -


i want make shared library settings using pkg-config applied when ".c" file compiled inside directory. how access name of file in make rule?

for example, if these files in directory

foo1.c bar.c foobar.c 

if run make foobar, want object file foobar generated , linked shared library using options in pkg-config. don't want explicitly write rule each file, should able ".c/.h" file. think possible in make, i'm not sure of syntax.

if of c-files in directory don't depends on others, may write such makefile:

cc = gcc ldflags = -l... defines = -d... cflags = -wall -werror ...  %: %.c     $(cc) $(ldflags) $(cflags) $(defines) $< -o $@ 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -