diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | com32/lib/MCONFIG | 7 | ||||
-rw-r--r-- | com32/libutil/Makefile | 2 | ||||
-rw-r--r-- | com32/modules/Makefile | 2 | ||||
-rw-r--r-- | com32/samples/Makefile | 2 | ||||
-rw-r--r-- | dos/Makefile | 7 | ||||
-rw-r--r-- | dummy.c | 8 | ||||
-rw-r--r-- | extlinux/Makefile | 8 | ||||
-rw-r--r-- | mbr/Makefile | 2 | ||||
-rw-r--r-- | memdisk/Makefile | 2 | ||||
-rw-r--r-- | menu/Makefile | 2 | ||||
-rw-r--r-- | mtools/Makefile | 8 | ||||
-rw-r--r-- | sample/Makefile | 2 | ||||
-rw-r--r-- | unix/Makefile | 8 |
14 files changed, 56 insertions, 14 deletions
@@ -1,6 +1,6 @@ ## ----------------------------------------------------------------------- ## -## Copyright 1998-2006 H. Peter Anvin - All Rights Reserved +## Copyright 1998-2007 H. Peter Anvin - All Rights Reserved ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -17,12 +17,18 @@ # No builtin rules MAKEFLAGS = -r +gcc_ok = $(shell if gcc $(1) dummy.c -o /dev/null 2>/dev/null; \ + then echo '$(1)'; else echo '$(2)'; fi) + +comma := , +LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,) + OSTYPE = $(shell uname -msr) CC = gcc INCLUDE = CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 PIC = -fPIC -LDFLAGS = -O2 -s +LDFLAGS = -O2 -s $(LDHASH) AR = ar RANLIB = ranlib diff --git a/com32/lib/MCONFIG b/com32/lib/MCONFIG index 39b62db1..461ada44 100644 --- a/com32/lib/MCONFIG +++ b/com32/lib/MCONFIG @@ -1,5 +1,10 @@ # -*- makefile -*- +gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ + then echo $(1); else echo $(2); fi) + +GCCOPT := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) + CC = gcc LD = ld INCLUDE = -I. @@ -21,7 +26,7 @@ LIBFLAGS = -DDYNAMIC_CRC_TABLE -DPNG_NO_CONSOLE_IO \ # fallback anyway, just use that on old machines... # LIBFLAGS += -DPNG_NO_FLOATING_POINT_SUPPORTED -REQFLAGS = -g -m32 -mregparm=3 -DREGPARM=3 -D__COM32__ -I. -I./sys -I../include +REQFLAGS = $(GCCOPT) -g -mregparm=3 -DREGPARM=3 -D__COM32__ -I. -I./sys -I../include OPTFLAGS = -Os -march=i386 -falign-functions=0 -falign-jumps=0 \ -falign-labels=0 -ffast-math -fomit-frame-pointer WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline diff --git a/com32/libutil/Makefile b/com32/libutil/Makefile index 9adeec66..8976ebd8 100644 --- a/com32/libutil/Makefile +++ b/com32/libutil/Makefile @@ -32,7 +32,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ then echo $(1); else echo $(2); fi) -M32 := $(call gcc_ok,-m32,) +M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno_stack_protector,) CC = gcc LD = ld -m elf_i386 diff --git a/com32/modules/Makefile b/com32/modules/Makefile index 3c272f26..877ce399 100644 --- a/com32/modules/Makefile +++ b/com32/modules/Makefile @@ -17,7 +17,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ then echo $(1); else echo $(2); fi) -M32 := $(call gcc_ok,-m32,) +M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) CC = gcc LD = ld -m elf_i386 diff --git a/com32/samples/Makefile b/com32/samples/Makefile index 213ae1a3..291413a6 100644 --- a/com32/samples/Makefile +++ b/com32/samples/Makefile @@ -17,7 +17,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ then echo $(1); else echo $(2); fi) -M32 := $(call gcc_ok,-m32,) +M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) CC = gcc LD = ld -m elf_i386 diff --git a/dos/Makefile b/dos/Makefile index 61423cec..5fd52d1b 100644 --- a/dos/Makefile +++ b/dos/Makefile @@ -1,9 +1,14 @@ +gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ + then echo $(1); else echo $(2); fi) + +M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,) + CC = gcc LD = ld -m elf_i386 OBJCOPY = objcopy OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer INCLUDES = -include code16.h -I. -I.. -I../libfat -CFLAGS = -m32 -mregparm=3 -DREGPARM=3 -W -Wall -ffreestanding -msoft-float $(OPTFLAGS) $(INCLUDES) +CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES) LDFLAGS = -T com16.ld AR = ar RANLIB = ranlib diff --git a/dummy.c b/dummy.c new file mode 100644 index 00000000..81f2586c --- /dev/null +++ b/dummy.c @@ -0,0 +1,8 @@ +/* + * Trivial C program to test the compiler + */ + +int main(int argc, char *argv[]) +{ + return 0; +} diff --git a/extlinux/Makefile b/extlinux/Makefile index a450a3dc..8d347a98 100644 --- a/extlinux/Makefile +++ b/extlinux/Makefile @@ -1,8 +1,14 @@ +gcc_ok = $(shell if gcc $(1) ../dummy.c -o /dev/null 2>/dev/null; \ + then echo '$(1)'; else echo '$(2)'; fi) + +comma := , +LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,) + CC = gcc OPTFLAGS = -g -Os INCLUDES = -I. -I.. -I../libfat CFLAGS = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) -LDFLAGS = -s +LDFLAGS = $(LDHASH) -s SRCS = extlinux.c ../extlinux_bss_bin.c ../extlinux_sys_bin.c OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS))) diff --git a/mbr/Makefile b/mbr/Makefile index 75da4484..d61f7f1c 100644 --- a/mbr/Makefile +++ b/mbr/Makefile @@ -17,7 +17,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ then echo $(1); else echo $(2); fi) -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 diff --git a/memdisk/Makefile b/memdisk/Makefile index 1eebe637..72234cab 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -17,7 +17,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ M32 := $(call gcc_ok,-m32,) ALIGN := $(call gcc_ok,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0) -FREE := $(call gcc_ok,-ffreestanding,) +FREE := $(call gcc_ok,-ffreestanding,) $(call gcc_ok,-fno-stack-protector,) CC = gcc CFLAGS = $(M32) $(FREE) -g -W -Wall -Wno-sign-compare \ diff --git a/menu/Makefile b/menu/Makefile index 91a8697e..cee1c3af 100644 --- a/menu/Makefile +++ b/menu/Makefile @@ -17,7 +17,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ then echo $(1); else echo $(2); fi) -M32 := $(call gcc_ok,-m32,) +M32 := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) CC = gcc LD = ld -m elf_i386 diff --git a/mtools/Makefile b/mtools/Makefile index 26909a30..546e3d14 100644 --- a/mtools/Makefile +++ b/mtools/Makefile @@ -1,8 +1,14 @@ +gcc_ok = $(shell if gcc $(1) ../dummy.c -o /dev/null 2>/dev/null; \ + then echo '$(1)'; else echo '$(2)'; fi) + +comma := , +LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,) + CC = gcc OPTFLAGS = -g -Os INCLUDES = -I. -I.. -I../libfat CFLAGS = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) -LDFLAGS = -s +LDFLAGS = $(LDHASH) -s SRCS = syslinux.c ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c $(wildcard ../libfat/*.c) OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS))) diff --git a/sample/Makefile b/sample/Makefile index e24ab5be..bacc57ca 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -17,7 +17,7 @@ gcc_ok = $(shell if gcc $(1) -c -x c /dev/null -o /dev/null 2>/dev/null; \ then echo $(1); else echo $(2); fi) -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 diff --git a/unix/Makefile b/unix/Makefile index 021aa538..f0ab279a 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -1,8 +1,14 @@ +gcc_ok = $(shell if gcc $(1) ../dummy.c -o /dev/null 2>/dev/null; \ + then echo '$(1)'; else echo '$(2)'; fi) + +comma := , +LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,) + CC = gcc OPTFLAGS = -g -Os INCLUDES = -I. -I.. CFLAGS = -W -Wall -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) -LDFLAGS = -s +LDFLAGS = $(LDHASH) -s SRCS = syslinux.c ../syslxmod.c ../bootsect_bin.c ../ldlinux_bin.c OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS))) |