Merge remote-tracking branch 'github/nasm-2.15.xx'
[nasm.git] / test / Makefile
blobe09e1148a7b6caef5d093c3b1ac4e0b88119948d
1 .SUFFIXES: .bin .o .o64 .aout .obj .obj64 .exe .asm .lst .pl
3 NASMDEP = ../nasm
4 NASM = ../nasm
5 NASMOPT = -Ox -I../misc -L+ $(OPT)
6 PERL = perl
7 TESTS = $(wildcard *.asm)
8 RM_F = rm -f
9 RM_RF = rm -rf
11 $(NASM):
12 $(MAKE) -C ..
14 %.bin: %.asm $(NASMDEP)
15 $(NASM) $(NASMOPT) -f bin -o $@ -MD $@.dep -l $@.lst $<
17 %.ith: %.asm $(NASMDEP)
18 $(NASM) $(NASMOPT) -f ith -o $@ -MD $@.dep -l $@.lst $<
20 %.srec: %.asm $(NASMDEP)
21 $(NASM) $(NASMOPT) -f srec -o $@ -MD $@.dep -l $@.lst $<
23 %.o: %.asm $(NASMDEP)
24 $(NASM) $(NASMOPT) -f elf32 -gdwarf -o $@ -MD $@.dep -l $@.lst $<
26 %.ox: %.asm $(NASMDEP)
27 $(NASM) $(NASMOPT) -f elfx32 -gdwarf -o $@ -MD $@.dep -l $@.lst $<
29 %.o64: %.asm $(NASMDEP)
30 $(NASM) $(NASMOPT) -f elf64 -gdwarf -o $@ -MD $@.dep -l $@.lst $<
32 %.aout: %.asm $(NASMDEP)
33 $(NASM) $(NASMOPT) -f aout -o $@ -MD $@.dep -l $@.lst $<
35 %.obj: %.asm $(NASMDEP)
36 $(NASM) $(NASMOPT) -f obj -gborland -F -o $@ -MD $@.dep -l $@.lst $<
38 %.rdf: %.asm $(NASMDEP)
39 $(NASM) $(NASMOPT) -f rdf -o $@ -MD $@.dep -l $@.lst $<
41 %.od: %.obj ../misc/omfdump
42 ../misc/omfdump $< > $@
44 %.coff: %.asm $(NASMDEP)
45 $(NASM) $(NASMOPT) -f coff -o $@ -MD $@.dep -l $@.lst $<
47 %.win32: %.asm $(NASMDEP)
48 $(NASM) $(NASMOPT) -f win32 -gcv8 -o $@ -MD $@.dep -l $@.lst $<
50 %.win64: %.asm $(NASMDEP)
51 $(NASM) $(NASMOPT) -f win64 -gcv8 -o $@ -MD $@.dep -l $@.lst $<
53 %.mo32: %.asm $(NASMDEP)
54 $(NASM) $(NASMOPT) -f macho32 -gdwarf -o $@ -MD $@.dep -l $@.lst $<
56 %.mo64: %.asm $(NASMDEP)
57 $(NASM) $(NASMOPT) -f macho64 -gdwarf -o $@ -MD $@.dep -l $@.lst $<
59 %.dbg: %.asm $(NASMDEP)
60 $(NASM) $(NASMOPT) -f dbg -gdbg -o $@ -MD $@.dep -l $@.lst $<
62 %.asm: %.pl
63 $(PERL) $< > $@
65 %.i: %.asm $(NASMDEP)
66 $(NASM) $(NASMOPT) -E -o $@ -MD $@.dep $<
68 all:
70 golden: performtest.pl $(TESTS)
71 $(PERL) performtest.pl --golden --nasm='$(NASM)' $(TESTS)
73 test: performtest.pl $(NASMDEP) $(TESTS)
74 $(PERL) performtest.pl --nasm='$(NASM)' $(TESTS)
76 diff: performtest.pl $(NASMDEP) $(TESTS)
77 $(PERL) performtest.pl --diff --nasm='$(NASM)' $(TESTS)
79 clean:
80 $(RM_F) *.com *.o *.o64 *.aout *.obj *.win32 *.win64 *.exe *.lst *.bin
81 $(RM_F) *.dbg *.coff *.ith *.srec *.mo32 *.mo64 *.i *.dep *.rdf
82 $(RM_RF) testresults
83 $(RM_F) elftest elftest64
85 spotless: clean
86 $(RM_RF) golden
89 # Test for ELF32 shared libraries; assumes an x86 Linux system
91 elfso.o: elfso.asm $(NASMDEP)
92 $(NASM) $(NASMOPT) -f elf32 -F stabs -o $@ -MD $@.dep -l $@.lst $<
94 elfso.so: elfso.o
95 $(LD) -m elf_i386 -shared -o $@ -MD $@.dep $<
97 elftest: elftest.c elfso.so
98 $(CC) -g -m32 -o $@ -MD $@.dep $^
99 -env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./elftest
102 # Test for ELF64 shared libraries; assumes an x86-64 Linux system
104 elf64so.o: elf64so.asm $(NASMDEP)
105 $(NASM) $(NASMOPT) -f elf64 -F dwarf -o $@ -MD $@.dep -l $@.lst $<
107 elf64so.so: elf64so.o
108 $(LD) -shared -o $@ -MD $@.dep $<
110 elftest64: elftest64.c elf64so.so
111 $(CC) -g -o $@ -MD $@.dep $^
112 -env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./elftest64