| 1 |
|
| 2 |
CXX=g++ |
| •3 |
PKG_CONFIG ?= pkg-config |
| 4 |
CFLAGS+= -fPIC |
| 5 |
|
| 6 |
HL_INC=../../src/include/ |
| 7 |
HL_SRC=../../src/ |
| 8 |
|
| •9 |
LUA_CFLAGS=$(shell $(PKG_CONFIG) --cflags lua) |
| 10 |
LUA_LIBS=$(shell $(PKG_CONFIG) --libs lua) |
| 11 |
PYTHON_CFLAGS=$(shell $(PKG_CONFIG) --cflags python-2.7) |
| 12 |
PERL_INC=$(shell perl -MExtUtils::Embed -eccopts) |
| 13 |
PHP_INC=$(shell php-config --includes) |
| 14 |
|
| 15 |
lib-stamp: |
| 16 |
make -C ../.. -f ./makefile clean-obj |
| 17 |
PIC=1 make -C ../.. -f ./makefile CFLAGS="${CFLAGS}" lib-static |
| 18 |
touch $@ |
| 19 |
|
| 20 |
python: lib-stamp |
| 21 |
swig -c++ -python -o highlight_wrap.cpp highlight.i |
| 22 |
${CXX} ${CFLAGS} -c highlight_wrap.cpp ${LUA_CFLAGS} ${PYTHON_CFLAGS} -I${HL_INC} |
| •23 |
${CXX} ${LDFLAGS} -shared -s highlight_wrap.o -L${HL_SRC} -lhighlight ${LUA_LIBS} -lpython2.7 -o _highlight.so |
| 24 |
|
| 25 |
perl: lib-stamp |
| 26 |
swig -c++ -perl -o highlight_wrap.cpp highlight.i |
| 27 |
${CXX} ${CFLAGS} -c highlight_wrap.cpp ${LUA_CFLAGS} ${PERL_INC} -I${HL_INC} |
| •28 |
${CXX} ${LDFLAGS} -shared -s highlight_wrap.o -L${HL_SRC} -lhighlight ${LUA_LIBS} -o highlight.so |
| 29 |
|
| 30 |
php: lib-stamp |
| 31 |
swig -c++ -php -o highlight_wrap.cpp highlight.i |
| 32 |
${CXX} ${CFLAGS} -c highlight_wrap.cpp ${LUA_CFLAGS} ${PHP_INC} -I${HL_INC} |
| 33 |
${CXX} -shared -s highlight_wrap.o -L${HL_SRC} -lhighlight ${LUA_LIBS} -o highlight.so |
| 34 |
|
| 35 |
clean: python-clean perl-clean php-clean |
| 36 |
rm -f *-stamp |
| 37 |
rm -f highlight.py |
| 38 |
|
| 39 |
python-clean: |
| 40 |
rm -f _highlight.so *.pyc |
| 41 |
rm -rf __pycache__ |
| 42 |
|
| 43 |
perl-clean: |
| 44 |
rm -f highlight.so highlight_wrap.cpp highlight.pm *.o |
| 45 |
|
| 46 |
php-clean: |
| 47 |
rm -f highlight.so highlight_wrap.cpp highlight.php *.o php_highlight.h |
| 48 |
|
| 49 |
.PHONY: python python-clean perl perl-clean php php-clean clean |