]> mj.ucw.cz Git - pciutils.git/blob - Makefile
9b1b3b7dd1d40298045fff192d8061d6fadb4167
[pciutils.git] / Makefile
1 # $Id: Makefile,v 1.53 2003/01/04 12:49:06 mj Exp $
2 # Makefile for Linux PCI Utilities
3 # (c) 1998--2003 Martin Mares <mj@ucw.cz>
4
5 OPT=-O2 -fomit-frame-pointer
6 #OPT=-O2 -g
7 CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes
8
9 VERSION=2.1.11
10 #SUFFIX=-pre2
11 DATE=2003-01-04
12
13 PREFIX=/usr/local
14 SBINDIR=$(PREFIX)/sbin
15 SHAREDIR=$(PREFIX)/share
16 MANDIR=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
17 INSTALL=install
18 DIRINSTALL=install -d
19 PCILIB=libpci.a
20
21 ifeq ($(shell uname),NetBSD)
22 PCILIB=libpciutils.a
23 LDFLAGS+=-lpci
24 else
25 ifeq ($(shell uname),AIX)
26 CFLAGS=-g
27 INSTALL=installbsd
28 DIRINSTALL=mkdir -p
29 endif
30 endif
31
32 export
33
34 all: lib lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 pci.ids
35
36 lib: lib/config.h
37         $(MAKE) -C lib all
38
39 lib/config.h:
40         cd lib && ./configure $(SHAREDIR) $(VERSION)
41
42 lspci: lspci.o common.o lib/$(PCILIB)
43 setpci: setpci.o common.o lib/$(PCILIB)
44
45 lspci.o: lspci.c pciutils.h
46 setpci.o: setpci.c pciutils.h
47 common.o: common.c pciutils.h
48
49 update-pciids: update-pciids.sh
50         sed <$< >$@ "s@^DEST=.*@DEST=$(SHAREDIR)/pci.ids@"
51
52 %.8: %.man
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)$(SUFFIX)/;s#@SHAREDIR@#$(SHAREDIR)#"
54
55 clean:
56         rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core`
57         rm -f update-ids lspci setpci lib/config.* *.8 pci.ids.*
58
59 install: all
60 # -c is ignored on Linux, but required on FreeBSD
61         $(DIRINSTALL) -m 755 $(SBINDIR) $(SHAREDIR) $(MANDIR)/man8
62         $(INSTALL) -c -m 755 -s lspci setpci $(SBINDIR)
63         $(INSTALL) -c -m 755 update-pciids $(SBINDIR)
64         $(INSTALL) -c -m 644 pci.ids $(SHAREDIR)
65         $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(MANDIR)/man8
66
67 uninstall: all
68         rm -f $(SBINDIR)/lspci $(SBINDIR)/setpci $(SBINDIR)/update-pciids
69         rm -f $(SHAREDIR)/pci.ids
70         rm -f $(MANDIR)/man8/lspci.8 $(MANDIR)/man8/setpci.8 $(MANDIR)/man8/update-pciids.8
71
72 get-ids:
73         cp ~/tree/pciids/pci.ids pci.ids
74
75 pci.ids:
76         @ [ -f pci.ids ] || echo >&2 "The pci.ids file is no longer part of the CVS. Please do run update-ids.sh to download them." && false
77
78 release:
79         sed "s/^\\(Version:[    ]*\\)[0-9.]*/\\1$(VERSION)/;s/^\\(Entered-date:[        ]*\\)[0-9]*/\\1`date -d$(DATE) '+%y%m%d'`/;s/\\(pciutils-\\)[0-9.]*/\\1$(VERSION)\\./" <pciutils.lsm >pciutils.lsm.new
80         sed "s/^\\(Version:[    ]*\\)[0-9.]*/\\1$(VERSION)/" <pciutils.spec >pciutils.spec.new
81         sed "s/\\(, version \\).*\./\\1$(VERSION)$(SUFFIX)./" <README >README.new
82         mv pciutils.lsm.new pciutils.lsm
83         mv pciutils.spec.new pciutils.spec
84         mv README.new README
85
86 REL=pciutils-$(VERSION)$(SUFFIX)
87 DISTTMP=/tmp/pciutils-dist
88
89 dist: clean pci.ids
90         rm -rf $(DISTTMP)
91         mkdir $(DISTTMP)
92         cp -a . $(DISTTMP)/$(REL)
93         rm -rf `find $(DISTTMP)/$(REL) -name CVS -o -name tmp -o -name maint`
94         cd $(DISTTMP) ; tar czvvf /tmp/$(REL).tar.gz $(REL)
95         rm -rf $(DISTTMP)
96
97 upload: dist
98         maint/upload $(REL)
99
100 .PHONY: all lib clean install uninstall dist man release upload get-ids