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