From bd09a6d828fa492aed4406adde6c412e0e5c640d Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 20 Aug 2008 15:15:34 -0700 Subject: Major Makefile cleanups; gcc 4.3.0 compatiblity Cleanup and centralize the Makefile system even more. Fix a gcc 4.3 incompatibility in memdisk (definition of strlen). --- memdump/Makefile | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) (limited to 'memdump') diff --git a/memdump/Makefile b/memdump/Makefile index 3f195336..44677239 100644 --- a/memdump/Makefile +++ b/memdump/Makefile @@ -1,21 +1,36 @@ -TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) - -CC = gcc - -gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(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,) $(call gcc_ok,-fno-stack-protector,) - -LD = ld -m elf_i386 -OBJCOPY = objcopy -OPTFLAGS = -g -Os -march=i386 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer +## ----------------------------------------------------------------------- +## +## Copyright 2001-2008 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 +## the Free Software Foundation, Inc., 53 Temple Place Ste 330, +## Boston MA 02111-1307, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- + +## +## memory dump utility +## + +topdir = .. +include $(topdir)/MCONFIG + +GCCOPT := $(call gcc_ok,-m32,) \ + $(call gcc_ok,-ffreestanding,) \ + $(call gcc_ok,-fno-stack-protector,) \ + $(call gcc_ok,-falign-functions=0,-malign-functions=0) \ + $(call gcc_ok,-falign-jumps=0,-malign-jumps=0) \ + $(call gcc_ok,-falign-loops=0,-malign-loops=0) \ + -march=i386 -Os -fomit-frame-pointer -mregparm=3 -DREGPARM=3 \ + -msoft-float + +LD += -m elf_i386 +OPTFLAGS = -g INCLUDES = -include code16.h -I. -CFLAGS = $(M32) -mregparm=3 -DREGPARM=3 -W -Wall -msoft-float $(OPTFLAGS) $(INCLUDES) +CFLAGS = $(GCCOPT) -W -Wall $(OPTFLAGS) $(INCLUDES) LDFLAGS = -T com16.ld -AR = ar -RANLIB = ranlib -LIBGCC := $(shell $(CC) --print-libgcc) SRCS = main.c serial.c ymsend.c OBJS = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS))) @@ -24,14 +39,12 @@ LIBOBJS = conio.o memcpy.o memset.o skipatou.o strtoul.o \ .SUFFIXES: .c .o .i .s .S .elf .com -VPATH = .:..:../libfat - TARGETS = memdump.com all: $(TARGETS) tidy dist: - -rm -f *.o *.i *.s *.a .*.d *.elf + -rm -f *.o *.i *.s *.a .*.d *.tmp *.elf clean: tidy @@ -62,4 +75,4 @@ memdump.com: memdump.elf %.s: %.S $(CC) $(CFLAGS) -E -o $@ $< --include .*.d +-include .*.d *.tmp -- cgit v1.2.3