2 Subject: add compile flags for hardening
3 Author: Joachim Wiedorn <ad_debian at joonet.de>
5 Last-Update: 2013-07-02
7 To support hardening CFLAGS and LDFLAGS must be usable
8 for all compiler commands.
11 diff -urNa s10/src/Makefile s11/src/Makefile
12 --- s10/src/Makefile 2013-06-07 22:44:13.000000000 +0200
13 +++ s11/src/Makefile 2013-07-02 21:08:53.456876190 +0200
15 G=`cat foo1 foo2 | grep version | cut -d " " -f 3`
17 CFLAGS=$(OPT) -Wall $(PCONFIG)
18 -LDFLAGS=#-Xlinker -qmagic
21 OBJS=lilo.o raid.o map.o geometry.o boot.o device.o common.o bsect.o cfg.o \
26 - $(CC) -c $(CFLAGS) $*.c
27 + $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c
30 $(AS86) -w -l $*.lis -o $*.o $*.s
32 dd if=$*.img of=$*.b bs=32 skip=1
35 - $(CC) $(CFLAGS) -DSTANDALONE -o edit $(EDIT) $(LDFLAGS)
36 + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DSTANDALONE -o edit $(EDIT)
38 loader.i: mkloader first.b second.b third.b bitmap.b mbr.b chain.b mbr2.b
43 disk.s: disk.S read.S bdata.h biosdata.S lilo.h Makefile
44 - $(CPP) -traditional $(PCONFIG) -o disk.s disk.S
45 + $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) -o disk.s disk.S
47 mbr.s: mbr.S lilo.h Makefile
48 - $(CPP) -traditional $(PCONFIG) -DMBR=0xafbbe760 \
49 + $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) -DMBR=0xafbbe760 \
53 dd if=$*.img of=$*.b bs=32 skip=49
55 mbr2.s: mbr.S lilo.h Makefile
56 - $(CPP) -traditional $(PCONFIG) -DMBX=0x93c00848 \
57 + $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) -DMBX=0x93c00848 \
61 dd if=$*.img of=$*.b bs=32 skip=49
63 bootsect.s: bootsect.S disk.b
64 - $(CPP) -traditional $(PCONFIG) \
65 + $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
66 -DSIZEDISKB=`wc -c <disk.b | sed "s/ //g"` \
67 -o bootsect.s bootsect.S
69 pseudo1.s: bootsect.S pseudo.S disk.com
70 cat bootsect.S pseudo.S >$(TMP).S
71 - $(CPP) -traditional $(PCONFIG) \
72 + $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
73 -DSIZEKRNL=`wc -c <disk.com | sed "s/ //g"` \
74 -DSIZEDISKB=512 -o pseudo1.s $(TMP).S
77 pseudo2.s: bootsect.S pseudo.S
78 $(MAKE) -C ../diagnose all
79 cat bootsect.S pseudo.S >$(TMP).S
80 - $(CPP) -traditional $(PCONFIG) \
81 + $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
82 -DSIZEKRNL=`wc -c <../diagnose/test4.com | sed "s/ //g"` \
83 -DSIZEDISKB=512 -o pseudo2.s $(TMP).S
86 pseudo3.s: bootsect.S pseudo.S
87 $(MAKE) -C ../diagnose all
88 cat bootsect.S pseudo.S >$(TMP).S
89 - $(CPP) -traditional $(PCONFIG) \
90 + $(CPP) $(CPPFLAGS) -traditional $(PCONFIG) \
91 -DSIZEKRNL=`wc -c <../diagnose/test5.com | sed "s/ //g"` \
92 -DSIZEDISKB=512 -o pseudo3.s $(TMP).S
95 cp -p dparam.S dparam.s
98 - $(CC) -o lilo $(LDFLAGS) $(OBJS) $(LIBS)
99 + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o lilo $(OBJS) $(LIBS)
102 - $(CC) -o lilo.static -static $(LDFLAGS) $(OBJS) $(LIBS)
103 + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o lilo.static -static $(OBJS) $(LIBS)
106 - $(CPP) -C -traditional -DLILO_ASM -o common.s common.h
107 + $(CPP) $(CPPFLAGS) -C -traditional -DLILO_ASM -o common.s common.h
109 bitmap.o: bitmap.s common.s
110 third.o: third.s common.s
111 @@ -191,25 +190,25 @@
112 chain.o: chain.s common.s
114 first.s: first.S lilo.h version.h Makefile
115 - $(CPP) $(PCONFIG) -DFIRST=0x62177489 -o first.s first.S
116 + $(CPP) $(CPPFLAGS) $(PCONFIG) -DFIRST=0x62177489 -o first.s first.S
118 second.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
119 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
120 - $(CPP) $(PCONFIG) -DTEXT=0x9dd476ec second.S -o second.s
121 + $(CPP) $(CPPFLAGS) $(PCONFIG) -DTEXT=0x9dd476ec second.S -o second.s
123 third.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
124 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
125 - $(CPP) $(PCONFIG) -DMENU=0x2012a4a7 second.S -o third.s
126 + $(CPP) $(CPPFLAGS) $(PCONFIG) -DMENU=0x2012a4a7 second.S -o third.s
128 bitmap.s: second.S read.S volume.S mapper.S biosdata.S shs3.S bdata.h lilo.h version.h \
129 graph.S menu.S strlen.S bitmap.S crt.S display4.S Makefile
130 - $(CPP) $(PCONFIG) -DBITMAP=0x2ece2fbe second.S -o bitmap.s
131 + $(CPP) $(CPPFLAGS) $(PCONFIG) -DBITMAP=0x2ece2fbe second.S -o bitmap.s
133 chain.s: chain.S lilo.h version.h first.b Makefile
134 - $(CPP) $(PCONFIG) -DCHAIN=0x536a7646 chain.S -o chain.s
135 + $(CPP) $(CPPFLAGS) $(PCONFIG) -DCHAIN=0x536a7646 chain.S -o chain.s
137 xxx.s: chain.S lilo.h Makefile
138 - $(CPP) chain.S -DXXX -o xxx.s
139 + $(CPP) $(CPPFLAGS) chain.S -DXXX -o xxx.s
143 @@ -254,14 +253,14 @@
146 sed '/\#\#\# Dependencies/q' <Makefile >tmp_make
147 - $(CPP) $(CFLAGS) -MM *.c >>tmp_make
148 + $(CPP) $(CFLAGS) $(CPPFLAGS) -MM *.c >>tmp_make
151 version: common.c lilo.h common.h
152 - $(CC) $(CFLAGS) -DSHS_MAIN -o version common.c
153 + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DSHS_MAIN -o version common.c
156 - $(CC) $(CFLAGS) -DLILO_BINARY -o mkloader temp.c
157 + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -DLILO_BINARY -o mkloader temp.c