This repository has been archived by the owner on Oct 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
144 lines (116 loc) · 4.22 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
##
## Makefile -- Build procedure for ngx_mruby for nginx module
## MATSUMOTO, Ryosuke
##
#
# build configuration
#
NUM_THREADS?= 1
MAKEFLAGS=-j $(NUM_THREADS)
RAKE=rake -j $(NUM_THREADS)
NGX_MRUBY_ROOT=$(shell pwd)
NGX_SRC_ROOT=@NGX_SRC_ROOT@
BUILD_DIR=@BUILD_DIR@
ifeq ($(wildcard $(NGX_SRC_ROOT)/auto/configure),)
NGX_CONFIGURE = ./configure
else
# development branch does not have configure script in top of directory.
NGX_CONFIGURE = ./auto/configure
endif
MRUBY_ROOT=@MRUBY_ROOT@
NDK_ROOT=@NDK_ROOT@
# libmruby.flags.mak contains MRUBY_* variables. It is created while building mruby.
MRUBY_MAK_FILE := $(MRUBY_ROOT)/build/host/lib/libmruby.flags.mak
ifneq ($(wildcard $(MRUBY_MAK_FILE)),)
include $(MRUBY_MAK_FILE)
endif
MRUBY_LIBDIR=@MRUBY_LIBDIR@ # comes from configure
MRUBY_BUILD_DEPEND_TARGETS=@MRUBY_BUILD_DEPEND_TARGETS@
NGX_MRUBY_CFLAGS+=@NGX_MRUBY_CFLAGS@ # Use it in build_config.rb to build mruby
NGX_OPENSSL_SRC=@NGX_OPENSSL_SRC@
NGX_OPENSSL_OPT=@NGX_OPENSSL_OPT@
NGX_OPENSSL_INSTALL_DIR=@NGX_OPENSSL_INSTALL_DIR@
NGX_CONFIG_OPT=@NGX_CONFIG_OPT@
NGX_CFLAGS=@NGX_CFLAGS@
NGX_LDFLAGS=@NGX_LDFLAGS@
NGX_LIBS=@NGX_LIBS@
NGX_CONFIG_ADD_MODULE_OPT_NAME=@NGX_CONFIG_ADD_MODULE_OPT_NAME@
NGX_MAKEFILE_DEPENDS_TARGET=@NGX_MAKEFILE_DEPENDS_TARGET@
BUILD_DYNAMIC_MODULE=@BUILD_DYNAMIC_MODULE@ # DON'T USE THIS. ONLY FOR COMPAT TARGETS
# flags
CFLAGS = $(NGX_CFLAGS) $(MRUBY_CFLAGS) -I/usr/local/include
LDFLAGS = $(NGX_LDFLAGS) $(MRUBY_LDFLAGS) -L/usr/local/lib
LIBS = $(NGX_LIBS) $(MRUBY_LIBS) $(MRUBY_LDFLAGS_BEFORE_LIBS) -L$(MRUBY_LIBDIR) -lmruby
#
# targets
#
all: build_ngx_mruby
install:
cd $(NGX_SRC_ROOT) && $(MAKE) install
clean:
-rm -rf mrbgems_config mrbgems_config_dynamic
clobber: clean_mruby clean
-rm -rf tmp autom4te.cache config config.status config.log $(BUILD_DIR) .openssl_build_done .openssl_configure_done
#
# mruby
#
build_mruby: $(MRUBY_BUILD_DEPEND_TARGETS)
cd $(MRUBY_ROOT) && $(RAKE) MRUBY_CONFIG=$(NGX_MRUBY_ROOT)/build_config.rb NGX_MRUBY_CFLAGS="$(NGX_MRUBY_CFLAGS)"
clean_mruby:
cd $(MRUBY_ROOT) && $(RAKE) deep_clean && rm -rf build
$(MRUBY_MAK_FILE): build_mruby
#
# nginx
#
build_ngx_mruby: build_mruby $(NGX_SRC_ROOT)/objs/Makefile
cd $(NGX_SRC_ROOT) && $(MAKE)
$(NGX_SRC_ROOT)/objs/Makefile: $(NGX_MAKEFILE_DEPENDS_TARGET)
cd $(NGX_SRC_ROOT) \
&& $(NGX_CONFIGURE) $(NGX_CONFIG_ADD_MODULE_OPT_NAME)=$(NGX_MRUBY_ROOT) --add-module=$(NDK_ROOT) $(NGX_CONFIG_OPT)
# libmruby.flags.mak is generated or updated, so invoke make command to reevaluate MRUBY_* variables in it.
mrbgems_config: $(MRUBY_MAK_FILE)
$(MAKE) generate_gems_config
mrbgems_config_dynamic: $(MRUBY_MAK_FILE)
$(MAKE) generate_gems_config_dynamic
generate_gems_config:
@echo CORE_LIBS=\"\$$CORE_LIBS $(LDFLAGS) $(LIBS)\" > ./mrbgems_config
@echo CORE_INCS=\"\$$CORE_INCS $(CFLAGS)\" >> ./mrbgems_config
@echo LINK_DEPS=\"\$$LINK_DEPS $(MRUBY_LIBMRUBY_PATH)\" >> ./mrbgems_config
generate_gems_config_dynamic:
@echo ngx_module_libs=\"\$(LDFLAGS) \$(LIBS)\" > ./mrbgems_config_dynamic
@echo CORE_LIBS=\"\$$CORE_LIBS \$(LDFLAGS) \$(LIBS)\" >> ./mrbgems_config_dynamic
# for backward compatibility
make_ngx_mruby:
cd $(NGX_SRC_ROOT) && $(MAKE)
@echo "Warning: make_ngx_mruby target will be removed. Use build_ngx_mruby instead."
ngx_mruby:
ifdef BUILD_DYNAMIC_MODULE
@echo "Error: You must rerun configure without --enable-dynamic" && false
else
$(MAKE) build_ngx_mruby
@echo "Warning: ngx_mruby target will be removed. Use build_ngx_mruby without BUILD_DYNAMIC_MODULE instead."
endif
ngx_mruby_dynamic:
ifdef BUILD_DYNAMIC_MODULE
$(MAKE) build_ngx_mruby
@echo "Warning: ngx_mruby_dynamic target will be removed. Use build_ngx_mruby with BUILD_DYNAMIC_MODULE instead."
else
@echo "Error: You must rerun configure with --enable-dynamic" && false
endif
#
# openssl
#
openssl: .openssl_build_done
.openssl_build_done: .openssl_configure_done
(cd $(NGX_OPENSSL_SRC) \
&& $(MAKE) build_all install_sw) \
&& cp /dev/null .openssl_build_done
.openssl_configure_done:
(cd $(NGX_OPENSSL_SRC) \
&& if [ -f Makefile ]; then $(MAKE) clean; fi \
&& ./config --prefix=$(NGX_OPENSSL_INSTALL_DIR) --shared zlib -fPIC enable-tlsext $(NGX_OPENSSL_OPT) \
&& $(MAKE) depend) \
&& cp /dev/null .openssl_configure_done
format:
./apply-clang-format
.PHONY: install