SHAREDIR=$(PREFIX)/share
IDSDIR=$(SHAREDIR)
MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
-INCDIR=$(PREFIX)/include/pci
+INCDIR=$(PREFIX)/include
LIBDIR=$(PREFIX)/lib
+PKGCFDIR=$(LIBDIR)/pkgconfig
INSTALL=install
DIRINSTALL=install -d
PCILIB=lib/libpci.a
+PCILIBPC=lib/libpci.pc
PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h
PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
clean:
rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core -o -name "*.orig"`
- rm -f update-pciids lspci setpci lib/config.* lib/example *.8 pci.ids.*
+ rm -f update-pciids lspci setpci lib/config.* lib/example *.8 pci.ids.* lib/*.pc
rm -rf maint/dist
distclean: clean
$(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
$(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
-install-lib: $(PCIINC_INS) $(PCILIB)
- $(DIRINSTALL) -m 755 $(DESTDIR)$(INCDIR) $(DESTDIR)$(LIBDIR)
- $(INSTALL) -c -m 644 $(PCIINC_INS) $(DESTDIR)$(INCDIR)
+install-lib: $(PCIINC_INS) $(PCILIB) $(PCILIBPC)
+ $(DIRINSTALL) -m 755 $(DESTDIR)$(INCDIR)/pci $(DESTDIR)$(LIBDIR) $(DESTDIR)$(PKGCFDIR)
+ $(INSTALL) -c -m 644 $(PCIINC_INS) $(DESTDIR)$(INCDIR)/pci
$(INSTALL) -c -m 644 $(PCILIB) $(DESTDIR)$(LIBDIR)
+ $(INSTALL) -c -m 644 $(PCILIBPC) $(DESTDIR)$(PKGCFDIR)
uninstall: all
rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/update-pciids
config.h
config.mk
+libpci.pc
INCL=internal.h pci.h config.h header.h sysdep.h types.h
PCILIB=libpci.a
+PCILIBPC=libpci.pc
ifdef PCI_HAVE_PM_LINUX_SYSFS
OBJS += sysfs.o
PCILIB=libpciutils.a
endif
-all: $(PCILIB)
+all: $(PCILIB) $(PCILIBPC)
$(PCILIB): $(OBJS)
rm -f $@
ar rcs $@ $^
ranlib $@
+$(PCILIBPC): $(PCILIBPC).in
+ sed <$< >$@ -e 's,@PREFIX@,$(PREFIX),' \
+ -e 's,@INCDIR@,$(INCDIR),' \
+ -e 's,@LIBDIR@,$(LIBDIR),' \
+ -e 's,@IDSDIR@,$(IDSDIR),' \
+ -e 's,@VERSION@,$(VERSION),' \
+ -e 's,@LIBZ@,$(LIBZ),'
+
access.o: access.c $(INCL)
i386-ports.o: i386-ports.c $(INCL) i386-io-hurd.h i386-io-linux.h i386-io-sunos.h
proc.o: proc.c $(INCL) pread.h
if [ "$zlib" = yes ] ; then
echo >>$c '#define PCI_COMPRESSED_IDS'
echo >>$c '#define PCI_IDS "pci.ids.gz"'
- echo >>$m 'LDFLAGS+=-lz'
+ echo >>$m 'LIBZ=-lz'
+ echo >>$m 'LDFLAGS+=$(LIBZ)'
else
echo >>$c '#define PCI_IDS "pci.ids"'
fi