Merge commit 'syslinux-3.60-pre6' into gpxe-support
[profile/ivi/syslinux.git] / mbr / Makefile
index 1772d14..2db358c 100644 (file)
@@ -1,5 +1,5 @@
 ## -----------------------------------------------------------------------
-##   
+##
 ##   Copyright 2007 H. Peter Anvin - All Rights Reserved
 ##
 ##   This program is free software; you can redistribute it and/or modify
 # Makefile for MBR
 #
 
-gcc_ok   = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \
-                  then echo $(1); else echo $(2); fi)
+TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
+
+gcc_ok   = $(shell tmpf=$(TMPFILE); if gcc $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
+                  then echo $(1); else echo $(2); fi; rm -f $$tmpf)
 
-M32       := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,)
+M32       := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector)
 
 CC         = gcc
 LD         = ld -m elf_i386
@@ -33,8 +35,8 @@ all:  mbr.bin
 %.o: %.S
        $(CC) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
 
-mbr.elf: mbr.o
-       $(LD) -Ttext 0x600 -e _start -o $@ $^
+mbr.elf: mbr.o mbr.ld
+       $(LD) -T mbr.ld -e _start -o $@ $<
 
 mbr.bin: mbr.elf checksize.pl
        $(OBJCOPY) -O binary $< $@
@@ -44,4 +46,6 @@ tidy:
        rm -f *.o *.elf *.lst
 
 clean: tidy
+
+spotless: clean
        rm -f *.bin