X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2FMakefile;h=31ca1c106ddc78149edd3ee2041846af4e5508a7;hb=d45531756b426fb883e78deb412be3c031bb7675;hp=87a87fdb93b644901585046fc51a2397c5fcf864;hpb=523d37617c95f9b2814067e3ce4b86cc12851684;p=pciutils.git diff --git a/lib/Makefile b/lib/Makefile index 87a87fd..31ca1c1 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,32 +1,29 @@ # Makefile for The PCI Library # (c) 1999--2008 Martin Mares -include config.mk +# Expects to be invoked from the top-level Makefile and uses lots of its variables. -OBJS=access.o generic.o dump.o names.o filter.o names-hash.o names-parse.o names-net.o names-cache.o +OBJS=init access generic dump names filter names-hash names-parse names-net names-cache params 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 +OBJS += sysfs endif ifdef PCI_HAVE_PM_LINUX_PROC -OBJS += proc.o +OBJS += proc endif ifdef PCI_HAVE_PM_INTEL_CONF -OBJS += i386-ports.o +OBJS += i386-ports endif ifdef PCI_HAVE_PM_DUMP -OBJS += dump.o +OBJS += dump endif ifdef PCI_HAVE_PM_FBSD_DEVICE -OBJS += fbsd-device.o +OBJS += fbsd-device CFLAGS += -I/usr/src/sys ifdef FREEBSD_SYS CFLAGS += -I${FREEBSD_SYS} @@ -34,35 +31,42 @@ endif endif ifdef PCI_HAVE_PM_OBSD_DEVICE -OBJS += obsd-device.o +OBJS += obsd-device endif ifdef PCI_HAVE_PM_AIX_DEVICE -OBJS += aix-device.o +OBJS += aix-device endif ifdef PCI_HAVE_PM_NBSD_LIBPCI -OBJS += nbsd-libpci.o -PCILIB=libpciutils.a +OBJS += nbsd-libpci endif all: $(PCILIB) $(PCILIBPC) -$(PCILIB): $(OBJS) +ifeq ($(SHARED),no) +$(PCILIB): $(addsuffix .o,$(OBJS)) rm -f $@ $(AR) rcs $@ $^ $(RANLIB) $@ +else +CFLAGS += -fPIC -fvisibility=hidden +$(PCILIB): $(addsuffix .o,$(OBJS)) + $(CC) -shared $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS) +endif -$(PCILIBPC): $(PCILIBPC).in +$(PCILIBPC): libpci.pc.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),' + -e 's,@LDLIBS@,$(LDLIBS),' +init.o: init.c $(INCL) access.o: access.c $(INCL) -i386-ports.o: i386-ports.c $(INCL) i386-io-hurd.h i386-io-linux.h i386-io-sunos.h i386-io-windows.h +params.o: params.c $(INCL) +i386-ports.o: i386-ports.c $(INCL) i386-io-hurd.h i386-io-linux.h i386-io-sunos.h i386-io-windows.h i386-io-cygwin.h proc.o: proc.c $(INCL) pread.h sysfs.o: sysfs.c $(INCL) pread.h generic.o: generic.c $(INCL) @@ -78,5 +82,3 @@ names-net.o: names-net.c $(INCL) names.h names-parse.o: names-parse.c $(INCL) names.h filter.o: filter.c $(INCL) nbsd-libpci.o: nbsd-libpci.c $(INCL) - -example: example.c $(PCILIB)