e9fc38758d9381b9b297cc187b7f83e431d48402
[profile/ivi/syslinux.git] / mbr / Makefile
1 ## -----------------------------------------------------------------------
2 ##
3 ##   Copyright 2007-2008 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.
10 ##
11 ## -----------------------------------------------------------------------
12
13 #
14 # Makefile for MBR
15 #
16
17 topdir = ..
18 include $(topdir)/MCONFIG.embedded
19
20 all:    mbr.bin altmbr.bin gptmbr.bin isohdpfx.bin
21
22 .PRECIOUS: %.o
23 %.o: %.S
24         $(CC) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
25
26 .PRECIOUS: %.elf
27 %.elf: %.o mbr.ld
28         $(LD) $(LDFLAGS) -T mbr.ld -e _start -o $@ $<
29
30 mbr.bin: mbr.elf checksize.pl
31         $(OBJCOPY) -O binary $< $@
32         $(PERL) checksize.pl $@ 440
33
34 altmbr.bin: altmbr.elf checksize.pl
35         $(OBJCOPY) -O binary $< $@
36         $(PERL) checksize.pl $@ 439 440
37
38 isohdpfx.bin: isohdpfx.elf checksize.pl
39         $(OBJCOPY) -O binary $< $@
40         $(PERL) checksize.pl $@ 432
41
42 mbr_bin.c: mbr.bin
43
44 gptmbr.bin: gptmbr.elf checksize.pl
45         $(OBJCOPY) -O binary $< $@
46         $(PERL) checksize.pl $@ 424
47
48 tidy dist:
49         rm -f *.o *.elf *.lst
50
51 clean: tidy
52
53 spotless: clean
54         rm -f *.bin