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_MMIO_CONF
26 ifdef PCI_HAVE_PM_ECAM
31 ifdef PCI_HAVE_PM_DUMP
35 ifdef PCI_HAVE_PM_FBSD_DEVICE
37 CFLAGS
+= -I
/usr
/src
/sys
39 CFLAGS
+= -I
${FREEBSD_SYS}
43 ifdef PCI_HAVE_PM_OBSD_DEVICE
47 ifdef PCI_HAVE_PM_AIX_DEVICE
51 ifdef PCI_HAVE_PM_NBSD_LIBPCI
55 ifdef PCI_HAVE_PM_DARWIN_DEVICE
59 ifdef PCI_HAVE_PM_SYLIXOS_DEVICE
60 OBJS
+= sylixos-device
63 ifdef PCI_HAVE_PM_HURD_CONF
67 ifdef PCI_HAVE_PM_WIN32_CFGMGR32
69 OBJS
+= win32-cfgmgr32
72 ifdef PCI_HAVE_PM_WIN32_KLDBG
76 ifdef PCI_HAVE_PM_WIN32_SYSDBG
92 ifdef PCI_HAVE_PM_AOS_EXPANSION
96 all: $(PCILIB
) $(PCILIBPC
)
99 $(PCILIB
): $(addsuffix .o
,$(OBJS
))
105 all: $(PCIIMPDEF
) $(PCIIMPLIB
)
106 build.def
: $(PCIIMPDEF
)
107 $(PCIIMPDEF
): libpci.ver ver2def.pl
108 perl ver2def.pl libpci.ver
$(PCILIB
) build.def
$(PCIIMPDEF
)
109 $(PCIIMPLIB
): $(PCIIMPDEF
)
110 $(DLLTOOL
) --input-def
$< --output-lib
$@
112 dllrsrc.rc
: winrsrc.rc.in
113 sed
<$< >$@
-e
's,@PCILIB_VERSION@,$(PCILIB_VERSION),' \
114 -e
's,@PCILIB_VERSION_WINRC@,$(subst .,\$(comma),$(PCILIB_VERSION).0),' \
115 -e
's,@FILENAME@,$(PCILIB),' \
116 -e
's,@DESCRIPTION@,libpci,' \
117 -e
's,@LIBRARY_BUILD@,1,' \
118 -e
's,@DEBUG_BUILD@,$(if $(findstring -g,$(CFLAGS)),1,0),'
119 dllrsrc.o
: dllrsrc.rc
120 $(WINDRES
) --input
=$< --output
=$@
--input-format
=rc
--output-format
=coff
123 CFLAGS
+= -fPIC
-fvisibility
=hidden
124 $(PCILIB
): $(addsuffix .o
,$(OBJS
))
125 $(CC
) -shared
$(CFLAGS
) $(LDFLAGS
) $(PCILIB_LDFLAGS
) -o
$@
$^
$(LIB_LDLIBS
)
131 $(PCILIBPC
): libpci.
pc.in
132 sed
<$< >$@
-e
's,@PREFIX@,$(PREFIX),' \
133 -e
's,@INCDIR@,$(INCDIR),' \
134 -e
's,@LIBDIR@,$(LIBDIR),' \
135 -e
's,@IDSDIR@,$(IDSDIR),' \
136 -e
's,@VERSION@,$(VERSION),' \
137 -e
's,@LDLIBS@,$(LDLIBS),' \
138 -e
's,@WITH_LIBS@,$(WITH_LIBS),'
140 init.o
: init.c
$(INCL
)
141 access.o
: access.c
$(INCL
)
142 params.o
: params.c
$(INCL
)
143 i386-ports.o
: i386-ports.c
$(INCL
) i386-io-access.h i386-io-beos.h i386-io-cygwin.h i386-io-djgpp.h i386-io-haiku.h i386-io-hurd.h i386-io-linux.h i386-io-openbsd.h i386-io-sunos.h i386-io-windows.h
144 mmio-ports.o
: mmio-ports.c
$(INCL
) physmem.h physmem-access.h
145 ecam.o
: ecam.c
$(INCL
) physmem.h physmem-access.h
146 proc.o
: proc.c
$(INCL
)
147 sysfs.o
: sysfs.c
$(INCL
)
148 generic.o
: generic.c
$(INCL
)
149 emulated.o
: emulated.c
$(INCL
)
150 syscalls.o
: syscalls.c
$(INCL
)
151 obsd-device.o
: obsd-device.c
$(INCL
)
152 fbsd-device.o
: fbsd-device.c
$(INCL
)
153 aix-device.o
: aix-device.c
$(INCL
)
154 dump.o
: dump.c
$(INCL
)
155 names.o
: names.c
$(INCL
) names.h
156 names-cache.o
: names-cache.c
$(INCL
) names.h
157 names-hash.o
: names-hash.c
$(INCL
) names.h
158 names-net.o
: names-net.c
$(INCL
) names.h
159 names-parse.o
: names-parse.c
$(INCL
) names.h
160 names-hwdb.o
: names-hwdb.c
$(INCL
) names.h
161 filter.o
: filter.c
$(INCL
)
162 nbsd-libpci.o
: nbsd-libpci.c
$(INCL
)
163 hurd.o
: hurd.c
$(INCL
)
164 win32-helpers.o
: win32-helpers.c
$(INCL
) win32-helpers.h
165 win32-cfgmgr32.o
: win32-cfgmgr32.c
$(INCL
) win32-helpers.h
166 win32-kldbg.o
: win32-kldbg.c
$(INCL
) win32-helpers.h
167 win32-sysdbg.o
: win32-sysdbg.c
$(INCL
) win32-helpers.h
168 i386-io-windows.h
: win32-helpers.h
170 # MinGW32 toolchain has some required Win32 header files in /ddk subdirectory.
171 # But these header files include another header files from /ddk subdirectory
172 # and expect that build system has already set /ddk subdirectory into includes.
173 # So include /ddk subdirectory of each system predefined include path via -I.
174 ifdef PCI_HAVE_PM_WIN32_CFGMGR32
175 DDKCFLAGS
:=$(shell echo |
$(CC
) $(CFLAGS
) -E
-Wp
,-v
-o
/dev
/null
- 2>&1 | sed
-n
's/^ \(.*\)/-I\1\/ddk/p')
176 win32-cfgmgr32.o
: override CFLAGS
+=$(DDKCFLAGS
)