From e94896af601b2c0458bcf07caf6f7432509c73f1 Mon Sep 17 00:00:00 2001 From: hpa Date: Sat, 24 Jan 2004 21:37:22 +0000 Subject: [PATCH] Adjust options to work on 64-bit machines, and clean up nuisance warnings --- Makefile | 2 +- memdisk/Makefile | 22 ++++++++++++++-------- sample/Makefile | 14 +++++++++----- win32/Makefile | 4 ++-- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 95a7b8b..2dabdf7 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ OSTYPE = $(shell uname -msr) CC = gcc INCLUDE = -CFLAGS = -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 +CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 PIC = -fPIC LDFLAGS = -O2 -s AR = ar diff --git a/memdisk/Makefile b/memdisk/Makefile index df01da2..e0da72e 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -1,7 +1,7 @@ #ident "$Id$" ## ----------------------------------------------------------------------- ## -## Copyright 2001 H. Peter Anvin - All Rights Reserved +## Copyright 2001-2004 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 @@ -13,15 +13,18 @@ VERSION := $(shell cat ../version) -CC = gcc -M32 = $(shell if gcc -m32 -c -x c /dev/null -o /dev/null 2>/dev/null; then echo -m32 ; fi) -CFLAGS = $(M32) -g -Wall -O2 -fomit-frame-pointer -march=i386 \ - -malign-functions=0 -malign-jumps=0 -malign-loops=0 \ +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,) +ALIGN := $(call gcc_ok,-falign-functions=0 -falign-jumps=0 -falign-loops=0,-malign-functions=0 -malign-jumps=0 -malign-loops=0) + +CC = gcc $(M32) +CFLAGS = -g -W -Wall -Os -fomit-frame-pointer -march=i386 $(ALIGN) \ -DVERSION='"$(VERSION)"' -DDATE='"$(DATE)"' LDFLAGS = -g INCLUDE = -I../com32/include -AS = as -LD = ld +LD = ld -m elf_i386 NASM = nasm -O99 NINCLUDE = OBJCOPY = objcopy @@ -51,8 +54,11 @@ spotless: clean %.o: %.asm $(NASM) -f elf -l $*.lst -o $@ $< +%.o: %.s + $(CC) -x assembler -c -o $@ $< + %.o16: %.s16 - $(AS) -o $@ $< + $(CC) -x assembler -c -o $@ $< %.o: %.c $(CC) $(INCLUDE) $(CFLAGS) -c -o $@ $< diff --git a/sample/Makefile b/sample/Makefile index 8f81bdd..cdaabff 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -1,7 +1,7 @@ #ident "$Id$" ## ----------------------------------------------------------------------- ## -## Copyright 2001 H. Peter Anvin - All Rights Reserved +## Copyright 2001-2004 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 @@ -15,13 +15,17 @@ ## samples for syslinux users ## -CC = gcc -LD = ld +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,) + +CC = gcc $(M32) +LD = ld -m elf_i386 AR = ar NASM = nasm RANLIB = ranlib -M32 = $(shell if gcc -m32 -c -x c /dev/null -o /dev/null 2>/dev/null; then echo -m32 ; fi) -CFLAGS = $(M32) -march=i386 -O2 -fomit-frame-pointer -I../com32/include +CFLAGS = -W -Wall -march=i386 -Os -fomit-frame-pointer -I../com32/include SFLAGS = -march=i386 LDFLAGS = -s OBJCOPY = objcopy diff --git a/win32/Makefile b/win32/Makefile index b570d6b..fd890ec 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -23,7 +23,7 @@ ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN) CC = gcc AR = ar RANLIB = ranlib -CFLAGS = -mno-cygwin -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 +CFLAGS = -mno-cygwin -W -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 PIC = LDFLAGS = -mno-cygwin -O2 -s else @@ -36,7 +36,7 @@ CC = mingw-gcc AR = mingw-ar RANLIB = mingw-ranlib endif -CFLAGS = -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 +CFLAGS = -W -Wall -O2 -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 PIC = LDFLAGS = -O2 -s endif -- 2.7.4