1 ## $Id$ ---*- makefile -*---
3 ## Copyright (C) 2002, 2003, 2005, 2009
4 ## Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; version 2 and/or 3 of the License.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 BAD_INC_PATHS = /usr/include|/usr/local/include
21 BAD_LIB_PATHS = /usr/lib
23 pkgconfdir = $(libdir)/pkgconfig
24 pkgconf_DATA = $(addsuffix .pc, $(PKGCONFIG_FILES))
26 CLEANFILES += $(addsuffix .pc, $(PKGCONFIG_FILES))
27 EXTRA_DIST += $(addsuffix .pc.subst, $(PKGCONFIG_FILES))
29 pkgconf_SUBST = s!@'PACKAGE'@!$(PACKAGE)!g; \
30 s!@'VERSION'@!$(VERSION)!g; \
31 s!@'prefix'@!$(prefix)!g; \
32 s!@'exec_prefix'@!$(exec_prefix)!g; \
33 s!@'libdir'@!$(libdir)!g; \
34 s!@'includedir'@!$(includedir)!g; \
35 s!@'libflags"@!$${libflags}$(pkgconf_LIBFLAGS)!g;"' \
36 s!@'incflags"@!$${incflags}$(pkgconf_INCFLAGS)!g;"' \
37 s!@'pkgincflags"@!$${pkgincflags}$(pkgconf_PKGINCFLAGS)!g;"' \
38 s!@'pkgincludedir'@!$(pkgincludedir)!g
41 %.pc: %.pc.subst Makefile
43 @case '$(libdir)' in \
44 $(BAD_LIB_PATHS)) libflags=;; \
45 *) libflags='-L$${libdir} ';; \
47 case '$(pkgincludedir)' in \
48 $(BAD_INC_PATHS)) pkgincflags=;; \
49 *) pkgincflags='-I$${pkgincludedir} ';; \
51 case '$(includedir)' in \
52 $(BAD_INC_PATHS)) incflags=;; \
53 *) incflags='-I$${includedir} ';; \
55 sed -e '$(pkgconf_SUBST)' $< >$@
56 test -z "$(CHMOD_REFERENCE)" || $(CHMOD_REFERENCE) '$<' '$@'