1 # Makefile for The PCI Library
2 # (c) 1999--2014 Martin Mares <mj@ucw.cz>
4 # Expects to be invoked from the top-level Makefile and uses lots of its variables.
6 OBJS=init access generic dump names filter names-hash names-parse names-net names-cache names-hwdb params caps
7 INCL=internal.h pci.h config.h header.h sysdep.h types.h
9 ifdef PCI_HAVE_PM_LINUX_SYSFS
13 ifdef PCI_HAVE_PM_LINUX_PROC
17 ifdef PCI_HAVE_PM_INTEL_CONF
21 ifdef PCI_HAVE_PM_DUMP
25 ifdef PCI_HAVE_PM_FBSD_DEVICE
27 CFLAGS += -I/usr/src/sys
29 CFLAGS += -I${FREEBSD_SYS}
33 ifdef PCI_HAVE_PM_OBSD_DEVICE
37 ifdef PCI_HAVE_PM_AIX_DEVICE
41 ifdef PCI_HAVE_PM_NBSD_LIBPCI
45 ifdef PCI_HAVE_PM_DARWIN_DEVICE
49 all: $(PCILIB) $(PCILIBPC)
52 $(PCILIB): $(addsuffix .o,$(OBJS))
57 CFLAGS += -fPIC -fvisibility=hidden
58 $(PCILIB): $(addsuffix .o,$(OBJS))
59 ifdef PCI_HAVE_PM_DARWIN_DEVICE
60 $(CC) -shared $(LDFLAGS) $(SONAME) -Wl,-install_name,$(LIBDIR)/$(PCILIB) -o $@ $^ $(LIB_LDLIBS)
62 $(CC) -shared $(LDFLAGS) $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS)
66 $(PCILIBPC): libpci.pc.in
67 sed <$< >$@ -e 's,@PREFIX@,$(PREFIX),' \
68 -e 's,@INCDIR@,$(INCDIR),' \
69 -e 's,@LIBDIR@,$(LIBDIR),' \
70 -e 's,@IDSDIR@,$(IDSDIR),' \
71 -e 's,@VERSION@,$(VERSION),' \
72 -e 's,@LDLIBS@,$(LDLIBS),'
74 init.o: init.c $(INCL)
75 access.o: access.c $(INCL)
76 params.o: params.c $(INCL)
77 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
78 proc.o: proc.c $(INCL) pread.h
79 sysfs.o: sysfs.c $(INCL) pread.h
80 generic.o: generic.c $(INCL)
81 syscalls.o: syscalls.c $(INCL)
82 obsd-device.o: obsd-device.c $(INCL)
83 fbsd-device.o: fbsd-device.c $(INCL)
84 aix-device.o: aix-device.c $(INCL)
85 dump.o: dump.c $(INCL)
86 names.o: names.c $(INCL) names.h
87 names-cache.o: names-cache.c $(INCL) names.h
88 names-hash.o: names-hash.c $(INCL) names.h
89 names-net.o: names-net.c $(INCL) names.h
90 names-parse.o: names-parse.c $(INCL) names.h
91 names-hwdb.o: names-hwdb.c $(INCL) names.h
92 filter.o: filter.c $(INCL)
93 nbsd-libpci.o: nbsd-libpci.c $(INCL)