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