Skip to content

Commit f77cf78

Browse files
committed
Make: refactor dynamic module builds.
Define all the shared module targets in the main Makefile and allow build/*.mk files to add the correct dependencies.
1 parent 3b5459d commit f77cf78

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
MODULE = nginx_acme
2-
# build/build-%.mk: debug, debug-static, release, release-static, sanitize
2+
MODULE_NAME = ngx_http_acme_module
3+
4+
# build/build-%.mk: debug, debug-static, release, release-static, sanitize, ...
35
BUILD ?= debug
46
TESTS ?= t/
57
NGX_CARGO ?= cargo
@@ -66,6 +68,7 @@ help:
6668
# Always rebuild targets managed by external build tool
6769
.PHONY: target/debug/lib$(MODULE)$(NGX_MODEXT) \
6870
target/release/lib$(MODULE)$(NGX_MODEXT) \
71+
$(NGINX_BUILD_DIR)/$(MODULE_NAME).so \
6972
$(TEST_NGINX_BINARY)
7073

7174
$(NGINX_BUILD_DIR)/Makefile: config config.make auto/rust
@@ -81,7 +84,11 @@ $(NGINX_BUILD_DIR)/Makefile: $(NGINX_SOURCE_DIR)/src/core/nginx.h
8184

8285
$(TEST_NGINX_BINARY): $(NGINX_BUILD_DIR)/Makefile
8386
cd $(NGINX_SOURCE_DIR) \
84-
&& $(BUILD_ENV) $(MAKE) -f $(NGINX_BUILD_DIR)/Makefile
87+
&& $(BUILD_ENV) $(MAKE) -f $(NGINX_BUILD_DIR)/Makefile binary
88+
89+
$(NGINX_BUILD_DIR)/$(MODULE_NAME).so: $(NGINX_BUILD_DIR)/Makefile
90+
cd $(NGINX_SOURCE_DIR) \
91+
&& $(BUILD_ENV) $(MAKE) -f $(NGINX_BUILD_DIR)/Makefile modules
8592

8693
target/debug/lib$(MODULE)$(NGX_MODEXT): $(NGINX_BUILD_DIR)/Makefile
8794
$(BUILD_ENV) $(NGX_CARGO) build

build/build-aws-lc.mk

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ BUILD_ENV += OPENSSL_INCLUDE_DIR="$(LIBSSL_DESTDIR)/include"
2323
BUILD_ENV += OPENSSL_LIB_DIR="$(LIBSSL_DESTDIR)/lib"
2424
BUILD_ENV += OPENSSL_STATIC=0
2525

26+
NGX_MODULE = $(NGINX_BUILD_DIR)/$(MODULE_NAME).so
27+
2628
TEST_ENV += LD_LIBRARY_PATH="$(LIBSSL_DESTDIR)/lib"
29+
TEST_NGINX_GLOBALS += load_module $(NGX_MODULE);
2730

2831
NGINX_CONFIGURE = \
2932
$(NGINX_CONFIGURE_BASE) \
@@ -33,14 +36,8 @@ NGINX_CONFIGURE = \
3336
--add-dynamic-module="$(CURDIR)"
3437

3538

36-
NGX_MODULE = $(NGINX_BUILD_DIR)/ngx_http_acme_module.so
37-
TEST_NGINX_GLOBALS += load_module $(NGX_MODULE);
38-
39-
.PHONY: $(NGX_MODULE)
40-
4139
build: $(NGX_MODULE)
4240

43-
4441
$(LIBSSL_BUILDDIR)/CMakeCache.txt: $(LIBSSL_SRCDIR)/CMakeLists.txt
4542
cmake -S $(LIBSSL_SRCDIR) \
4643
-B $(LIBSSL_BUILDDIR) \

0 commit comments

Comments
 (0)