File: Makefile

package info (click to toggle)
hwtools 0.5-0.2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,304 kB
  • ctags: 1,213
  • sloc: ansic: 9,522; tcl: 2,140; asm: 802; makefile: 295; sh: 262; cpp: 160; csh: 42
file content (114 lines) | stat: -rw-r--r-- 2,720 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Makefile for MemTest-86
#
# Author:		Chris Brady
# Created:		January 1, 1996

#
# Path for the floppy disk device
#
FDISK=/dev/fd0

#
# gcc compiler options, these settings should suffice
#
CC=gcc272
CCFLAGS=-Wall -m486 -O2 -fomit-frame-pointer
TSTFLAGS=-Wall -m486 -O3 -funroll-loops -fomit-frame-pointer

# WARNING - Read the following carefully if you modify the code in any way!
#
# TXT_ADR sets the origin for the text segment.  Since the  code is
# relocated there are two code segments. The first must match TESTADR in
# defs.h.  The second REL_TXT_ADR must be set to (TESTADR+MAIN_SZ+RELOBASE)
# in defs.h.
# 
# DAT_ADR sets the origin for the data segment. This is is set by hand and
# will need to be adjusted if the code grows much.  The current settings
# leave only a small amount of room for growth. Look at the loader map to
# check this address.  The total size of the text and data segments must
# be less than MAINSZ in defs.h. REL_DAT_ADR should be set to
# REL_TXT_ADR + (DAT_ADR - TXT_ADR)
#
TXT_ADR=0x1000
DAT_ADR=0x7000
REL_TXT_ADR=0x108800
REL_DAT_ADR=0x10e800

OBJS=head.o main.o test.o init.o lib.o

OBJDUMP=objdump -k -q
OBJCOPY=objcopy -O binary -R .note -R .comment -R .stab -R .stabstr

all: setup bootsect head.out relo.out build
	./build bootsect setup head.out relo.out >memtest.bin

test.o: test.c test.h defs.h
	$(CC) -c $(TSTFLAGS) test.c

main.o: main.c test.h defs.h
	$(CC) -c $(CCFLAGS) main.c

init.o: init.c test.h defs.h io.h
	$(CC) -c $(CCFLAGS) init.c

lib.o: lib.c test.h defs.h io.h serial.h
	$(CC) -c $(CCFLAGS) lib.c

relo: $(OBJS)
	ld -m elf_i386 -o $@ -e do_test -Ttext $(REL_TXT_ADR) -Tdata \
		$(REL_DAT_ADR) -Map mapfile.relo $(OBJS)

relo.out: relo
	if hash encaps 2> /dev/null; then \
	    $(OBJDUMP) -o $(REL_TXT_ADR) relo >relo.out; \
	else \
	    $(OBJCOPY) relo relo.out; \
	fi

head.o: head.s
	as -o $@ $<

head: $(OBJS)
	ld -m elf_i386 -o $@ -e do_test -Ttext $(TXT_ADR) -Tdata $(DAT_ADR) \
		-Map mapfile $(OBJS)
head.out: head
	if hash encaps 2> /dev/null; then \
	    $(OBJDUMP) -o $(TXT_ADR) head >head.out; \
	else \
	    $(OBJCOPY) head head.out; \
	fi

head.s: head.S test.h
	$(CC) -E -traditional $< -o $@

setup: setup.o
	ld86 -0 -s -o $@ $<

setup.o: setup.s
	as86 -a -0 -o $@ $<

setup.s: setup.S test.h
	$(CC) -E -traditional $< -o $@

bootsect: bootsect.o
	ld86 -0 -s -o $@ $<

bootsect.o: bootsect.s
	as86 -a -0 -o $@ $<

bootsect.s: bootsect.S test.h
	$(CC) -E -traditional $< -o $@

build:	build.c
	$(CC) -DELF -o build build.c

clean:
	rm -f *.o *.s build memtest.bin bootsect setup head head.out mapfile relo \
	      relo.out mapfile.relo

install: all
	dd <memtest.bin >$(FDISK) bs=8192

install-bin:
	dd <precomp.bin >$(FDISK) bs=8192