1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Description: Enable hardening of binary
Ensure appropriate build system variables from CPPFLAGS, CFLAGS and LDFLAGS
make it through to the compiler.
Author: Stuart Prescott <stuart@debian.org>
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,6 @@
RM = rm -f
CC = gcc
-CFLAGS = -g
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-CFLAGS += -O0
-else
-CFLAGS += -O2
-endif
CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes\
-Wmissing-declarations -Wbad-function-cast -Wnested-externs\
-Wcast-qual -Wcast-align -Wshadow -Wwrite-strings -Wpointer-arith\
@@ -37,10 +31,10 @@
all: $(BIN)
.c.o: $(SRCS)
- $(CC) $(CFLAGS) $(DEFS) -c -o $@ $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) -c -o $@ $<
$(BIN): $(SRCS) $(OBJS) $(BIN).c
- $(CC) $(CFLAGS) $(DEFS) -o $(BIN) $(BIN).c $(OBJS) $(LIBS)
+ $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(LDFLAGS) -o $(BIN) $(BIN).c $(OBJS) $(LIBS)
clean:
$(RM) *.o *~ *.bak \#*\# errors core* a.out TAGS *.out
|