1# Makefile for The PCI Library 2# (c) 1999--2014 Martin Mares <[email protected]> 3 4# Expects to be invoked from the top-level Makefile and uses lots of its variables. 5 6OBJS=init access generic dump names filter names-hash names-parse names-net names-cache names-hwdb params caps 7INCL=internal.h pci.h config.h header.h sysdep.h types.h 8 9ifdef PCI_HAVE_PM_LINUX_SYSFS 10OBJS += sysfs 11endif 12 13ifdef PCI_HAVE_PM_LINUX_PROC 14OBJS += proc 15endif 16 17ifdef PCI_HAVE_PM_INTEL_CONF 18OBJS += i386-ports 19endif 20 21ifdef PCI_HAVE_PM_DUMP 22OBJS += dump 23endif 24 25ifdef PCI_HAVE_PM_FBSD_DEVICE 26OBJS += fbsd-device 27CFLAGS += -I/usr/src/sys 28ifdef FREEBSD_SYS 29CFLAGS += -I${FREEBSD_SYS} 30endif 31endif 32 33ifdef PCI_HAVE_PM_OBSD_DEVICE 34OBJS += obsd-device 35endif 36 37ifdef PCI_HAVE_PM_AIX_DEVICE 38OBJS += aix-device 39endif 40 41ifdef PCI_HAVE_PM_NBSD_LIBPCI 42OBJS += nbsd-libpci 43endif 44 45ifdef PCI_HAVE_PM_DARWIN_DEVICE 46OBJS += darwin 47endif 48 49ifdef PCI_HAVE_PM_SYLIXOS_DEVICE 50OBJS += sylixos-device 51endif 52 53ifdef PCI_HAVE_PM_HURD_CONF 54OBJS += hurd 55endif 56 57ifdef PCI_HAVE_PM_WIN32_CFGMGR32 58OBJS += emulated 59OBJS += win32-cfgmgr32 60endif 61 62ifdef PCI_HAVE_PM_WIN32_SYSDBG 63OBJS += win32-sysdbg 64endif 65 66all: $(PCILIB) $(PCILIBPC) 67 68ifeq ($(SHARED),no) 69$(PCILIB): $(addsuffix .o,$(OBJS)) 70 rm -f $@ 71 $(AR) rcs $@ $^ 72 $(RANLIB) $@ 73else 74CFLAGS += -fPIC -fvisibility=hidden 75$(PCILIB): $(addsuffix .o,$(OBJS)) 76 ifdef PCI_HAVE_PM_DARWIN_DEVICE 77 $(CC) -shared $(LDFLAGS) $(SONAME) -Wl,-install_name,$(LIBDIR)/$(PCILIB) -o $@ $^ $(LIB_LDLIBS) 78 else 79 $(CC) -shared $(LDFLAGS) $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS) 80 endif 81endif 82 83$(PCILIBPC): libpci.pc.in 84 sed <$< >$@ -e 's,@PREFIX@,$(PREFIX),' \ 85 -e 's,@INCDIR@,$(INCDIR),' \ 86 -e 's,@LIBDIR@,$(LIBDIR),' \ 87 -e 's,@IDSDIR@,$(IDSDIR),' \ 88 -e 's,@VERSION@,$(VERSION),' \ 89 -e 's,@LDLIBS@,$(LDLIBS),' \ 90 -e 's,@WITH_LIBS@,$(WITH_LIBS),' 91 92init.o: init.c $(INCL) 93access.o: access.c $(INCL) 94params.o: params.c $(INCL) 95i386-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 96proc.o: proc.c $(INCL) pread.h 97sysfs.o: sysfs.c $(INCL) pread.h 98generic.o: generic.c $(INCL) 99emulated.o: emulated.c $(INCL) 100syscalls.o: syscalls.c $(INCL) 101obsd-device.o: obsd-device.c $(INCL) 102fbsd-device.o: fbsd-device.c $(INCL) 103aix-device.o: aix-device.c $(INCL) 104dump.o: dump.c $(INCL) 105names.o: names.c $(INCL) names.h 106names-cache.o: names-cache.c $(INCL) names.h 107names-hash.o: names-hash.c $(INCL) names.h 108names-net.o: names-net.c $(INCL) names.h 109names-parse.o: names-parse.c $(INCL) names.h 110names-hwdb.o: names-hwdb.c $(INCL) names.h 111filter.o: filter.c $(INCL) 112nbsd-libpci.o: nbsd-libpci.c $(INCL) 113hurd.o: hurd.c $(INCL) 114win32-cfgmgr32.o: win32-cfgmgr32.c $(INCL) 115win32-sysdbg.o: win32-sysdbg.c $(INCL) 116 117# MinGW32 toolchain has some required Win32 header files in /ddk subdirectory. 118# But these header files include another header files from /ddk subdirectory 119# and expect that build system has already set /ddk subdirectory into includes. 120# So include /ddk subdirectory of each system predefined include path via -I. 121ifdef PCI_HAVE_PM_WIN32_CFGMGR32 122DDKCFLAGS:=$(shell echo | $(CC) $(CFLAGS) -E -Wp,-v -o /dev/null - 2>&1 | sed -n 's/^ \(.*\)/-I\1\/ddk/p') 123win32-cfgmgr32.o: override CFLAGS+=$(DDKCFLAGS) 124endif 125