1# Makefile for The PCI Utilities 2# (c) 1998--2004 Martin Mares <[email protected]> 3 4OPT=-O2 -fomit-frame-pointer 5CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline 6 7VERSION=2.1.99-test7 8DATE=2004-07-05 9 10PREFIX=/usr/local 11SBINDIR=$(PREFIX)/sbin 12SHAREDIR=$(PREFIX)/share 13MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi) 14INSTALL=install 15DIRINSTALL=install -d 16PCILIB=lib/libpci.a 17PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h 18 19ifeq ($(shell uname),NetBSD) 20PCILIB=libpciutils.a 21LDFLAGS+=-lpci 22else 23ifeq ($(shell uname),AIX) 24CFLAGS=-g 25INSTALL=installbsd 26DIRINSTALL=mkdir -p 27endif 28endif 29 30HOST= 31RELEASE= 32 33export 34 35all: $(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 40force: 41 42lib/config.h: 43 cd lib && ./configure $(SHAREDIR) $(VERSION) $(HOST) $(RELEASE) 44 45lspci: lspci.o common.o $(PCILIB) 46setpci: setpci.o common.o $(PCILIB) 47 48lspci.o: lspci.c pciutils.h $(PCIINC) 49setpci.o: setpci.c pciutils.h $(PCIINC) 50common.o: common.c pciutils.h $(PCIINC) 51 52update-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 58clean: 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 63distclean: clean 64 65install: 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 73uninstall: 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 78get-ids: 79 cp ~/tree/pciids/pci.ids pci.ids 80 81.PHONY: all clean distclean install uninstall get-ids force 82