2020-11-22 22:44:21 +00:00
|
|
|
# Build application with GUI (tray, main window)
|
|
|
|
USE_WIN32_APP := yes
|
|
|
|
|
2018-07-20 19:55:41 +00:00
|
|
|
WINDRES = windres
|
2020-11-22 22:44:21 +00:00
|
|
|
|
|
|
|
CXXFLAGS := $(CXX_DEBUG) -D_MT -DWIN32_LEAN_AND_MEAN -fPIC -msse
|
2020-11-17 14:59:40 +00:00
|
|
|
INCFLAGS = -I$(DAEMON_SRC_DIR) -IWin32
|
2020-11-22 22:44:21 +00:00
|
|
|
LDFLAGS := ${LD_DEBUG} -Wl,-Bstatic -static-libgcc
|
2018-07-20 19:55:41 +00:00
|
|
|
|
2020-05-14 18:52:33 +00:00
|
|
|
# detect proper flag for c++11 support by compilers
|
|
|
|
CXXVER := $(shell $(CXX) -dumpversion)
|
|
|
|
ifeq ($(shell expr match ${CXXVER} "[4]\.[7-9]\|4\.1[0-9]\|[5-6]"),4) # gcc 4.7 - 6
|
|
|
|
NEEDED_CXXFLAGS += -std=c++11
|
2020-05-14 19:45:25 +00:00
|
|
|
else ifeq ($(shell expr match ${CXXVER} "[1,7-9]"),1) # gcc >= 7
|
2020-05-14 18:52:33 +00:00
|
|
|
NEEDED_CXXFLAGS += -std=c++17
|
|
|
|
else # not supported
|
|
|
|
$(error Compiler too old)
|
|
|
|
endif
|
|
|
|
|
2018-12-14 06:29:41 +00:00
|
|
|
# Boost libraries suffix
|
|
|
|
BOOST_SUFFIX = -mt
|
|
|
|
|
2018-07-20 19:55:41 +00:00
|
|
|
# UPNP Support
|
|
|
|
ifeq ($(USE_UPNP),yes)
|
|
|
|
CXXFLAGS += -DUSE_UPNP -DMINIUPNP_STATICLIB
|
|
|
|
LDLIBS = -lminiupnpc
|
|
|
|
endif
|
|
|
|
|
|
|
|
LDLIBS += \
|
2018-12-14 18:44:38 +00:00
|
|
|
-lboost_system$(BOOST_SUFFIX) \
|
|
|
|
-lboost_date_time$(BOOST_SUFFIX) \
|
|
|
|
-lboost_filesystem$(BOOST_SUFFIX) \
|
|
|
|
-lboost_program_options$(BOOST_SUFFIX) \
|
2018-07-20 19:55:41 +00:00
|
|
|
-lssl \
|
|
|
|
-lcrypto \
|
|
|
|
-lz \
|
|
|
|
-lwsock32 \
|
|
|
|
-lws2_32 \
|
|
|
|
-lgdi32 \
|
|
|
|
-liphlpapi \
|
2020-04-12 02:25:22 +00:00
|
|
|
-lole32 \
|
|
|
|
-luuid \
|
2018-07-20 19:55:41 +00:00
|
|
|
-lpthread
|
|
|
|
|
|
|
|
ifeq ($(USE_WIN32_APP), yes)
|
2020-11-14 22:31:20 +00:00
|
|
|
NEEDED_CXXFLAGS += -DWIN32_APP
|
2018-07-20 19:55:41 +00:00
|
|
|
LDFLAGS += -mwindows
|
|
|
|
DAEMON_RC += Win32/Resource.rc
|
|
|
|
DAEMON_OBJS += $(patsubst %.rc,obj/%.o,$(DAEMON_RC))
|
|
|
|
endif
|
|
|
|
|
2019-11-19 10:50:16 +00:00
|
|
|
ifeq ($(USE_WINXP_FLAGS), yes)
|
2020-11-14 22:31:20 +00:00
|
|
|
NEEDED_CXXFLAGS += -DWINVER=0x0501 -D_WIN32_WINNT=0x0501
|
2019-11-19 10:50:16 +00:00
|
|
|
endif
|
|
|
|
|
2020-11-14 22:31:20 +00:00
|
|
|
ifeq ($(USE_AESNI),yes)
|
|
|
|
NEEDED_CXXFLAGS += -D__AES__ -maes
|
2018-07-20 19:55:41 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(USE_ASLR),yes)
|
|
|
|
LDFLAGS += -Wl,--nxcompat -Wl,--high-entropy-va -Wl,--dynamicbase,--export-all-symbols
|
|
|
|
endif
|
|
|
|
|
|
|
|
obj/%.o : %.rc
|
|
|
|
$(WINDRES) -i $< -o $@
|