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
ifeq ($(ZT_DEBUG),1)
DEFS+=-DZT_TRACE
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
CFLAGS+=-Wall -Werror -g -pthread $(INCLUDES) $(DEFS)
LDFLAGS+=
STRIP=echo
ZT_TRACE=1
# The following line enables optimization for the crypto code, since
# 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)
@ -28,80 +28,84 @@ else
STRIP=strip --strip-all
endif
ifeq ($(ZT_TRACE),1)
DEFS+=-DZT_TRACE
endif
# Determine system build architecture from compiler target
CC_MACH=$(shell $(CC) -dumpmachine | cut -d '-' -f 1)
ZT_ARCHITECTURE=999
ifeq ($(CC_MACH),x86_64)
ZT_ARCHITECTURE=2
ZT_ARCHITECTURE=2
ZT_USE_X64_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),amd64)
ZT_ARCHITECTURE=2
ZT_ARCHITECTURE=2
ZT_USE_X64_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),i386)
ZT_ARCHITECTURE=1
ZT_ARCHITECTURE=1
endif
ifeq ($(CC_MACH),i686)
ZT_ARCHITECTURE=1
ZT_ARCHITECTURE=1
endif
ifeq ($(CC_MACH),arm)
ZT_ARCHITECTURE=3
ZT_ARCHITECTURE=3
override DEFS+=-DZT_NO_TYPE_PUNNING
ZT_USE_ARM32_NEON_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),armel)
ZT_ARCHITECTURE=3
ZT_ARCHITECTURE=3
override DEFS+=-DZT_NO_TYPE_PUNNING
ZT_USE_ARM32_NEON_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),armhf)
ZT_ARCHITECTURE=3
ZT_ARCHITECTURE=3
override DEFS+=-DZT_NO_TYPE_PUNNING
ZT_USE_ARM32_NEON_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),armv6)
ZT_ARCHITECTURE=3
ZT_ARCHITECTURE=3
override DEFS+=-DZT_NO_TYPE_PUNNING
ZT_USE_ARM32_NEON_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),armv6zk)
ZT_ARCHITECTURE=3
ZT_ARCHITECTURE=3
override DEFS+=-DZT_NO_TYPE_PUNNING
ZT_USE_ARM32_NEON_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),armv6kz)
ZT_ARCHITECTURE=3
ZT_ARCHITECTURE=3
override DEFS+=-DZT_NO_TYPE_PUNNING
ZT_USE_ARM32_NEON_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),armv7)
ZT_ARCHITECTURE=3
ZT_ARCHITECTURE=3
override DEFS+=-DZT_NO_TYPE_PUNNING
ZT_USE_ARM32_NEON_ASM_SALSA2012=1
endif
ifeq ($(CC_MACH),arm64)
ZT_ARCHITECTURE=4
ZT_ARCHITECTURE=4
override DEFS+=-DZT_NO_TYPE_PUNNING
endif
ifeq ($(CC_MACH),aarch64)
ZT_ARCHITECTURE=4
ZT_ARCHITECTURE=4
override DEFS+=-DZT_NO_TYPE_PUNNING
endif
ifeq ($(CC_MACH),mipsel)
ZT_ARCHITECTURE=5
ZT_ARCHITECTURE=5
override DEFS+=-DZT_NO_TYPE_PUNNING
endif
ifeq ($(CC_MACH),mips)
ZT_ARCHITECTURE=5
ZT_ARCHITECTURE=5
override DEFS+=-DZT_NO_TYPE_PUNNING
endif
ifeq ($(CC_MACH),mips64)
ZT_ARCHITECTURE=6
ZT_ARCHITECTURE=6
override DEFS+=-DZT_NO_TYPE_PUNNING
endif
ifeq ($(CC_MACH),mips64el)
ZT_ARCHITECTURE=6
ZT_ARCHITECTURE=6
override DEFS+=-DZT_NO_TYPE_PUNNING
endif

View File

@ -55,10 +55,10 @@ ifeq ($(ZT_RULES_ENGINE_DEBUGGING),1)
endif
ifeq ($(ZT_DEBUG),1)
override DEFS+=-DZT_TRACE
override CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
override CXXFLAGS+=-Wall -g -std=c++11 -pthread $(INCLUDES) $(DEFS)
override CFLAGS+=-Wall -Werror -g -pthread $(INCLUDES) $(DEFS)
override CXXFLAGS+=-Wall -Werror -g -std=c++11 -pthread $(INCLUDES) $(DEFS)
override LDFLAGS+=
ZT_TRACE=1
STRIP?=echo
# The following line enables optimization for the crypto code, since
# 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
override DEFS+=-D_FORTIFY_SOURCE=2
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
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
STRIP?=strip
STRIP+=--strip-all
endif
ifeq ($(ZT_TRACE),1)
override DEFS+=-DZT_TRACE
endif
ifeq ($(ZT_USE_TEST_TAP),1)
override DEFS+=-DZT_USE_TEST_TAP
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
ifeq ($(ZT_DEBUG),1)
DEFS+=-DZT_TRACE
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
ZT_TRACE=1
CFLAGS+=-Wall -Werror -g $(INCLUDES) $(DEFS)
STRIP=echo
# The following line enables optimization for the crypto code, since
# 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
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
endif
ifeq ($(ZT_TRACE),1)
DEFS+=-DZT_TRACE
endif
CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libc++
all: one macui