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 lib/types.h lib/sysdep.h
19 ifeq ($(shell uname),NetBSD)
23 ifeq ($(shell uname),AIX)
35 all: $(PCILIB) lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 pci.ids
37 $(PCILIB): $(PCIINC) force
43 cd lib && ./configure $(SHAREDIR) $(VERSION) $(HOST) $(RELEASE)
45 lspci: lspci.o common.o $(PCILIB)
46 setpci: setpci.o common.o $(PCILIB)
48 lspci.o: lspci.c pciutils.h $(PCIINC)
49 setpci.o: setpci.c pciutils.h $(PCIINC)
50 common.o: common.c pciutils.h $(PCIINC)
52 update-pciids: update-pciids.sh
53 sed <$< >$@ "s@^DEST=.*@DEST=$(SHAREDIR)/pci.ids@"
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)#"
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.*
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
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
79 cp ~/tree/pciids/pci.ids pci.ids
81 .PHONY: all clean distclean install uninstall get-ids force