]> git.ipfire.org Git - thirdparty/pciutils.git/blame - Makefile
Whitespace cleanup of all source files.
[thirdparty/pciutils.git] / Makefile
CommitLineData
4284af58 1# Makefile for The PCI Utilities
1d5cf727 2# (c) 1998--2006 Martin Mares <mj@ucw.cz>
98e39e09 3
54e13765 4OPT=-O2
35620695 5CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline
727ce158 6
f54d99b3 7VERSION=2.2.4-pre4
1e73529b 8DATE=2006-07-30
168b4f46 9
c83293eb
MM
10PREFIX=/usr/local
11SBINDIR=$(PREFIX)/sbin
12SHAREDIR=$(PREFIX)/share
54e13765 13IDSDIR=$(SHAREDIR)
b0f1a03b 14MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
14d6c0a3
MM
15INSTALL=install
16DIRINSTALL=install -d
4afd29d3 17PCILIB=lib/libpci.a
489233b4 18PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h
c83293eb 19
cc062b4a
MM
20-include lib/config.mk
21ifdef PCI_COMPRESSED_IDS
22LDFLAGS += -lz
23endif
24
848b4347 25ifeq ($(shell uname),NetBSD)
e6859953 26PCILIB=lib/libpciutils.a
848b4347
MM
27LDFLAGS+=-lpci
28else
14d6c0a3 29ifeq ($(shell uname),AIX)
14d6c0a3
MM
30CFLAGS=-g
31INSTALL=installbsd
32DIRINSTALL=mkdir -p
14d6c0a3 33endif
848b4347 34endif
f6c86928 35
0d656226
MM
36HOST=
37RELEASE=
38
727ce158
MM
39export
40
cc062b4a 41all: $(PCILIB) lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 $(PCI_IDS)
727ce158 42
11f7b31b 43$(PCILIB): $(PCIINC) force
727ce158 44 $(MAKE) -C lib all
e4842ff3 45
11f7b31b
MM
46force:
47
cc062b4a
MM
48lib/config.h lib/config.mk:
49 cd lib && ./configure "$(IDSDIR)" "$(VERSION)" "$(HOST)" "$(RELEASE)" "$(ZLIB)"
98e39e09 50
4afd29d3
MM
51lspci: lspci.o common.o $(PCILIB)
52setpci: setpci.o common.o $(PCILIB)
727ce158 53
4afd29d3
MM
54lspci.o: lspci.c pciutils.h $(PCIINC)
55setpci.o: setpci.c pciutils.h $(PCIINC)
56common.o: common.c pciutils.h $(PCIINC)
727ce158 57
1b95f396 58update-pciids: update-pciids.sh
cc062b4a
MM
59 sed <$< >$@ "s@^DEST=.*@DEST=$(IDSDIR)/$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@"
60 chmod +x $@
1b95f396 61
727ce158 62%.8: %.man
54e13765 63 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
64
65clean:
c7f5314d 66 rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core -o -name "*.orig"`
14d4f989 67 rm -f update-pciids lspci setpci lib/config.* lib/example *.8 pci.ids.*
ab12277e
MM
68 rm -rf maint/dist
69
70distclean: clean
f17b962b
MM
71
72install: all
ee551b73 73# -c is ignored on Linux, but required on FreeBSD
f4ddb8d3
MM
74 $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8
75 $(INSTALL) -c -m 755 -s lspci setpci $(DESTDIR)$(SBINDIR)
76 $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
cc062b4a 77 $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
f4ddb8d3 78 $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
f17b962b 79
82ce97c9 80uninstall: all
f4ddb8d3 81 rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/update-pciids
cc062b4a 82 rm -f $(DESTDIR)$(IDSDIR)/$(PCI_IDS)
f4ddb8d3 83 rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8
82ce97c9 84
cc062b4a
MM
85pci.ids.gz: pci.ids
86 gzip -9 <$< >$@
a33d0eb7 87
cc062b4a 88.PHONY: all clean distclean install uninstall force