summaryrefslogtreecommitdiffhomepage
path: root/plugins/webbox/Makefile
blob: 39a2c8c95c30c396b17822d65ca1b4b2946a814b (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
include ../../common.mk

PROJECTNAME=webbox

CXXFLAGS+= -fvisibility=hidden -fPIC

CXXFLAGS+= -I../..

LDLIBS=\
-lcommon \
-lboost_context \
-lboost_coroutine \
-lboost_program_options \
-lboost_system \
-lboost_thread \
-lboost_filesystem \
-lboost_regex \
-lpthread \
-lssl -lcrypto \
-ldl

LDFLAGS=-L../../libcommon

PROGSRC=\
    webbox.cpp

SRC=$(PROGSRC)

all: $(PROJECTNAME).so

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

../../libcommon/libcommon.a:
	cd ../.. && $(MAKE) libcommon/libcommon.a

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

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

# dependencies

ADD_DEP=Makefile

install:
	mkdir -p $(DESTDIR)/usr/lib/webserver/plugins
	cp $(PROJECTNAME).so $(DESTDIR)/usr/lib/webserver/plugins

	mkdir -p $(DESTDIR)/usr/lib/webbox/html
	cp -r html/* $(DESTDIR)/usr/lib/webbox/html/

	uglifyjs html/webbox.js -m -c > $(DESTDIR)/usr/lib/webbox/html/webbox.js
	htmlmin html/index.html $(DESTDIR)/usr/lib/webbox/html/index.html
	cleancss -o $(DESTDIR)/usr/lib/webbox/html/webbox.css html/webbox.css

# misc ---------------------------------------------------
clean:
	-rm -f *.o *.so *.d

.PHONY: clean all install

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