-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (49 loc) · 1.38 KB
/
Makefile
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
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# OS specific
ifeq ($(OS),Windows_NT)
CXXFLAGS+=-DWEBVIEW_WINAPI=1 -lole32 -lcomctl32 -loleaut32 -luuid -mwindows
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CXXFLAGS+=-DWEBVIEW_GTK=1 `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0`
endif
ifeq ($(UNAME_S),Darwin)
CXXFLAGS+=-DWEBVIEW_COCOA=1 -x objective-c -framework Cocoa -framework WebKit
endif
endif
# Generic Makefile
APPNAME=webgui
# User defined
#HEADERS=
SRCS= $(ROOT_DIR)/src/main.cc
RES= resources/html/index.html \
resources/js/drawMainCanvas.js
# Auto generated temporaries
OBJS= $(notdir $(SRCS:.cc=.o))
RAWS= $(addprefix static/, $(RES))
#PCH=$(HEADERS).gch
## includes
CXXFLAGS+=-I$(ROOT_DIR)/deps/pistache/include -I$(ROOT_DIR)/deps -I.
## libraries
LDFLAGS+=-lpistache -pthread -L$(ROOT_DIR)/deps/pistache/build/src
# flags
CXXFLAGS+=-O3 -DNDEBUG -std=c++14
all: app
debug: CXXFLAGS+=-DDEBUG -g
debug: app
app: $(RAWS) $(OBJS) $(PCH)
$(CXX) $(OBJS) $(CXXFLAGS) $(LDFLAGS) -o $(APPNAME)
#$(PCH): $(HEADERS)
#$(CXX) $(CXX_CFLAGS) -x c++-header $(PCH)
$(RAWS): static/% : $(ROOT_DIR)/%
mkdir -p $(@D)
cp $< $@
sed -i '1s/^/R"external(/' $@
sed -i '$$s/$$/)external"/' $@
%.o: $(ROOT_DIR)/src/%.cc
$(CXX) -c $< -O3 $(CXXFLAGS) -o $@
clean:
-rm ./*.o 2>/dev/null
-rm ./$(APPNAME)
-rm ./$(RAWS)
rm -rd ./static