]> git.ipfire.org Git - thirdparty/pciutils.git/blob - Makefile
Fixed 64 bit addresses and released as 2.2.0.
[thirdparty/pciutils.git] / Makefile
1 # Makefile for The PCI Utilities
2 # (c) 1998--2005 Martin Mares <mj@ucw.cz>
3
4 OPT=-O2
5 CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline
6
7 VERSION=2.2.0
8 DATE=2005-09-21
9
10 PREFIX=/usr/local
11 SBINDIR=$(PREFIX)/sbin
12 SHAREDIR=$(PREFIX)/share
13 IDSDIR=$(SHAREDIR)
14 MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
15 INSTALL=install
16 DIRINSTALL=install -d
17 PCILIB=lib/libpci.a
18 PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h
19
20 ifeq ($(shell uname),NetBSD)
21 PCILIB=libpciutils.a
22 LDFLAGS+=-lpci
23 else
24 ifeq ($(shell uname),AIX)
25 CFLAGS=-g
26 INSTALL=installbsd
27 DIRINSTALL=mkdir -p
28 endif
29 endif
30
31 HOST=
32 RELEASE=
33
34 export
35
36 all: $(PCILIB) lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 pci.ids
37
38 $(PCILIB): $(PCIINC) force
39 $(MAKE) -C lib all
40
41 force:
42
43 lib/config.h:
44 cd lib && ./configure $(IDSDIR) $(VERSION) $(HOST) $(RELEASE)
45
46 lspci: lspci.o common.o $(PCILIB)
47 setpci: setpci.o common.o $(PCILIB)
48
49 lspci.o: lspci.c pciutils.h $(PCIINC)
50 setpci.o: setpci.c pciutils.h $(PCIINC)
51 common.o: common.c pciutils.h $(PCIINC)
52
53 update-pciids: update-pciids.sh
54 sed <$< >$@ "s@^DEST=.*@DEST=$(IDSDIR)/pci.ids@"
55
56 %.8: %.man
57 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)#"
58
59 clean:
60 rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core`
61 rm -f update-pciids lspci setpci lib/config.* *.8 pci.ids.*
62 rm -rf maint/dist
63
64 distclean: clean
65
66 install: all
67 # -c is ignored on Linux, but required on FreeBSD
68 $(DIRINSTALL) -m 755 $(SBINDIR) $(IDSDIR) $(MANDIR)/man8
69 $(INSTALL) -c -m 755 -s lspci setpci $(SBINDIR)
70 $(INSTALL) -c -m 755 update-pciids $(SBINDIR)
71 $(INSTALL) -c -m 644 pci.ids $(IDSDIR)
72 $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(MANDIR)/man8
73
74 uninstall: all
75 rm -f $(SBINDIR)/lspci $(SBINDIR)/setpci $(SBINDIR)/update-pciids
76 rm -f $(IDSDIR)/pci.ids
77 rm -f $(MANDIR)/man8/lspci.8 $(MANDIR)/man8/setpci.8 $(MANDIR)/man8/update-pciids.8
78
79 get-ids:
80 cp ~/tree/pciids/pci.ids pci.ids
81
82 .PHONY: all clean distclean install uninstall get-ids force