アパッチモジュールをC++でビルドできるようにしました。
ネット上を探したけど、日本語サイトでよいのがなく、試してもダメなものばかり。
結局githubで公開されていたコードから拝借したものが良かったので紹介しておきます
結論から言えばこの方のmakeファイルを参考にさせて頂きました。まじ感謝。
https://gist.github.com/jainvishal/64efa5534fd93fad504495304168ffd3
引用
Makefile
##
## Makefile -- Build procedure for sample foo Apache module
## Autogenerated via ``apxs -n foo -g''.
##
builddir=.
top_srcdir=/home/vishalj/www
top_builddir=/home/vishalj/www
include /home/vishalj/www/build/special.mk
CXX=g++
CXXFLAGS=-std=c++14
# the used tools
APACHECTL=~/www/bin/apachectl
# additional defines, includes and libraries
#DEFS=-Dmy_define=my_value
#INCLUDES=-Imy/include/dir
#LIBS=-Lmy/lib/dir -lmylib
# the default target
all: local-shared-build
# install the shared object file into Apache
install: install-modules-yes
# cleanup
clean:
-rm -f mod_foo.o mod_foo.lo mod_foo.slo mod_foo.la
# simple test
test: reload
lynx -mime_header http://localhost/foo
# install and activate shared object by reloading Apache to
# force a reload of the shared object file
reload: install restart
# the general Apache start/restart/stop
# procedures
start:
$(APACHECTL) start
restart:
$(APACHECTL) restart
stop:
$(APACHECTL) stop
あとはreload叩くだけ。
sudo make reload
あと環境によってはパスが違うのでご注意ください。
私はmacなので、以下の部分を書き換えてます。
top_srcdir=/usr/share/httpd
top_builddir=/usr/share/httpd
APACHECTL=apachectl