1 ## -----------------------------------------------------------------------
3 ## Copyright 2007 H. Peter Anvin - All Rights Reserved
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ## Boston MA 02111-1307, USA; either version 2 of the License, or
9 ## (at your option) any later version; incorporated herein by reference.
11 ## -----------------------------------------------------------------------
17 gcc_ok
= $(shell if gcc
$(1) -c
-x c
/dev
/null
-o
/dev
/null
2>/dev
/null
; \
18 then echo
$(1); else echo
$(2); fi
)
20 M32
:= $(call gcc_ok
,-m32
,) $(call gcc_ok
,-ffreestanding
,) $(call gcc_ok
,-fno-stack-protector
)
24 SFLAGS
= $(M32
) -march
=i386
28 .SUFFIXES
: .S .s .o .elf
34 $(CC
) $(SFLAGS
) -Wa
,-a
=$*.lst
-c
-o
$@
$<
37 $(LD
) -T mbr.
ld -e _start
-o
$@
$<
39 mbr.bin
: mbr.elf checksize.pl
40 $(OBJCOPY
) -O binary
$< $@
41 $(PERL
) checksize.pl mbr.bin
440