summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--make-linux.mk17
1 files changed, 8 insertions, 9 deletions
diff --git a/make-linux.mk b/make-linux.mk
index 871d0ea2..1bc846a4 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -18,15 +18,18 @@ endif
#DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
# Uncomment for a release optimized build
-CFLAGS=-Wall -O3 -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
+LDFLAGS=-pie -Wl,-z,relro,-z,now
STRIP=strip --strip-all
# Uncomment for a debug build
#CFLAGS=-Wall -g -pthread $(INCLUDES) -DZT_TRACE $(DEFS)
+#LDFLAGS=
#STRIP=echo
# Uncomment for gprof profile build
#CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
+#LDFLAGS=
#STRIP=echo
CXXFLAGS=$(CFLAGS) -fno-rtti
@@ -35,20 +38,16 @@ include objects.mk
all: one
-one: $(OBJS)
- $(CXX) $(CXXFLAGS) -o zerotier-one main.cpp $(OBJS) $(LIBS)
+one: $(OBJS) main.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-one main.o $(OBJS) $(LIBS)
$(STRIP) zerotier-one
ln -sf zerotier-one zerotier-cli
ln -sf zerotier-one zerotier-idtool
-selftest: $(OBJS)
- $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.cpp $(OBJS) $(LIBS)
+selftest: $(OBJS) selftest.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -o zerotier-selftest selftest.o $(OBJS) $(LIBS)
$(STRIP) zerotier-selftest
-idtool: $(OBJS)
- $(CXX) $(CXXFLAGS) -o zerotier-idtool idtool.cpp $(OBJS) $(LIBS)
- $(STRIP) zerotier-idtool
-
installer: one FORCE
./buildinstaller.sh