1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
LIBTOOL ?= libtool
LIBDIR ?= /usr/lib
CXX ?= g++
CXXFLAGS ?= -g -O3 -Wall -Wextra -Wshadow -Wconversion -Wcast-qual -Wformat=2
all: libpystring.la
pystring.lo: pystring.h pystring.cpp
$(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(CXXFLAGS) -c pystring.cpp
libpystring.la: pystring.lo
$(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $< -rpath $(LIBDIR)
install: libpystring.la
$(LIBTOOL) --mode=install install -c $< $(LIBDIR)/$<
clean:
$(RM) -fr pystring.lo pystring.o libpystring.la .libs
.PHONY: test
test:
$(RM) -fr test
$(CXX) pystring.cpp test.cpp $(CXXFLAGS) -DPYSTRING_UNITTEST=1 -o test
./test
|