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