diff options
author | Josh Triplett <josh@freedesktop.org> | 2006-12-05 02:15:02 -0800 |
---|---|---|
committer | Josh Triplett <josh@freedesktop.org> | 2006-12-05 02:18:19 -0800 |
commit | 29578cb0d74a842e871038e97e858baf15b1fecc (patch) | |
tree | 19661ecb4536004633b78d4379263f61abe40646 /Makefile | |
parent | Install static library and header files (diff) | |
download | sparse-29578cb0d74a842e871038e97e858baf15b1fecc.tar.gz sparse-29578cb0d74a842e871038e97e858baf15b1fecc.tar.bz2 sparse-29578cb0d74a842e871038e97e858baf15b1fecc.zip |
Generate and install a pkg-config file. Add DESTDIR support to Makefile.
The Makefile now generates and installs a pkg-config file, sparse.pc, to
provide information about the installed Sparse library and header files. Use
`pkg-config --cflags sparse` to get the include path, and `pkg-config --libs
sparse` to get the library path and library.
To help packagers of Sparse, also add support for the DESTDIR variable to the
Makefile. DESTDIR allows you to target a particular prefix (such as /usr),
but install to another directory (such as debian/tmp), usually for the
purposes of subsequently constructing a package from that directory.
Previously, just setting PREFIX would work for that, but with the new
pkg-config file, the Makefile needs to know the real prefix.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 29 |
1 files changed, 19 insertions, 10 deletions
@@ -1,6 +1,8 @@ # # Turkey time! # +VERSION=0.2 + OS=linux CC=gcc @@ -13,10 +15,12 @@ AR=ar # CFLAGS += -DDEBUG +DESTDIR= PREFIX=$(HOME) BINDIR=$(PREFIX)/bin LIBDIR=$(PREFIX)/lib -INCLUDEDIR=$(PREFIX)/include/sparse +INCLUDEDIR=$(PREFIX)/include +PKGCONFIGDIR=$(PREFIX)/share/pkgconfig PROGRAMS=test-lexing test-parsing obfuscate compile graph sparse test-linearize example test-unssa test-dissect INST_PROGRAMS=sparse cgcc @@ -35,21 +39,26 @@ SLIB_FILE= libsparse.so LIBS=$(LIB_FILE) -all: $(PROGRAMS) +all: $(PROGRAMS) sparse.pc -install: $(INST_PROGRAMS) $(LIBS) $(LIB_H) - install -d $(BINDIR) - install -d $(LIBDIR) - install -d $(INCLUDEDIR) +install: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc + install -d $(DESTDIR)$(BINDIR) + install -d $(DESTDIR)$(LIBDIR) + install -d $(DESTDIR)$(INCLUDEDIR)/sparse + install -d $(DESTDIR)$(PKGCONFIGDIR) for f in $(INST_PROGRAMS); do \ - install -v $$f $(BINDIR)/$$f || exit 1; \ + install -v $$f $(DESTDIR)$(BINDIR)/$$f || exit 1; \ done for f in $(LIBS); do \ - install -m 644 -v $$f $(LIBDIR)/$$f || exit 1; \ + install -m 644 -v $$f $(DESTDIR)$(LIBDIR)/$$f || exit 1; \ done for f in $(LIB_H); do \ - install -m 644 -v $$f $(INCLUDEDIR)/$$f || exit 1; \ + install -m 644 -v $$f $(DESTDIR)$(INCLUDEDIR)/sparse/$$f || exit 1; \ done + install -m 644 -v sparse.pc $(DESTDIR)$(PKGCONFIGDIR)/sparse.pc + +sparse.pc: sparse.pc.in + sed 's|@version@|$(VERSION)|g;s|@prefix@|$(PREFIX)|g;s|@libdir@|$(LIBDIR)|g;s|@includedir@|$(INCLUDEDIR)|g' sparse.pc.in > sparse.pc test-lexing: test-lexing.o $(LIBS) $(CC) $(LDFLAGS) -o $@ $< $(LIBS) @@ -133,6 +142,6 @@ pre-process.h: echo "#define GCC_INTERNAL_INCLUDE \"`$(CC) -print-file-name=include`\"" > pre-process.h clean: - rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h + rm -f *.[oasi] core core.[0-9]* $(PROGRAMS) $(SLIB_FILE) pre-process.h sparse.pc % : SCCS/s.%s |