xref: /pciutils/lib/Makefile (revision a6665cfb)
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ó
575670e427SMartin Maresall: $(PCILIB) $(PCILIBPC)
58727ce158SMartin Mares
59d7ea742cSMartin Maresifeq ($(SHARED),no)
60d7ea742cSMartin Mares$(PCILIB): $(addsuffix .o,$(OBJS))
61727ce158SMartin Mares	rm -f $@
62325a3c50SMartin Mares	$(AR) rcs $@ $^
63325a3c50SMartin Mares	$(RANLIB) $@
64d7ea742cSMartin Mareselse
652f421184SMartin MaresCFLAGS += -fPIC -fvisibility=hidden
66d7ea742cSMartin Mares$(PCILIB): $(addsuffix .o,$(OBJS))
678d1cb3d7SRichard Yao ifdef PCI_HAVE_PM_DARWIN_DEVICE
688d1cb3d7SRichard Yao	$(CC) -shared $(LDFLAGS) $(SONAME) -Wl,-install_name,$(LIBDIR)/$(PCILIB) -o $@ $^ $(LIB_LDLIBS)
698d1cb3d7SRichard Yao else
70e1a54852SMike Frysinger	$(CC) -shared $(LDFLAGS) $(SONAME) -Wl,--version-script=libpci.ver -o $@ $^ $(LIB_LDLIBS)
71d7ea742cSMartin Mares endif
728d1cb3d7SRichard Yaoendif
73727ce158SMartin Mares
74d7ea742cSMartin Mares$(PCILIBPC): libpci.pc.in
755670e427SMartin Mares	sed <$< >$@ -e 's,@PREFIX@,$(PREFIX),' \
765670e427SMartin Mares		-e 's,@INCDIR@,$(INCDIR),' \
775670e427SMartin Mares		-e 's,@LIBDIR@,$(LIBDIR),' \
785670e427SMartin Mares		-e 's,@IDSDIR@,$(IDSDIR),' \
795670e427SMartin Mares		-e 's,@VERSION@,$(VERSION),' \
80*a6665cfbSBrice Goglin		-e 's,@LDLIBS@,$(LDLIBS),' \
81*a6665cfbSBrice Goglin		-e 's,@WITH_LIBS@,$(WITH_LIBS),'
825670e427SMartin Mares
834dd39346SMartin Maresinit.o: init.c $(INCL)
84727ce158SMartin Maresaccess.o: access.c $(INCL)
85d6dcc545SMartin Maresparams.o: params.c $(INCL)
86550d67d1SMartin 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
8711f7b31bSMartin Maresproc.o: proc.c $(INCL) pread.h
8811f7b31bSMartin Maressysfs.o: sysfs.c $(INCL) pread.h
89727ce158SMartin Maresgeneric.o: generic.c $(INCL)
90727ce158SMartin Maressyscalls.o: syscalls.c $(INCL)
9138a9e3c3SMartin Maresobsd-device.o: obsd-device.c $(INCL)
92168b4f46SMartin Maresfbsd-device.o: fbsd-device.c $(INCL)
9314d6c0a3SMartin Maresaix-device.o: aix-device.c $(INCL)
94727ce158SMartin Maresdump.o: dump.c $(INCL)
95752d4d9aSMartin Maresnames.o: names.c $(INCL) names.h
96752d4d9aSMartin Maresnames-cache.o: names-cache.c $(INCL) names.h
97752d4d9aSMartin Maresnames-hash.o: names-hash.c $(INCL) names.h
98752d4d9aSMartin Maresnames-net.o: names-net.c $(INCL) names.h
99752d4d9aSMartin Maresnames-parse.o: names-parse.c $(INCL) names.h
100ac357d3bSMartin Maresnames-hwdb.o: names-hwdb.c $(INCL) names.h
101727ce158SMartin Maresfilter.o: filter.c $(INCL)
102848b4347SMartin Maresnbsd-libpci.o: nbsd-libpci.c $(INCL)
1030a913370SJoan Lledóhurd.o: hurd.c $(INCL)
104