]>
Commit | Line | Data |
---|---|---|
4284af58 | 1 | # Makefile for The PCI Utilities |
1d5cf727 | 2 | # (c) 1998--2006 Martin Mares <mj@ucw.cz> |
98e39e09 | 3 | |
54e13765 | 4 | OPT=-O2 |
35620695 | 5 | CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline |
727ce158 | 6 | |
f54d99b3 | 7 | VERSION=2.2.4-pre4 |
1e73529b | 8 | DATE=2006-07-30 |
168b4f46 | 9 | |
c83293eb MM |
10 | PREFIX=/usr/local |
11 | SBINDIR=$(PREFIX)/sbin | |
12 | SHAREDIR=$(PREFIX)/share | |
54e13765 | 13 | IDSDIR=$(SHAREDIR) |
b0f1a03b | 14 | MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi) |
14d6c0a3 MM |
15 | INSTALL=install |
16 | DIRINSTALL=install -d | |
4afd29d3 | 17 | PCILIB=lib/libpci.a |
489233b4 | 18 | PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h |
c83293eb | 19 | |
cc062b4a MM |
20 | -include lib/config.mk |
21 | ifdef PCI_COMPRESSED_IDS | |
22 | LDFLAGS += -lz | |
23 | endif | |
24 | ||
848b4347 | 25 | ifeq ($(shell uname),NetBSD) |
e6859953 | 26 | PCILIB=lib/libpciutils.a |
848b4347 MM |
27 | LDFLAGS+=-lpci |
28 | else | |
14d6c0a3 | 29 | ifeq ($(shell uname),AIX) |
14d6c0a3 MM |
30 | CFLAGS=-g |
31 | INSTALL=installbsd | |
32 | DIRINSTALL=mkdir -p | |
14d6c0a3 | 33 | endif |
848b4347 | 34 | endif |
f6c86928 | 35 | |
0d656226 MM |
36 | HOST= |
37 | RELEASE= | |
38 | ||
727ce158 MM |
39 | export |
40 | ||
cc062b4a | 41 | all: $(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 |
46 | force: |
47 | ||
cc062b4a MM |
48 | lib/config.h lib/config.mk: |
49 | cd lib && ./configure "$(IDSDIR)" "$(VERSION)" "$(HOST)" "$(RELEASE)" "$(ZLIB)" | |
98e39e09 | 50 | |
4afd29d3 MM |
51 | lspci: lspci.o common.o $(PCILIB) |
52 | setpci: setpci.o common.o $(PCILIB) | |
727ce158 | 53 | |
4afd29d3 MM |
54 | lspci.o: lspci.c pciutils.h $(PCIINC) |
55 | setpci.o: setpci.c pciutils.h $(PCIINC) | |
56 | common.o: common.c pciutils.h $(PCIINC) | |
727ce158 | 57 | |
1b95f396 | 58 | update-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 | |
65 | clean: | |
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 | ||
70 | distclean: clean | |
f17b962b MM |
71 | |
72 | install: 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 | 80 | uninstall: 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 |
85 | pci.ids.gz: pci.ids |
86 | gzip -9 <$< >$@ | |
a33d0eb7 | 87 | |
cc062b4a | 88 | .PHONY: all clean distclean install uninstall force |