File: makefile-hardening.patch

package info (click to toggle)
spline 1.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 164 kB
  • sloc: ansic: 355; makefile: 193; sh: 35
file content (32 lines) | stat: -rw-r--r-- 961 bytes parent folder | download | duplicates (4)
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