aboutsummaryrefslogtreecommitdiffstats
path: root/test/Makefile
blob: 7a6dfe24a96fab1898510b9436f8e28b5d3ab610 (plain)
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
.SUFFIXES: .bin .o .o64 .obj .obj64 .exe .asm .lst .pl

NASMDEP = ../nasm
NASM	= ../nasm
NASMOPT = -Ox -I../misc $(OPT)
PERL	= perl
TESTS	= $(wildcard *.asm)
RM_F	= rm -f
RM_RF	= rm -rf

$(NASM):
	$(MAKE) -C ..

%.bin: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f bin -o $@ -MD $@.dep -l $*.lst $<

%.ith: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f ith -o $@ -MD $@.dep -l $*.lst $<

%.srec: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f srec -o $@ -MD $@.dep -l $*.lst $<

%.o: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f elf32 -o $@ -MD $@.dep -l $*.lst $<

%.o64: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f elf64 -o $@ -MD $@.dep -l $*.lst $<

%.obj: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f obj -o $@ -MD $@.dep -l $*.lst $<

%.od: %.obj ../misc/omfdump
	../misc/omfdump $< > $@

%.coff: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f coff -o $@ -MD $@.dep -l $*.lst $<

%.win32: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f win32 -o $@ -MD $@.dep -l $*.lst $<

%.win64: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f win64 -o $@ -MD $@.dep -l $*.lst $<

%.mo32: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f macho32 -o $@ -MD $@.dep -l $*.lst $<

%.mo64: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f macho64 -o $@ -MD $@.dep -l $*.lst $<

%.dbg: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f dbg -o $@ -MD $@.dep -l $*.lst $<

%.asm: %.pl
	$(PERL) $< > $@

%.i: %.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -E -o $@ -MD $@.dep $<

all:

golden: performtest.pl $(TESTS)
	$(PERL) performtest.pl --golden --nasm='$(NASM)' $(TESTS)

test:	performtest.pl $(NASMDEP) $(TESTS)
	$(PERL) performtest.pl --nasm='$(NASM)' $(TESTS)

diff:	performtest.pl $(NASMDEP) $(TESTS)
	$(PERL) performtest.pl --diff --nasm='$(NASM)' $(TESTS)

clean:
	$(RM_F) *.com *.o *.o64 *.obj *.win32 *.win64 *.exe *.lst *.bin
	$(RM_F) *.dbg *.coff *.ith *.srec *.mo32 *.mo64 *.i *.dep
	$(RM_RF) testresults
	$(RM_F) elftest elftest64

spotless: clean
	$(RM_RF) golden

#
# Test for ELF32 shared libraries; assumes an x86 Linux system
#
elfso.o: elfso.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f elf32 -F stabs -o $@ -MD $@.dep -l $*.lst $<

elfso.so: elfso.o
	$(LD) -m elf_i386 -shared -o $@ -MD $@.dep $<

elftest: elftest.c elfso.so
	$(CC) -g -m32 -o $@ -MD $@.dep $^
	-env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./elftest

#
# Test for ELF64 shared libraries; assumes an x86-64 Linux system
#
elf64so.o: elf64so.asm $(NASMDEP)
	$(NASM) $(NASMOPT) -f elf64 -F dwarf -o $@ -MD $@.dep -l $*.lst $<

elf64so.so: elf64so.o
	$(LD) -shared -o $@ -MD $@.dep $<

elftest64: elftest64.c elf64so.so
	$(CC) -g -o $@ -MD $@.dep $^
	-env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./elftest64