]> git.ipfire.org Git - thirdparty/pciutils.git/blame - Makefile
Cleanup of the Makefile system.
[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
ed8f61e9
MM
7VERSION=2.2.10-net2
8DATE=2008-02-13
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
20# Installation directories
c83293eb
MM
21PREFIX=/usr/local
22SBINDIR=$(PREFIX)/sbin
23SHAREDIR=$(PREFIX)/share
54e13765 24IDSDIR=$(SHAREDIR)
b0f1a03b 25MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
5670e427 26INCDIR=$(PREFIX)/include
3052f51e 27LIBDIR=$(PREFIX)/lib
5670e427 28PKGCFDIR=$(LIBDIR)/pkgconfig
3b75e19a
MM
29
30# Commands
14d6c0a3
MM
31INSTALL=install
32DIRINSTALL=install -d
3b75e19a 33STRIP=-s
325a3c50
MM
34AR=ar
35RANLIB=ranlib
3b75e19a 36
4afd29d3 37PCILIB=lib/libpci.a
5670e427 38PCILIBPC=lib/libpci.pc
489233b4 39PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h
3052f51e 40PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
c83293eb 41
cc062b4a 42-include lib/config.mk
f6c86928 43
727ce158
MM
44export
45
f2bf13dc 46all: $(PCILIB) lspci setpci lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
727ce158 47
11f7b31b 48$(PCILIB): $(PCIINC) force
727ce158 49 $(MAKE) -C lib all
e4842ff3 50
11f7b31b
MM
51force:
52
cc062b4a 53lib/config.h lib/config.mk:
3b75e19a 54 cd lib && ./configure
98e39e09 55
0715b08d
MM
56lspci: lspci.o common.o $(PCILIB)
57setpci: setpci.o common.o $(PCILIB)
727ce158 58
4afd29d3
MM
59lspci.o: lspci.c pciutils.h $(PCIINC)
60setpci.o: setpci.c pciutils.h $(PCIINC)
61common.o: common.c pciutils.h $(PCIINC)
727ce158 62
1b95f396 63update-pciids: update-pciids.sh
cc062b4a
MM
64 sed <$< >$@ "s@^DEST=.*@DEST=$(IDSDIR)/$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@"
65 chmod +x $@
1b95f396 66
6cdb9d93
MM
67%: %.o
68 $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
69
f2bf13dc 70%.8 %.7: %.man
54e13765 71 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
72
73clean:
c7f5314d 74 rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core -o -name "*.orig"`
f2bf13dc 75 rm -f update-pciids lspci setpci lib/config.* lib/example *.[78] pci.ids.* lib/*.pc
ab12277e
MM
76 rm -rf maint/dist
77
78distclean: clean
f17b962b
MM
79
80install: all
ee551b73 81# -c is ignored on Linux, but required on FreeBSD
cd73a9d0 82 $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7
27fa4e65 83 $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR)
f4ddb8d3 84 $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
cc062b4a 85 $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
f4ddb8d3 86 $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
f2bf13dc 87 $(INSTALL) -c -m 644 pcilib.7 $(DESTDIR)$(MANDIR)/man7
f17b962b 88
5670e427
MM
89install-lib: $(PCIINC_INS) $(PCILIB) $(PCILIBPC)
90 $(DIRINSTALL) -m 755 $(DESTDIR)$(INCDIR)/pci $(DESTDIR)$(LIBDIR) $(DESTDIR)$(PKGCFDIR)
91 $(INSTALL) -c -m 644 $(PCIINC_INS) $(DESTDIR)$(INCDIR)/pci
3052f51e 92 $(INSTALL) -c -m 644 $(PCILIB) $(DESTDIR)$(LIBDIR)
5670e427 93 $(INSTALL) -c -m 644 $(PCILIBPC) $(DESTDIR)$(PKGCFDIR)
3052f51e 94
82ce97c9 95uninstall: all
f4ddb8d3 96 rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/update-pciids
cc062b4a 97 rm -f $(DESTDIR)$(IDSDIR)/$(PCI_IDS)
f4ddb8d3 98 rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8
c2381ab5 99 rm -f $(DESTDIR)$(MANDIR)/man7/pcilib.7
82ce97c9 100
cc062b4a
MM
101pci.ids.gz: pci.ids
102 gzip -9 <$< >$@
a33d0eb7 103
3b75e19a 104.PHONY: all clean distclean install install-lib uninstall force