mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-22 14:23:59 -07:00
allow use of environment variables to set/extend CC, CXX, CFLAGS and LDFLAGS
This commit is contained in:
parent
526aafc64b
commit
3abbe61366
3 changed files with 22 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
CC=cc
|
||||
CXX=c++
|
||||
CC?=cc
|
||||
CXX?=c++
|
||||
|
||||
INCLUDES=
|
||||
DEFS=
|
||||
|
@ -21,15 +21,16 @@ endif
|
|||
# "make debug" is a shortcut for this
|
||||
ifeq ($(ZT_DEBUG),1)
|
||||
# DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
||||
CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
LDFLAGS=
|
||||
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
LDFLAGS+=
|
||||
STRIP=echo
|
||||
# The following line enables optimization for the crypto code, since
|
||||
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS?=-O2 CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
else
|
||||
CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
||||
CFLAGS?=-O3
|
||||
CFLAGS+=-Wall -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||
LDFLAGS+=-pie -Wl,-z,relro,-z,now
|
||||
STRIP=strip --strip-all
|
||||
endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Pick clang or gcc, with preference for clang
|
||||
CC=$(shell which clang gcc cc 2>/dev/null | head -n 1)
|
||||
CXX=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1)
|
||||
CC?=$(shell which clang gcc cc 2>/dev/null | head -n 1)
|
||||
CXX?=$(shell which clang++ g++ c++ 2>/dev/null | head -n 1)
|
||||
|
||||
INCLUDES=
|
||||
DEFS=
|
||||
|
@ -22,15 +22,16 @@ endif
|
|||
# "make debug" is a shortcut for this
|
||||
ifeq ($(ZT_DEBUG),1)
|
||||
# DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
||||
CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
LDFLAGS=
|
||||
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
LDFLAGS+=
|
||||
STRIP=echo
|
||||
# The following line enables optimization for the crypto code, since
|
||||
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS?=-O2 CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
else
|
||||
CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
||||
CFLAGS?=-O3
|
||||
CFLAGS+=-Wall -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||
LDFLAGS+=-pie -Wl,-z,relro,-z,now -static-libstdc++
|
||||
STRIP=strip --strip-all
|
||||
endif
|
||||
|
||||
|
|
11
make-mac.mk
11
make-mac.mk
|
@ -1,5 +1,5 @@
|
|||
CC=clang
|
||||
CXX=clang++
|
||||
CC?=clang
|
||||
CXX?=clang++
|
||||
|
||||
INCLUDES=
|
||||
DEFS=
|
||||
|
@ -27,13 +27,14 @@ endif
|
|||
|
||||
ifeq ($(ZT_DEBUG),1)
|
||||
# DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
||||
CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
CFLAGS+=-Wall -g -pthread $(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.
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS?=-O2 CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||
else
|
||||
CFLAGS=-arch i386 -arch x86_64 -Wall -O3 -flto -fPIE -fvectorize -fstack-protector -pthread -mmacosx-version-min=10.6 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
||||
CFLAGS?=-O3
|
||||
CFLAGS+=-arch i386 -arch x86_64 -Wall -flto -fPIE -fvectorize -fstack-protector -pthread -mmacosx-version-min=10.6 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
||||
STRIP=strip
|
||||
endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue