summaryrefslogtreecommitdiffhomepage
path: root/tests/Makefile
blob: 2f0e8091dd58ada9c63ef55d85238875d7847370 (plain)
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
include ../common.mk

PROJECTNAME=test-webserver

CXXFLAGS+= -I. -fPIE

CXXTESTFLAGS=-I../googletest/include -I../googlemock/include/ -I../googletest -I../googlemock

LIBS=\
-lcommon \
-lboost_context \
-lboost_filesystem \
-lboost_timer \
-lboost_system \
-lcrypt \
-lpthread \
-lssl -lcrypto \
-ldl

LDFLAGS+=-pie -L../libcommon

TESTSRC=\
    test-webserver.cpp \
    ../googlemock/src/gmock-all.cpp \
    ../googletest/src/gtest-all.cpp \
    $(PROGSRC)

build: $(PROJECTNAME)
	+set -e ; for i in $(PLUGINS) ; do make -C plugins/$$i ; done
	./$(PROJECTNAME)

all: build
	./webserver -c webserver.conf

$(PROJECTNAME): ../libcommon/libcommon.a $(TESTSRC:.cpp=.o)
	$(CXX) $(LDFLAGS) $^ $(LDLIBS) $(LIBS) -o $@

dep: $(TESTSRC:.cpp=.d)

%.d: %.cpp
	$(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -MM -MP -MF $@ -c $<

%.o: %.cpp %.d
	$(CXX) $(CXXFLAGS) $(CXXTESTFLAGS) -c $< -o $@

install:
	mkdir -p $(DESTDIR)/usr/bin
	cp webserver $(DESTDIR)/usr/bin

	mkdir -p $(DESTDIR)/usr/lib/webserver/plugins
	set -e ; for i in $(PLUGINS) ; do make -C plugins/$$i install ; done

	mkdir -p $(DESTDIR)/usr/local/lib/webserver/plugins

	#mkdir -p $(DESTDIR)/etc
	#cp webserver.conf $(DESTDIR)/etc/webserver.conf

# misc ---------------------------------------------------

clean:
	-rm -f *.o *.a *.d $(PROJECTNAME)

.PHONY: clean all install

-include $(wildcard $(TESTSRC:.cpp=.d))