Annotation of embedaddon/pciutils/Makefile, revision 1.1.1.1
1.1 misho 1: # Makefile for The PCI Utilities
2: # (c) 1998--2012 Martin Mares <mj@ucw.cz>
3:
4: OPT=-O2
5: CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes
6:
7: VERSION=3.1.9
8: DATE=2012-01-14
9:
10: # Host OS and release (override if you are cross-compiling)
11: HOST=
12: RELEASE=
13: CROSS_COMPILE=
14:
15: # Support for compressed pci.ids (yes/no, default: detect)
16: ZLIB=
17:
18: # Support for resolving ID's by DNS (yes/no, default: detect)
19: DNS=
20:
21: # Build libpci as a shared library (yes/no; or local for testing; requires GCC)
22: SHARED=no
23:
24: # ABI version suffix in the name of the shared library
25: ABI_VERSION=.3
26:
27: # Installation directories
28: PREFIX=/usr/local
29: SBINDIR=$(PREFIX)/sbin
30: SHAREDIR=$(PREFIX)/share
31: IDSDIR=$(SHAREDIR)
32: MANDIR:=$(shell if [ -d $(PREFIX)/share/man ] ; then echo $(PREFIX)/share/man ; else echo $(PREFIX)/man ; fi)
33: INCDIR=$(PREFIX)/include
34: LIBDIR=$(PREFIX)/lib
35: PKGCFDIR=$(LIBDIR)/pkgconfig
36:
37: # Commands
38: INSTALL=install
39: DIRINSTALL=install -d
40: STRIP=-s
41: CC=$(CROSS_COMPILE)gcc
42: AR=$(CROSS_COMPILE)ar
43: RANLIB=$(CROSS_COMPILE)ranlib
44:
45: # Base name of the library (overriden on NetBSD, which has its own libpci)
46: LIBNAME=libpci
47:
48: -include lib/config.mk
49:
50: PCIINC=lib/config.h lib/header.h lib/pci.h lib/types.h lib/sysdep.h
51: PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
52:
53: export
54:
55: all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
56:
57: lib/$(PCILIB): $(PCIINC) force
58: $(MAKE) -C lib all
59:
60: force:
61:
62: lib/config.h lib/config.mk:
63: cd lib && ./configure
64:
65: lspci: lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/$(PCILIB)
66: setpci: setpci.o common.o lib/$(PCILIB)
67:
68: LSPCIINC=lspci.h pciutils.h $(PCIINC)
69: lspci.o: lspci.c $(LSPCIINC)
70: ls-vpd.o: ls-vpd.c $(LSPCIINC)
71: ls-caps.o: ls-caps.c $(LSPCIINC)
72: ls-ecaps.o: ls-ecaps.c $(LSPCIINC)
73: ls-kernel.o: ls-kernel.c $(LSPCIINC)
74: ls-tree.o: ls-tree.c $(LSPCIINC)
75: ls-map.o: ls-map.c $(LSPCIINC)
76:
77: setpci.o: setpci.c pciutils.h $(PCIINC)
78: common.o: common.c pciutils.h $(PCIINC)
79:
80: update-pciids: update-pciids.sh
81: sed <$< >$@ "s@^DEST=.*@DEST=$(IDSDIR)/$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@"
82: chmod +x $@
83:
84: # The example of use of libpci
85: example: example.o lib/$(PCILIB)
86: example.o: example.c $(PCIINC)
87:
88: %: %.o
89: $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
90:
91: %.8 %.7: %.man
92: 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#@IDSDIR@#$(IDSDIR)#"
93:
94: clean:
95: rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core -o -name "*.orig"`
96: rm -f update-pciids lspci setpci example lib/config.* *.[78] pci.ids.* lib/*.pc lib/*.so lib/*.so.*
97: rm -rf maint/dist
98:
99: distclean: clean
100:
101: install: all
102: # -c is ignored on Linux, but required on FreeBSD
103: $(DIRINSTALL) -m 755 $(DESTDIR)$(SBINDIR) $(DESTDIR)$(IDSDIR) $(DESTDIR)$(MANDIR)/man8 $(DESTDIR)$(MANDIR)/man7
104: $(INSTALL) -c -m 755 $(STRIP) lspci setpci $(DESTDIR)$(SBINDIR)
105: $(INSTALL) -c -m 755 update-pciids $(DESTDIR)$(SBINDIR)
106: $(INSTALL) -c -m 644 $(PCI_IDS) $(DESTDIR)$(IDSDIR)
107: $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(DESTDIR)$(MANDIR)/man8
108: $(INSTALL) -c -m 644 pcilib.7 $(DESTDIR)$(MANDIR)/man7
109: ifeq ($(SHARED),yes)
110: $(DIRINSTALL) -m 755 $(DESTDIR)$(LIBDIR)
111: $(INSTALL) -c -m 644 lib/$(PCILIB) $(DESTDIR)$(LIBDIR)
112: ln -sf $(PCILIB) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so$(ABI_VERSION)
113: endif
114:
115: install-lib: $(PCIINC_INS) lib/$(PCILIB) lib/$(PCILIBPC)
116: $(DIRINSTALL) -m 755 $(DESTDIR)$(INCDIR)/pci $(DESTDIR)$(LIBDIR) $(DESTDIR)$(PKGCFDIR)
117: $(INSTALL) -c -m 644 $(PCIINC_INS) $(DESTDIR)$(INCDIR)/pci
118: $(INSTALL) -c -m 644 lib/$(PCILIB) $(DESTDIR)$(LIBDIR)
119: $(INSTALL) -c -m 644 lib/$(PCILIBPC) $(DESTDIR)$(PKGCFDIR)
120: ifeq ($(SHARED),yes)
121: ln -sf $(LIBNAME).so$(ABI_VERSION) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so
122: endif
123:
124: uninstall: all
125: rm -f $(DESTDIR)$(SBINDIR)/lspci $(DESTDIR)$(SBINDIR)/setpci $(DESTDIR)$(SBINDIR)/update-pciids
126: rm -f $(DESTDIR)$(IDSDIR)/$(PCI_IDS)
127: rm -f $(DESTDIR)$(MANDIR)/man8/lspci.8 $(DESTDIR)$(MANDIR)/man8/setpci.8 $(DESTDIR)$(MANDIR)/man8/update-pciids.8
128: rm -f $(DESTDIR)$(MANDIR)/man7/pcilib.7
129: ifeq ($(SHARED),yes)
130: rm -f $(DESTDIR)$(LIBDIR)/$(PCILIB) $(DESTDIR)$(LIBDIR)/$(LIBNAME).so$(ABI_VERSION)
131: endif
132:
133: pci.ids.gz: pci.ids
134: gzip -9n <$< >$@
135:
136: .PHONY: all clean distclean install install-lib uninstall force
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>