how to use pkg-config or something equivalent in makefile

Posted by make on Stack Overflow See other posts from Stack Overflow or by make
Published on 2010-03-12T14:22:23Z Indexed on 2010/03/12 15:07 UTC
Read the original article Hit count: 752

Filed under:
|
|
|
|

Hi ,

Could someone please tell us how to use pkg-config in Makefile. here is an exp:

`pkg-config --cflags --libs protobuf`

Makefile file

CXX = g++
CXXFLAGS = -Wall -ansi -pedantic -g
#
# I tried this line, but not working
PKGS = `pkg-config --cflags --libs protobuf`
#

ifeq ($(shell uname),SunOS)
  LIBS = -lsocket -lnsl
endif

all: file1.cpp 

file1: file1.cpp xx.pb.cc xx.pb.h
    $(CXX) $(CXXFLAGS) -o file1 file1.cpp xx.pb.cc $(LIBS) $(PKGS)

clean:
    $(RM) file1

Thanks for your help and replies -

© Stack Overflow or respective owner

Related posts about makefile

Related posts about pkg-config