1 # Makefile for The PCI Utilities
2 # (c) 1998--2004 Martin Mares <mj@ucw.cz>
4 OPT=-O2 -fomit-frame-pointer
5 CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline
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)
17 PCIINC=lib/config.h lib/header.h lib/pci.h
19 ifeq ($(shell uname),NetBSD)
23 ifeq ($(shell uname),AIX)
32 all: $(PCILIB) lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 pci.ids
34 $(PCILIB): $(PCIINC) force
40 cd lib && ./configure $(SHAREDIR) $(VERSION)
42 lspci: lspci.o common.o $(PCILIB)
43 setpci: setpci.o common.o $(PCILIB)
45 lspci.o: lspci.c pciutils.h $(PCIINC)
46 setpci.o: setpci.c pciutils.h $(PCIINC)
47 common.o: common.c pciutils.h $(PCIINC)
49 update-pciids: update-pciids.sh
50 sed <$< >$@ "s@^DEST=.*@DEST=$(SHAREDIR)/pci.ids@"
53 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)#"
56 rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core`
57 rm -f update-pciids lspci setpci lib/config.* *.8 pci.ids.*
63 # -c is ignored on Linux, but required on FreeBSD
64 $(DIRINSTALL) -m 755 $(SBINDIR) $(SHAREDIR) $(MANDIR)/man8
65 $(INSTALL) -c -m 755 -s lspci setpci $(SBINDIR)
66 $(INSTALL) -c -m 755 update-pciids $(SBINDIR)
67 $(INSTALL) -c -m 644 pci.ids $(SHAREDIR)
68 $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(MANDIR)/man8
71 rm -f $(SBINDIR)/lspci $(SBINDIR)/setpci $(SBINDIR)/update-pciids
72 rm -f $(SHAREDIR)/pci.ids
73 rm -f $(MANDIR)/man8/lspci.8 $(MANDIR)/man8/setpci.8 $(MANDIR)/man8/update-pciids.8
76 cp ~/tree/pciids/pci.ids pci.ids
78 .PHONY: all clean distclean install uninstall get-ids force