From 88b0d668394c22a1097b0cb80347d839abbf804d Mon Sep 17 00:00:00 2001 From: Riccardo Murri Date: Tue, 30 May 2017 16:20:48 +0200 Subject: [PATCH 1/3] Add Makefile target for debug compilation --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bda7689..1e128e8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -CFLAGS ?= -Wall -Werror -g +CFLAGS ?= -Wall -Werror LDFLAGS ?= PROG := su-exec @@ -13,5 +13,8 @@ $(PROG): $(SRCS) $(PROG)-static: $(SRCS) $(CC) $(CFLAGS) -o $@ $^ -static $(LDFLAGS) +$(PROG)-debug: $(SRCS) + $(CC) -g $(CFLAGS) -o $@ $^ $(LDFLAGS) + clean: - rm -f $(PROG) $(PROG)-static + rm -f $(PROG) $(PROG)-static $(PROG)-debug From f4d37b2f1cf50b9aa1cc2f2650bfae758dfe85b0 Mon Sep 17 00:00:00 2001 From: Riccardo Murri Date: Tue, 30 May 2017 16:22:35 +0200 Subject: [PATCH 2/3] Strip non-debug binaries. This brings down `su-exec` to 11kB and `su-exec-static` to 853kB on my Ubuntu 16.04 x86_64. --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 1e128e8..0eead54 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,11 @@ all: $(PROG) $(PROG): $(SRCS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) + strip $@ $(PROG)-static: $(SRCS) $(CC) $(CFLAGS) -o $@ $^ -static $(LDFLAGS) + strip $@ $(PROG)-debug: $(SRCS) $(CC) -g $(CFLAGS) -o $@ $^ $(LDFLAGS) From 5a4e10b56fe8d1f9820f3aab5636ed1f94d9f4e6 Mon Sep 17 00:00:00 2001 From: Riccardo Murri Date: Wed, 31 May 2017 13:38:06 +0200 Subject: [PATCH 3/3] git ignore also the `-static` and `-debug` variants of exe file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ac47793..94e08f0 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ *.dSYM/ su-exec +su-exec-static +su-exec-debug