]> git.ipfire.org Git - thirdparty/pciutils.git/blame - Makefile
Fix spelling of MSI.
[thirdparty/pciutils.git] / Makefile
CommitLineData
4284af58 1# Makefile for The PCI Utilities
bb8c9863 2# (c) 1998--2008 Martin Mares <mj@ucw.cz>
98e39e09 3
54e13765 4OPT=-O2
3e9c7a18 5CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes
727ce158 6
8f2c17b7
MM
7VERSION=3.0.2
8DATE=2008-09-19
168b4f46 9
3b75e19a
MM
10# Host OS and release (override if you are cross-compiling)
11HOST=
12RELEASE=
13
14# Support for compressed pci.ids (yes/no, default: detect)
15ZLIB=
16
17# Support for resolving ID's by DNS (yes/no, default: detect)
18DNS=
19
d7ea742c
MM
20# Build libpci as a shared library (yes/no; or local for testing; requires GCC)
21SHARED=no
22
23# ABI version suffix in the name of the shared library
cec9f7e7 24ABI_VERSION=.3
d7ea742c 25
3b75e19a 26# Installation directories
c83293eb
MM
27PREFIX=/usr/local
28SBINDIR=$(PREFIX)/sbin
29SHAREDIR=$(PREFIX)/share
54e13765 30IDSDIR=$(SHAREDIR)
b0f1a03b 31MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
5670e427 32INCDIR=$(PREFIX)/include
3052f51e 33LIBDIR=$(PREFIX)/lib
5670e427 34PKGCFDIR=$(LIBDIR)/pkgconfig
3b75e19a
MM
35
36# Commands
14d6c0a3
MM
37INSTALL=install
38DIRINSTALL=install -d
3b75e19a 39STRIP=-s
325a3c50
MM
40AR=ar
41RANLIB=ranlib
3b75e19a 42
d7ea742c
MM
43# Base name of the library (overriden on NetBSD, which has its own libpci)
44LIBNAME=libpci
c83293eb 45
cc062b4a 46-include lib/config.mk
f6c86928 47
d7ea742c
MM
48PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h
49PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
50
727ce158
MM
51export
52
bc46bc39 53all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
727ce158 54
d7ea742c 55lib/$(PCILIB): $(PCIINC) force
727ce158 56 $(MAKE) -C lib all
e4842ff3 57
11f7b31b
MM
58force:
59
cc062b4a 60lib/config.h lib/config.mk:
3b75e19a 61 cd lib && ./configure
98e39e09 62
d7ea742c
MM
63lspci: lspci.o common.o lib/$(PCILIB)
64setpci: setpci.o common.o lib/$(PCILIB)
727ce158 65
4afd29d3
MM
66lspci.o: lspci.c pciutils.h $(PCIINC)
67setpci.o: setpci.c pciutils.h $(PCIINC)
68common.o: common.c pciutils.h $(PCIINC)
727ce158 69
1b95f396 70update-pciids: update-pciids.sh
cc062b4a
MM
71 sed <$< >$@ "s@^DEST=.*@DEST=$(IDSDIR)/$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@"
72 chmod +x $@
1b95f396 73
bc46bc39
MM
74# The example of use of libpci
75example: example.o lib/$(PCILIB)
76example.o: example.c $(PCIINC)
77
6cdb9d93
MM
78%: %.o
79 $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
80
f2bf13dc 81%.8 %.7: %.man
54e13765 82 M=`echo $(DATE) | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pciutils-$(VERSION)/;s#@IDSDIR@#$(IDSDIR)#"
98e39e09
MM
83
84clean:
c7f5314d 85 rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core -o -name "*.orig"`
bc46bc39 86 rm -f update-pciids lspci setpci example lib/config.* *.[78] pci.ids.* lib/*.pc lib/*.so lib/*.so.*
ab12277e
MM
87 rm -rf maint/dist
88
89distclean: clean
f17b962b
MM
90
91install: all
ee551b73 92# -c is ignored on Linux, but required on FreeBSD
cd73a9d0 93 $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7
27fa4e65 94 $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR)
f4ddb8d3 95 $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
cc062b4a 96 $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
f4ddb8d3 97 $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
f2bf13dc 98 $(INSTALL) -c -m 644 pcilib.7 $(DESTDIR)$(MANDIR)/man7
d7ea742c
MM
99ifeq ($(SHARED),yes)
100 $(DIRINSTALL) -m 755 $(DESTDIR)$(LIBDIR)
101 $(INSTALL) -c -m 644 lib/$(PCILIB) $(DESTDIR)$(LIBDIR)
349c0fe9 102 ln -sf $(PCILIB) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so$(ABI_VERSION)
d7ea742c 103endif
f17b962b 104
d7ea742c 105install-lib: $(PCIINC_INS) lib/$(PCILIB) lib/$(PCILIBPC)
5670e427
MM
106 $(DIRINSTALL) -m 755 $(DESTDIR)$(INCDIR)/pci $(DESTDIR)$(LIBDIR) $(DESTDIR)$(PKGCFDIR)
107 $(INSTALL) -c -m 644 $(PCIINC_INS) $(DESTDIR)$(INCDIR)/pci
d7ea742c
MM
108 $(INSTALL) -c -m 644 lib/$(PCILIB) $(DESTDIR)$(LIBDIR)
109 $(INSTALL) -c -m 644 lib/$(PCILIBPC) $(DESTDIR)$(PKGCFDIR)
349c0fe9
MM
110ifeq ($(SHARED),yes)
111 ln -sf $(LIBNAME).so$(ABI_VERSION) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so
112endif
3052f51e 113
82ce97c9 114uninstall: all
f4ddb8d3 115 rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/update-pciids
cc062b4a 116 rm -f $(DESTDIR)$(IDSDIR)/$(PCI_IDS)
f4ddb8d3 117 rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8
c2381ab5 118 rm -f $(DESTDIR)$(MANDIR)/man7/pcilib.7
349c0fe9
MM
119ifeq ($(SHARED),yes)
120 rm -f $(DESTDIR)$(LIBDIR)/$(PCILIB) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so$(ABI_VERSION)
121endif
82ce97c9 122
cc062b4a
MM
123pci.ids.gz: pci.ids
124 gzip -9 <$< >$@
a33d0eb7 125
3b75e19a 126.PHONY: all clean distclean install install-lib uninstall force