Loki/Makefile-debian

66 lines
1.7 KiB
Text
Raw Normal View History

# libloki Makefile
#
# written for Debian GNU/Linux by # martin f. krafft <madduck@debian.org>
# but may be used by others.
#
# (c) 2005 martin f. krafft <madduck@debian.org>
# Released under the terms of the Artistic Licence:
# http://www.opensource.org/licenses/artistic-license.php
#
LOKI_VERSION=$(shell dpkg-parsechangelog | sed -ne 's,^Version: \(.*\)-[[:digit:]]*,\1,p')
prefix ?= /usr/local
libdir ?= $(prefix)/lib
includedir ?= $(prefix)/include
CPPFLAGS =
CXXFLAGS = -I./include -O2 -g -Wall -W -pedantic -ansi -Werror -c
LDFLAGS = -static -rpath $(libdir)
LIBTOOL = libtool
COMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CPPFLAGS) $(CXXFLAGS)
LINK = $(LIBTOOL) --mode=link --tag=BINCXX $(LD) $(LDFLAGS)
INSTALL = $(LIBTOOL) --mode=install install -m644
FINISH = $(LIBTOOL) --mode=finish
CLEAN = $(LIBTOOL) --mode=clean $(RM)
SOURCES = src/SmallObj.cpp src/Singleton.cpp src/OrderedStatic.cpp
libloki.la: $(patsubst %.cpp,%.lo,$(SOURCES))
$(LINK) -o $@ $^
libloki.pc: libloki.pc.in
sed -e "s,@prefix@,$(prefix)," \
-e "s,@libdir@,$(libdir)," \
-e "s,@includedir@,$(includedir)," \
$< > $@
.PHONY: all
all: libloki.la
.PHONY: install
install: DESTlibdir = $(DESTDIR)$(libdir)
install: DESTincludedir = $(DESTDIR)$(includedir)
install: libloki.la libloki.pc
ifndef DESTDIR
@echo E: DESTDIR not specified. >&2
@false
else
mkdir -p $(DESTlibdir)
$(INSTALL) libloki.la $(DESTlibdir) 2>/dev/null
mkdir -p $(DESTlibdir)/pkgconfig
$(INSTALL) libloki.pc $(DESTlibdir)/pkgconfig 2>/dev/null
mkdir -p $(DESTincludedir)
$(INSTALL) $(wildcard *.h) $(DESTincludedir)
endif
%.lo: %.cpp
$(COMPILE) -o $@ $<
.PHONY: clean
clean:
$(CLEAN) $(wildcard *.o *.lo)
$(CLEAN) $(wildcard *.a *.la)