openbsd-ports/sysutils/memtest86+/patches/patch-Makefile
jasper 6526c60db5 - honor CC/CFLAGS
ok form@ (MAINTAINER)
2010-11-07 19:06:15 +00:00

72 lines
2.6 KiB
Plaintext

$OpenBSD: patch-Makefile,v 1.4 2010/11/07 19:06:15 jasper Exp $
$RuOBSD: patch-Makefile,v 1.3 2009/02/07 10:28:03 form Exp $
--- Makefile.orig Wed Apr 28 14:11:15 2010
+++ Makefile Sun Nov 7 19:30:26 2010
@@ -6,33 +6,47 @@
#
# Path for the floppy disk device
#
-FDISK=/dev/fd0
+FDISK=/dev/fd0c
AS=as -32
-CC=gcc
+CC?=gcc
-CFLAGS= -Wall -march=i486 -m32 -O2 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector
+CFLAGS+= -Wall -march=i486 -m32 -O2 -fomit-frame-pointer -fno-builtin -ffreestanding -fPIC -fno-stack-protector
-OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
+OBJS= head.o reloc.o main.o test.o init.o patn.o screen_buffer.o \
config.o linuxbios.o memsize.o pci.o controller.o random.o spd.o \
error.o dmi.o cpuid.o
-all: memtest.bin memtest
+all: memtest.bin memtest_s.bin memtest memtest_s
# Link it statically once so I know I don't have undefined
# symbols and then link it dynamically so I have full
# relocation information
-memtest_shared: $(OBJS) memtest_shared.lds Makefile
+memtest_shared: $(OBJS) lib.o memtest_shared.lds Makefile
$(LD) --warn-constructors --warn-common -static -T memtest_shared.lds \
- -o $@ $(OBJS) && \
- $(LD) -shared -Bsymbolic -T memtest_shared.lds -o $@ $(OBJS)
+ -o $@ $(OBJS) lib.o && \
+ $(LD) -shared -Bsymbolic -T memtest_shared.lds -o $@ $(OBJS) lib.o
+memtest_shared_s: $(OBJS) lib_s.o memtest_shared.lds Makefile
+ $(LD) --warn-constructors --warn-common -static -T memtest_shared.lds \
+ -o $@ $(OBJS) lib.o && \
+ $(LD) -shared -Bsymbolic -T memtest_shared.lds -o $@ $(OBJS) lib_s.o
+
memtest_shared.bin: memtest_shared
objcopy -O binary $< memtest_shared.bin
+memtest_shared_s.bin: memtest_shared_s
+ objcopy -O binary $< memtest_shared_s.bin
+
memtest: memtest_shared.bin memtest.lds
$(LD) -s -T memtest.lds -b binary memtest_shared.bin -o $@
+memtest_s: memtest_shared_s.bin memtest.lds
+ $(LD) -s -T memtest.lds -b binary memtest_shared_s.bin -o $@
+
+lib_s.o: lib.c
+ $(CC) -c $(CFLAGS) -DSERIAL_CONSOLE_DEFAULT=1 $< -o $@
+
head.s: head.S config.h defs.h test.h
$(CC) -E -traditional $< -o $@
@@ -45,6 +59,10 @@ setup.s: setup.S config.h defs.h
memtest.bin: memtest_shared.bin bootsect.o setup.o memtest.bin.lds
$(LD) -T memtest.bin.lds bootsect.o setup.o -b binary \
memtest_shared.bin -o memtest.bin
+
+memtest_s.bin: memtest_shared_s.bin bootsect.o setup.o memtest.bin.lds
+ $(LD) -T memtest.bin.lds bootsect.o setup.o -b binary \
+ memtest_shared_s.bin -o memtest_s.bin
reloc.o: reloc.c
$(CC) -c $(CFLAGS) -fno-strict-aliasing reloc.c