1
0

03_enable_hardened_build.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Description: Enable CFLAGS/CPPFLAGS/LDFLAGS from the environment.
  2. Add the ability in the Makefile to pass from the environment values for
  3. CFLAGS, CPPFLAGS and LDFLAGS in order to have a proper hardened build.
  4. Refer to http://wiki.debian.org/Hardening for details.
  5. Author: David Martínez Moreno <ender@debian.org>
  6. Forwarded: no
  7. Last-Update: 2014-01-12
  8. --- a/Makefile
  9. +++ b/Makefile
  10. @@ -40,7 +40,7 @@
  11. CONF_SCRIPTS = aoe-discover aoe-interfaces aoe-mkshelf aoe-revalidate aoe-flush aoe-stat
  12. PROGS = aoeping aoecfg aoe-sancheck
  13. COMMANDS := ${CONF_SCRIPTS} aoe-mkdevs aoe-version coraid-update ${PROGS}
  14. -CFLAGS = -Wall -O -g
  15. +CFLAGS += -Wall -O -g ${CPPFLAGS}
  16. SANCHECKLIBS = -lpthread
  17. AOE_PING_OBJ = aoeping.o linux.o
  18. @@ -68,17 +68,17 @@
  19. rm -f ${CONF_SCRIPTS} ${AOE_PING_OBJ} ${AOE_CFG_OBJ} ${SANCHECK_OBJ} ${PROGS}
  20. aoeping : ${AOE_PING_OBJ}
  21. - ${CC} ${CFLAGS} -o $@ ${AOE_PING_OBJ}
  22. + ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${AOE_PING_OBJ}
  23. aoeping.o : aoeping.c dat.h fns.h
  24. ${CC} ${CFLAGS} -o $@ -c $<
  25. linux.o : linux.c config.h
  26. ${CC} ${CFLAGS} -o $@ -c $<
  27. aoecfg: ${AOE_CFG_OBJ}
  28. - ${CC} ${CFLAGS} -o $@ ${AOE_CFG_OBJ}
  29. + ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${AOE_CFG_OBJ}
  30. aoecfg.o : aoecfg.c dat.h fns.h
  31. ${CC} ${CFLAGS} -o $@ -c $<
  32. aoe-sancheck : ${SANCHECK_OBJ}
  33. - -$(CC) $(CFLAGS) -o $@ ${SANCHECK_OBJ} $(SANCHECKLIBS)
  34. + -$(CC) $(CFLAGS) ${LDFLAGS} -o $@ ${SANCHECK_OBJ} $(SANCHECKLIBS)
  35. aoe-sancheck.o : aoe-sancheck.c
  36. -$(CC) $(CFLAGS) -o $@ -c $<