-
Notifications
You must be signed in to change notification settings - Fork 186
/
Makefile
92 lines (78 loc) · 2.72 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
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
# WebUI Library
# Windows - Microsoft Visual C
# == 1. VARIABLES =============================================================
WEBUI_OUT_LIB_NAME = webui-2
TLS_CFLAG = /DNO_SSL
# TLS Enabled
!IF "$(WEBUI_USE_TLS)" == "1"
WEBUI_OUT_LIB_NAME = webui-2-secure
TLS_CFLAG = /DWEBUI_TLS /DNO_SSL_DL /DOPENSSL_API_1_1
TLS_LDFLAG_DYNAMIC = libssl.lib libcrypto.lib
!IF "$(WEBUI_TLS_INCLUDE)" != ""
TLS_CFLAG = $(TLS_CFLAG) /I"$(WEBUI_TLS_INCLUDE)"
!ELSE
TLS_CFLAG = $(TLS_CFLAG) /I"."
!ENDIF
!IF "$(WEBUI_TLS_LIB)" != ""
TLS_LDFLAG_DYNAMIC = $(TLS_LDFLAG_DYNAMIC) /LIBPATH:"$(WEBUI_TLS_LIB)"
!ELSE
TLS_LDFLAG_DYNAMIC += $(TLS_LDFLAG_DYNAMIC) /LIBPATH:"."
!ENDIF
!ENDIF
# Build Flags
CIVETWEB_BUILD_FLAGS = /Fo"civetweb.obj" /c /EHsc "$(MAKEDIR)/src/civetweb/civetweb.c" /I"$(MAKEDIR)/src/civetweb/" $(TLS_CFLAG)
CIVETWEB_DEFINE_FLAGS = /D NDEBUG /D NO_CACHING /D NO_CGI /D USE_WEBSOCKET
WEBUI_BUILD_FLAGS = /Fo"webui.obj" /c /EHsc "$(MAKEDIR)/src/webui.c" /I"$(MAKEDIR)/include" /I"$(WEBUI_TLS_INCLUDE)" $(TLS_CFLAG)
WARNING_RELEASE = /w
WARNING_LOG = /W4
# Output Commands
LIB_STATIC_OUT = /OUT:"$(WEBUI_OUT_LIB_NAME)-static.lib" "webui.obj" "civetweb.obj"
LIB_DYN_OUT = /DLL /OUT:"$(WEBUI_OUT_LIB_NAME).dll" "webui.obj" "civetweb.obj" user32.lib Advapi32.lib Shell32.lib Ole32.lib $(TLS_LDFLAG_DYNAMIC)
# == 2.TARGETS ================================================================
all: release
debug:
@- mkdir dist\debug >nul 2>&1
# Static with Debug info
@- cd $(MAKEDIR)/dist/debug
@echo Build WebUI Library (MSVC Debug Static)...
@cl /Zl /Zi $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS)
@cl /Zl /Zi $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) /D WEBUI_LOG
@lib $(LIB_STATIC_OUT)
# Dynamic with Debug info
@echo Build WebUI Library (MSVC Debug Dynamic)...
@cl /Zi $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS)
@cl /Zi $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) /D WEBUI_LOG /D WEBUI_DYNAMIC
@link $(LIB_DYN_OUT)
# Clean
@- del *.obj >nul 2>&1
@- del *.ilk >nul 2>&1
@- del *.exp >nul 2>&1
@echo Done.
release:
@- mkdir dist >nul 2>&1
@- cd $(MAKEDIR)/dist
# Static Release
@echo Build WebUI Library (MSVC Release Static)...
@cl /Zl $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS)
@cl /Zl $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE)
@lib $(LIB_STATIC_OUT)
# Dynamic Release
@echo Build WebUI Library (MSVC Release Dynamic)...
@cl $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS)
@cl $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE) /D WEBUI_DYNAMIC
@link $(LIB_DYN_OUT)
# Clean
@- del *.pdb >nul 2>&1
@- del *.obj >nul 2>&1
@- del *.ilk >nul 2>&1
@- del *.exp >nul 2>&1
@- echo Done.
clean:
@- cd $(BUILD_DIR)
@- del *.pdb >nul 2>&1
@- del *.obj >nul 2>&1
@- del *.ilk >nul 2>&1
@- del *.exp >nul 2>&1
@- del *.dll >nul 2>&1
@- del *.lib >nul 2>&1
@- echo Done.