aboutsummaryrefslogtreecommitdiffstats
path: root/service/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'service/src/Makefile')
-rw-r--r--service/src/Makefile15
1 files changed, 11 insertions, 4 deletions
diff --git a/service/src/Makefile b/service/src/Makefile
index c46988a..d7732b3 100644
--- a/service/src/Makefile
+++ b/service/src/Makefile
@@ -1,14 +1,21 @@
CFLAGS = -g -I .
+# fortify source code
+CFLAGS += -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2
+LDFLAGS = -Wl,-z,now -Wl,-z,relro
+
.PHONY: all clean
-all: stldoctor
+all: build/stldoctor
clean:
- rm -f stldoctor *.o
+ rm -rf build
+
+build:
+ mkdir build
-%.o: %.c %.h
+build/%.o: %.c %.h | build
$(CC) -c -o $@ $< $(CFLAGS) $(LDLIBS)
-stldoctor: main.c stlfile.o util.o
+build/stldoctor: build/$(PREFIX)stlfile.o build/$(PREFIX)util.o $(PREFIX)main.c | build
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)