More makefile changes.

This commit is contained in:
Adam Ierymenko 2017-05-08 14:46:45 -07:00
parent 505b9c7f56
commit cf49e511a5
3 changed files with 40 additions and 28 deletions

View File

@ -14,10 +14,10 @@ endif
# "make debug" is a shortcut for this # "make debug" is a shortcut for this
ifeq ($(ZT_DEBUG),1) ifeq ($(ZT_DEBUG),1)
DEFS+=-DZT_TRACE CFLAGS+=-Wall -Werror -g -pthread $(INCLUDES) $(DEFS)
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
LDFLAGS+= LDFLAGS+=
STRIP=echo STRIP=echo
ZT_TRACE=1
# The following line enables optimization for the crypto code, since # The following line enables optimization for the crypto code, since
# C25519 in particular is almost UNUSABLE in heavy testing without it. # C25519 in particular is almost UNUSABLE in heavy testing without it.
node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS) node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
@ -28,6 +28,10 @@ else
STRIP=strip --strip-all STRIP=strip --strip-all
endif endif
ifeq ($(ZT_TRACE),1)
DEFS+=-DZT_TRACE
endif
# Determine system build architecture from compiler target # Determine system build architecture from compiler target
CC_MACH=$(shell $(CC) -dumpmachine | cut -d '-' -f 1) CC_MACH=$(shell $(CC) -dumpmachine | cut -d '-' -f 1)
ZT_ARCHITECTURE=999 ZT_ARCHITECTURE=999

View File

@ -55,10 +55,10 @@ ifeq ($(ZT_RULES_ENGINE_DEBUGGING),1)
endif endif
ifeq ($(ZT_DEBUG),1) ifeq ($(ZT_DEBUG),1)
override DEFS+=-DZT_TRACE override CFLAGS+=-Wall -Werror -g -pthread $(INCLUDES) $(DEFS)
override CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS) override CXXFLAGS+=-Wall -Werror -g -std=c++11 -pthread $(INCLUDES) $(DEFS)
override CXXFLAGS+=-Wall -g -std=c++11 -pthread $(INCLUDES) $(DEFS)
override LDFLAGS+= override LDFLAGS+=
ZT_TRACE=1
STRIP?=echo STRIP?=echo
# The following line enables optimization for the crypto code, since # The following line enables optimization for the crypto code, since
# C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box! # C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
@ -66,14 +66,18 @@ node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CXXFLAGS=-Wall -O2 -
else else
override DEFS+=-D_FORTIFY_SOURCE=2 override DEFS+=-D_FORTIFY_SOURCE=2
CFLAGS?=-O3 -fstack-protector CFLAGS?=-O3 -fstack-protector
override CFLAGS+=-Wall -fPIE -pthread $(INCLUDES) -DNDEBUG $(DEFS) override CFLAGS+=-Wall -Werror -fPIE -pthread $(INCLUDES) -DNDEBUG $(DEFS)
CXXFLAGS?=-O3 -fstack-protector CXXFLAGS?=-O3 -fstack-protector
override CXXFLAGS+=-Wall -Wno-unused-result -Wreorder -fPIE -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS) override CXXFLAGS+=-Wall -Werror -Wno-unused-result -Wreorder -fPIE -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
override LDFLAGS+=-pie -Wl,-z,relro,-z,now override LDFLAGS+=-pie -Wl,-z,relro,-z,now
STRIP?=strip STRIP?=strip
STRIP+=--strip-all STRIP+=--strip-all
endif endif
ifeq ($(ZT_TRACE),1)
override DEFS+=-DZT_TRACE
endif
ifeq ($(ZT_USE_TEST_TAP),1) ifeq ($(ZT_USE_TEST_TAP),1)
override DEFS+=-DZT_USE_TEST_TAP override DEFS+=-DZT_USE_TEST_TAP
endif endif

View File

@ -47,18 +47,22 @@ ONE_OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o ext/miniupnpc/connec
# Debug mode -- dump trace output, build binary with -g # Debug mode -- dump trace output, build binary with -g
ifeq ($(ZT_DEBUG),1) ifeq ($(ZT_DEBUG),1)
DEFS+=-DZT_TRACE ZT_TRACE=1
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS) CFLAGS+=-Wall -Werror -g $(INCLUDES) $(DEFS)
STRIP=echo STRIP=echo
# The following line enables optimization for the crypto code, since # The following line enables optimization for the crypto code, since
# C25519 in particular is almost UNUSABLE in heavy testing without it. # C25519 in particular is almost UNUSABLE in heavy testing without it.
node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS) node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g $(INCLUDES) $(DEFS)
else else
CFLAGS?=-Ofast -fstack-protector-strong CFLAGS?=-Ofast -fstack-protector-strong
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -pthread -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS) CFLAGS+=$(ARCH_FLAGS) -Wall -Werror -flto -fPIE -mmacosx-version-min=10.7 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
STRIP=strip STRIP=strip
endif endif
ifeq ($(ZT_TRACE),1)
DEFS+=-DZT_TRACE
endif
CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libc++ CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libc++
all: one macui all: one macui