forked from disconnect/apache-websocket
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.in
116 lines (88 loc) · 3.73 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
.PHONY: install clean check start restart stop examples install-examples \
test-folders test-modules start-test-server restart-test-server \
stop-test-server debug enable-coverage
# Absolute path to the current directory.
CURDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
# Paths to tools (set by configure)
APXS := @APXS@
APACHECTL := @APACHECTL@
HTTPD := @HTTPD@
LIBTOOL := @LIBTOOL@
# CFLAGS and LDFLAGS can be set during the make invocation.
CFLAGS += -g -Wall
LDFLAGS +=
# Flags for all compilation.
comma := ,
APXS_CFLAGS = $(addprefix -Wc$(comma),$(CFLAGS))
APXS_LDFLAGS = $(addprefix -Wl$(comma),$(LDFLAGS))
# List of example plugins -- one for each *.c in the examples/ directory.
EXAMPLES := $(wildcard examples/*.c)
EXAMPLE_PLUGINS := $(patsubst %.c,%.la,$(EXAMPLES))
EXAMPLE_NAMES := $(basename $(notdir $(EXAMPLES)))
EXAMPLE_INSTALLS := $(addprefix install-,$(EXAMPLE_NAMES))
.PHONY: $(EXAMPLE_INSTALLS)
#
# Rules
#
all: mod_websocket.la examples
install: mod_websocket.la
$(APXS) -i -A $<
clean:
rm -f *.lo *.la *.slo *.o
rm -rf .libs/
rm -f examples/*.lo examples/*.la examples/*.slo examples/*.o
rm -rf examples/.libs/
check:
./runtests.sh
start restart stop:
$(APACHECTL) $@
examples: $(EXAMPLE_PLUGINS)
install-examples: $(EXAMPLE_INSTALLS)
# Note that to work around PR43033, we have to pass an -n option even though we
# are not 'activating' the example plugins.
$(EXAMPLE_INSTALLS): install-%: examples/%.la
$(APXS) -i -n unused $<
# The main module has an additional header dependency.
mod_websocket.la: validate_utf8.h
%.la: %.c websocket_plugin.h
$(APXS) -c -I. $(APXS_CFLAGS) $(APXS_LDFLAGS) $<
# The enable-coverage recipe will enable gcov instrumentation. Data files are
# dropped into the .libs/ build directories.
enable-coverage: override CFLAGS += -Og -fprofile-arcs -ftest-coverage
enable-coverage: override LDFLAGS += -fprofile-arcs
enable-coverage: all
#
# Test Rules
#
TEST_MODULEDIR := test/httpd/modules
TEST_FOLDERS := test/httpd/logs test/httpd/htdocs $(TEST_MODULEDIR)
test-folders: $(TEST_FOLDERS)
$(TEST_FOLDERS):
mkdir -p $@
TEST_PLUGINS := $(patsubst %.c,%.la,$(wildcard test/plugins/*.c))
# Every library we want to install in the test modules/ directory.
TEST_BINARIES := mod_websocket.la $(EXAMPLE_PLUGINS) $(TEST_PLUGINS)
TEST_MODULES_ALL := $(notdir $(patsubst %.la,%.so,$(TEST_BINARIES)))
TEST_MODULES_ALL_PATHS := $(addprefix $(TEST_MODULEDIR)/,$(TEST_MODULES_ALL))
TEST_MODULES_EXAMPLE := $(notdir $(patsubst %.la,%.so,$(EXAMPLE_PLUGINS)))
TEST_MODULES_EXAMPLE_PATHS := $(addprefix $(TEST_MODULEDIR)/,$(TEST_MODULES_EXAMPLE))
TEST_MODULES_PLUGINS := $(notdir $(patsubst %.la,%.so,$(TEST_PLUGINS)))
TEST_MODULES_PLUGINS_PATHS := $(addprefix $(TEST_MODULEDIR)/,$(TEST_MODULES_PLUGINS))
test-modules: $(TEST_MODULES_ALL_PATHS)
$(TEST_MODULEDIR)/mod_websocket.so: mod_websocket.la
$(TEST_MODULES_EXAMPLE_PATHS): $(TEST_MODULEDIR)/%.so: examples/%.la
$(TEST_MODULES_PLUGINS_PATHS): $(TEST_MODULEDIR)/%.so: test/plugins/%.la
$(TEST_MODULES_ALL_PATHS):
mkdir -p $(TEST_MODULEDIR)
$(LIBTOOL) --silent --mode=install cp $< $(abspath $@)
# DEBUGGER is used only in the `make debug` target. Defaults to "gdb --args";
# you can override this on the command line.
debug: DEBUGGER := gdb --args
start-test-server restart-test-server stop-test-server: override DEBUGGER :=
# For the debug target, pass -X to httpd. For the other test-server targets,
# pass start/restart/stop as appropriate.
debug: HTTPD_ARGS := -X
start-test-server restart-test-server stop-test-server: HTTPD_ARGS = -k $(patsubst %-test-server,%,$@)
debug start-test-server restart-test-server: test-modules test-folders
debug start-test-server restart-test-server stop-test-server:
$(DEBUGGER) $(HTTPD) -d "$(CURDIR)/test/httpd" -f test.conf $(HTTPD_ARGS)