Adding upstream version 3.50~pre5.
[syslinux-debian/hramrach.git] / mbr / Makefile
blob7662a0a3e274776dfb6ee9d1558a186353a02b4b
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2007 H. Peter Anvin - All Rights Reserved
4 ##
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 ## -----------------------------------------------------------------------
14 # Makefile for MBR
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)
22 CC = gcc
23 LD = ld -m elf_i386
24 SFLAGS = $(M32) -march=i386
25 OBJCOPY = objcopy
26 PERL = perl
28 .SUFFIXES: .S .s .o .elf
30 all: mbr.bin
32 .PRECIOUS: %.o
33 %.o: %.S
34 $(CC) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
36 mbr.elf: mbr.o mbr.ld
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
43 tidy:
44 rm -f *.o *.elf *.lst
46 clean: tidy
47 rm -f *.bin