-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile.in
101 lines (85 loc) · 2.78 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
##
## Makefile -- Build procedure for sample mod_mruby Apache module
## MATSUMOTO, Ryosuke
##
MAKE=make
RAKE=rake -j $(NUM_THREADS)
# target module source
TARGET=src/mod_mruby.c src/ap_mrb_*.c @FEATURE_TARGETS@
# the used tools
APXS=@APXS_PATH@
APACHECTL=@APACHECTL_PATH@
# additional user defines, includes and libraries
MRUBY_ROOT=@MRUBY_ROOT@
MRUBY_TEST_ROOT=@MRUBY_ROOT@_test
DEFS=@DEFS@
INC=-I. -I$(MRUBY_ROOT)/src -I$(MRUBY_ROOT)/include
LIB=@LIBS@
WC=-Wc,'-std=c99 -Wall -Werror-implicit-function-declaration -g'
MRUBY_REPOS=@MRUBY_REPOS@
RAKE_PATH=@RAKE_PATH@
ENABLE_GEMS=@ENABLE_GEMS@
# suport mrbgems
MRUBY_MAK_FILE := $(MRUBY_ROOT)/build/host/lib/libmruby.flags.mak
ifeq ($(wildcard $(MRUBY_MAK_FILE)),)
MRUBY_CFLAGS =
MRUBY_LDFLAGS =
MRUBY_LIBS =
MRUBY_LDFLAGS_BEFORE_LIBS =
else
include $(MRUBY_MAK_FILE)
endif
APXS_LDFLAGS=@LDFLAGS@
CFLAGS=$(INC)
LDFLAGS=$(MRUBY_LDFLAGS)
LIBS=$(LIB) $(MRUBY_LIBS) $(MRUBY_LDFLAGS_BEFORE_LIBS) $(MRUBY_ROOT)/build/host/lib/libmruby.a
# the default target
all: mod_mruby.so
# compile the DSO file
mod_mruby.so: $(TARGET)
$(APXS) -c $(DEFS) $(CFLAGS) $(LDFLAGS) $(LIBS) $(WC) $(APXS_LDFLAGS) $(TARGET)
PWD=$(shell pwd)
SYSCONFDIR=$(shell $(APXS) -q SYSCONFDIR)
APCONFNAME=$(shell $(APXS) -q progname).conf
APLIBEXECDIR=$(shell $(APXS) -q exp_libexecdir)
APDOCROOT=$(shell $(APXS) -q exp_htdocsdir)
MOD_MRUBY_SO=$(PWD)/src/.libs/mod_mruby.so
TEST_DIR=$(PWD)/test
# test
test:
$(APACHECTL) -k stop
cp -p $(SYSCONFDIR)/$(APCONFNAME) ./test/conf/httpd.conf.orig
sed -e 's/^Listen .*80//g' ./test/conf/httpd.conf.orig > ./test/conf/httpd.conf
echo 'LoadModule mruby_module $(MOD_MRUBY_SO)' >> ./test/conf/httpd.conf
sed -e 's|__MOD_MRUBY_TEST_DIR__|$(TEST_DIR)|g' \
-e 's|__APLIBEXECDIR__|$(APLIBEXECDIR)|g' \
-e 's|__APDOCROOT__|$(APDOCROOT)|g' \
./test/conf/mod_mruby_test.conf >> ./test/conf/httpd.conf
cp -pr ./test/htdocs/* $(APDOCROOT)/.
$(APACHECTL) -f $(shell pwd)/test/conf/httpd.conf -k start
cp -p ./test/build_config.rb $(MRUBY_TEST_ROOT)/.
cd $(MRUBY_TEST_ROOT) && rake clean && $(RAKE)
$(MRUBY_TEST_ROOT)/bin/mruby ./test/t/mod_mruby.rb
$(APACHECTL) -k stop
# install the DSO file into the Apache installation
# and activate it in the Apache configuration
install:
$(APXS) -i -a -n 'mruby' $(MOD_MRUBY_SO)
# cleanup
clean:
-rm -rf src/.libs src/*.o src/*.so src/*.lo src/*.la src/*.slo src/*.loT
-rm -rf ./lib/*/.libs ./lib/*/*.o ./lib/*/*.lo ./lib/*/*.slo
-rm -rf test/conf/httpd.conf*
# clobber
clobber: clean
-rm -rf tmp vendors build config.log config.status autom4te.cache
# reload the module by installing and restarting Apache
reload: install restart
# the general Apache start/restart/stop procedures
start:
$(APACHECTL) -k start
restart:
$(APACHECTL) -k restart
stop:
$(APACHECTL) -k stop
.PHONY: test