From 1e7db434e7c5df46dc434c775eff03bc2d84dbf5 Mon Sep 17 00:00:00 2001 From: angt Date: Sat, 24 Oct 2015 19:38:51 +0200 Subject: [PATCH] Update Makefile --- Makefile | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 04cab62..13125d0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,37 @@ -CFLAGS=-std=c99 -g -fsanitize=address -fno-omit-frame-pointer -Wall +CC := gcc +LDFLAGS := -Wl,-O1,--sort-common,--as-needed +CFLAGS := -std=c99 -ffreestanding -Wall -Wextra -glorytun: +prefix := /usr/local -setcap: glorytun - sudo setcap cap_net_admin+ep glorytun +ifdef temps +CFLAGS += -save-temps +endif + +ifdef debug +CFLAGS += -O0 -fno-omit-frame-pointer -g +else +CFLAGS += -O3 -fomit-frame-pointer -DNDEBUG +endif + +ifdef sanitize +CFLAGS += -fsanitize=$(sanitize) +endif + +.PHONY: default install clean setcap + +default: glorytun + +install: + install -m 755 -d $(DESTDIR)$(prefix)/bin + install -m 755 -s glorytun $(DESTDIR)$(prefix)/bin + +clean: + @rm -f *.[ios] glorytun + +setcap: + setcap cap_net_admin+ep glorytun + +glorytun: glorytun.o +glorytun.c: common-static.h +common-static.h: common.h