1727ce158SMartin Mares# Makefile for The PCI Library 2ac357d3bSMartin Mares# (c) 1999--2014 Martin Mares <[email protected]> 3727ce158SMartin Mares 4538a2423SMartin Mares# Expects to be invoked from the top-level Makefile and uses lots of its variables. 5727ce158SMartin Mares 6ac357d3bSMartin MaresOBJS=init access generic dump names filter names-hash names-parse names-net names-cache names-hwdb params caps 7489233b4SMartin MaresINCL=internal.h pci.h config.h header.h sysdep.h types.h 8727ce158SMartin Mares 9489233b4SMartin Maresifdef PCI_HAVE_PM_LINUX_SYSFS 10d7ea742cSMartin MaresOBJS += sysfs 1111f7b31bSMartin Maresendif 1211f7b31bSMartin Mares 13489233b4SMartin Maresifdef PCI_HAVE_PM_LINUX_PROC 14d7ea742cSMartin MaresOBJS += proc 15727ce158SMartin Maresendif 16727ce158SMartin Mares 17489233b4SMartin Maresifdef PCI_HAVE_PM_INTEL_CONF 18d7ea742cSMartin MaresOBJS += i386-ports 19727ce158SMartin Maresendif 20727ce158SMartin Mares 21489233b4SMartin Maresifdef PCI_HAVE_PM_DUMP 22d7ea742cSMartin MaresOBJS += dump 23727ce158SMartin Maresendif 24727ce158SMartin Mares 25489233b4SMartin Maresifdef PCI_HAVE_PM_FBSD_DEVICE 26d7ea742cSMartin MaresOBJS += fbsd-device 27168b4f46SMartin MaresCFLAGS += -I/usr/src/sys 2845902995SMartin Maresifdef FREEBSD_SYS 2945902995SMartin MaresCFLAGS += -I${FREEBSD_SYS} 3045902995SMartin Maresendif 31168b4f46SMartin Maresendif 32168b4f46SMartin Mares 33b6359063SMartin Maresifdef PCI_HAVE_PM_OBSD_DEVICE 34d7ea742cSMartin MaresOBJS += obsd-device 35b6359063SMartin Maresendif 36b6359063SMartin Mares 37489233b4SMartin Maresifdef PCI_HAVE_PM_AIX_DEVICE 38d7ea742cSMartin MaresOBJS += aix-device 3914d6c0a3SMartin Maresendif 4014d6c0a3SMartin Mares 41489233b4SMartin Maresifdef PCI_HAVE_PM_NBSD_LIBPCI 42d7ea742cSMartin MaresOBJS += nbsd-libpci 43848b4347SMartin Maresendif 44848b4347SMartin Mares 457cb1afbeSRichard Yaoifdef PCI_HAVE_PM_DARWIN_DEVICE 46a54d4bd1SMartin MaresOBJS += darwin 477cb1afbeSRichard Yaoendif 487cb1afbeSRichard Yao 490547ded8SGongYuJianifdef PCI_HAVE_PM_SYLIXOS_DEVICE 500547ded8SGongYuJianOBJS += sylixos-device 510547ded8SGongYuJianendif 520547ded8SGongYuJian 530a913370SJoan Lledóifdef PCI_HAVE_PM_HURD_CONF 540a913370SJoan LledóOBJS += hurd 550a913370SJoan Lledóendif 560a913370SJoan Lledó 5726c8b543SPali Rohárifdef PCI_HAVE_PM_WIN32_CFGMGR32 5826c8b543SPali RohárOBJS += emulated 5926c8b543SPali RohárOBJS += win32-cfgmgr32 6026c8b543SPali Rohárendif 6126c8b543SPali Rohár 625670e427SMartin Maresall: $(PCILIB) $(PCILIBPC) 63727ce158SMartin Mares 64d7ea742cSMartin Maresifeq ($(SHARED),no) 65d7ea742cSMartin Mares$(PCILIB): $(addsuffix .o,$(OBJS)) 66727ce158SMartin Mares rm -f $@ 67325a3c50SMartin Mares $(AR) rcs $@ $^ 68325a3c50SMartin Mares $(RANLIB) $@ 69d7ea742cSMartin Mareselse 702f421184SMartin MaresCFLAGS += -fPIC -fvisibility=hidden 71d7ea742cSMartin Mares$(PCILIB): $(addsuffix .o,$(OBJS)) 72*a65bb452SPali Rohár $(CC) -shared $(CFLAGS) $(LDFLAGS) $(PCILIB_LDFLAGS) -o $@ $^ $(LIB_LDLIBS) 738d1cb3d7SRichard Yaoendif 74727ce158SMartin Mares 75d7ea742cSMartin Mares$(PCILIBPC): libpci.pc.in 765670e427SMartin Mares sed <$< >$@ -e 's,@PREFIX@,$(PREFIX),' \ 775670e427SMartin Mares -e 's,@INCDIR@,$(INCDIR),' \ 785670e427SMartin Mares -e 's,@LIBDIR@,$(LIBDIR),' \ 795670e427SMartin Mares -e 's,@IDSDIR@,$(IDSDIR),' \ 805670e427SMartin Mares -e 's,@VERSION@,$(VERSION),' \ 81a6665cfbSBrice Goglin -e 's,@LDLIBS@,$(LDLIBS),' \ 82a6665cfbSBrice Goglin -e 's,@WITH_LIBS@,$(WITH_LIBS),' 835670e427SMartin Mares 844dd39346SMartin Maresinit.o: init.c $(INCL) 85727ce158SMartin Maresaccess.o: access.c $(INCL) 86d6dcc545SMartin Maresparams.o: params.c $(INCL) 87550d67d1SMartin Maresi386-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 8811f7b31bSMartin Maresproc.o: proc.c $(INCL) pread.h 8911f7b31bSMartin Maressysfs.o: sysfs.c $(INCL) pread.h 90727ce158SMartin Maresgeneric.o: generic.c $(INCL) 9108609192SPali Roháremulated.o: emulated.c $(INCL) 92727ce158SMartin Maressyscalls.o: syscalls.c $(INCL) 9338a9e3c3SMartin Maresobsd-device.o: obsd-device.c $(INCL) 94168b4f46SMartin Maresfbsd-device.o: fbsd-device.c $(INCL) 9514d6c0a3SMartin Maresaix-device.o: aix-device.c $(INCL) 96727ce158SMartin Maresdump.o: dump.c $(INCL) 97752d4d9aSMartin Maresnames.o: names.c $(INCL) names.h 98752d4d9aSMartin Maresnames-cache.o: names-cache.c $(INCL) names.h 99752d4d9aSMartin Maresnames-hash.o: names-hash.c $(INCL) names.h 100752d4d9aSMartin Maresnames-net.o: names-net.c $(INCL) names.h 101752d4d9aSMartin Maresnames-parse.o: names-parse.c $(INCL) names.h 102ac357d3bSMartin Maresnames-hwdb.o: names-hwdb.c $(INCL) names.h 103727ce158SMartin Maresfilter.o: filter.c $(INCL) 104848b4347SMartin Maresnbsd-libpci.o: nbsd-libpci.c $(INCL) 1050a913370SJoan Lledóhurd.o: hurd.c $(INCL) 10626c8b543SPali Rohárwin32-cfgmgr32.o: win32-cfgmgr32.c $(INCL) 10726c8b543SPali Rohár 10826c8b543SPali Rohár# MinGW32 toolchain has some required Win32 header files in /ddk subdirectory. 10926c8b543SPali Rohár# But these header files include another header files from /ddk subdirectory 11026c8b543SPali Rohár# and expect that build system has already set /ddk subdirectory into includes. 11126c8b543SPali Rohár# So include /ddk subdirectory of each system predefined include path via -I. 11226c8b543SPali Rohárifdef PCI_HAVE_PM_WIN32_CFGMGR32 11326c8b543SPali RohárDDKCFLAGS:=$(shell echo | $(CC) $(CFLAGS) -E -Wp,-v -o /dev/null - 2>&1 | sed -n 's/^ \(.*\)/-I\1\/ddk/p') 11426c8b543SPali Rohárwin32-cfgmgr32.o: override CFLAGS+=$(DDKCFLAGS) 11526c8b543SPali Rohárendif 116