Skip to content

Commit

Permalink
Adding warnings for debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hassandraga committed Jul 7, 2024
1 parent 923f487 commit 4f6fbc5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 7 additions & 5 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ ARCH_TARGET ?=
# BUILD FLAGS
CIVETWEB_BUILD_FLAGS := -o civetweb.o -I"$(MAKEFILE_DIR)/include/" -c "$(MAKEFILE_DIR)/src/civetweb/civetweb.c" -I"$(WEBUI_TLS_INCLUDE)" $(TLS_CFLAG) -w
CIVETWEB_DEFINE_FLAGS = -DNDEBUG -DNO_CACHING -DNO_CGI -DUSE_WEBSOCKET $(TLS_CFLAG)
WEBUI_BUILD_FLAGS := -o webui.o -I"$(MAKEFILE_DIR)/include/" -c "$(MAKEFILE_DIR)/src/webui.c" -I"$(WEBUI_TLS_INCLUDE)" $(TLS_CFLAG) -w
WEBUI_BUILD_FLAGS := -o webui.o -I"$(MAKEFILE_DIR)/include/" -c "$(MAKEFILE_DIR)/src/webui.c" -I"$(WEBUI_TLS_INCLUDE)" $(TLS_CFLAG)
WARNING_RELEASE := -w
WARNING_LOG := -Wall -Wno-unused

# OUTPUT FILES
# The static output is the same for all platforms
Expand Down Expand Up @@ -109,14 +111,14 @@ endif
@cd "$(BUILD_DIR)/debug" \
&& echo "Build WebUI library ($(CC) $(TARGET)debug static)..." \
&& $(CC) $(TARGET) $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS) -g \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) -g -DWEBUI_LOG \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) -g -DWEBUI_LOG \
&& $(LLVM_OPT)ar rc $(LIB_STATIC_OUT) webui.o civetweb.o $(WEBKIT_OBJ) \
&& $(LLVM_OPT)ranlib $(LIB_STATIC_OUT)
# Dynamic with Debug info
@cd "$(BUILD_DIR)/debug" \
&& echo "Build WebUI library ($(CC) $(TARGET)debug dynamic)..." \
&& $(CC) $(TARGET) $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS) -g -fPIC \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) -g -fPIC -DWEBUI_LOG \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) -g -fPIC -DWEBUI_LOG \
&& $(CC) $(TARGET) -shared -o $(LIB_DYN_OUT) webui.o civetweb.o $(WEBKIT_OBJ) -g -L"$(WEBUI_TLS_LIB)" $(TLS_LDFLAG_DYNAMIC) $(LWS2_OPT) $(WKWEBKIT_LINK_FLAGS)
ifeq ($(PLATFORM),windows)
@cd "$(BUILD_DIR)/debug" && del *.o >nul 2>&1
Expand All @@ -142,14 +144,14 @@ endif
@cd "$(BUILD_DIR)" \
&& echo "Build WebUI library ($(CC) $(TARGET)release static)..." \
&& $(CC) $(TARGET) $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS) -Os \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) -Os \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE) -Os \
&& $(LLVM_OPT)ar rc $(LIB_STATIC_OUT) webui.o civetweb.o $(WEBKIT_OBJ) \
&& $(LLVM_OPT)ranlib $(LIB_STATIC_OUT)
# Dynamic Release
@cd "$(BUILD_DIR)" \
&& echo "Build WebUI library ($(CC) $(TARGET)release dynamic)..." \
&& $(CC) $(TARGET) $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS) -Os -fPIC \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) -O3 -fPIC \
&& $(CC) $(TARGET) $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE) -O3 -fPIC \
&& $(CC) $(TARGET) -shared -o $(LIB_DYN_OUT) webui.o civetweb.o $(WEBKIT_OBJ) -L"$(WEBUI_TLS_LIB)" $(TLS_LDFLAG_DYNAMIC) $(LWS2_OPT) $(WKWEBKIT_LINK_FLAGS)
# Clean
ifeq ($(PLATFORM),windows)
Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ TLS_LDFLAG_DYNAMIC += $(TLS_LDFLAG_DYNAMIC) /LIBPATH:"."
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"
Expand All @@ -46,12 +48,12 @@ debug:
@- 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) /D WEBUI_LOG
@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) /D WEBUI_LOG
@cl /Zi $(WEBUI_BUILD_FLAGS) $(WARNING_LOG) /D WEBUI_LOG
@link $(LIB_DYN_OUT)
# Clean
@- del *.obj >nul 2>&1
Expand All @@ -65,12 +67,12 @@ release:
# Static Release
@echo Build WebUI Library (MSVC Release Static)...
@cl /Zl $(CIVETWEB_BUILD_FLAGS) $(CIVETWEB_DEFINE_FLAGS)
@cl /Zl $(WEBUI_BUILD_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)
@cl $(WEBUI_BUILD_FLAGS) $(WARNING_RELEASE)
@link $(LIB_DYN_OUT)
# Clean
@- del *.pdb >nul 2>&1
Expand Down

0 comments on commit 4f6fbc5

Please sign in to comment.