2018-12-19 03:23:46 +08:00
|
|
|
.SUFFIXES: .bin .o .o64 .aout .obj .obj64 .exe .asm .lst .pl
|
2007-09-20 07:15:22 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
NASMDEP = ../nasm
|
2008-10-05 12:59:38 +08:00
|
|
|
NASM = ../nasm
|
2019-08-20 04:09:46 +08:00
|
|
|
NASMOPT = -Ox -I../misc -L+ $(OPT)
|
2008-10-05 12:59:38 +08:00
|
|
|
PERL = perl
|
|
|
|
TESTS = $(wildcard *.asm)
|
2017-04-04 02:13:29 +08:00
|
|
|
RM_F = rm -f
|
|
|
|
RM_RF = rm -rf
|
2007-09-20 07:15:22 +08:00
|
|
|
|
2016-02-19 05:06:04 +08:00
|
|
|
$(NASM):
|
|
|
|
$(MAKE) -C ..
|
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.bin: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f bin -o $@ -MD $@.dep -l $@.lst $<
|
2007-09-20 07:15:22 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.ith: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f ith -o $@ -MD $@.dep -l $@.lst $<
|
2009-07-06 07:14:33 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.srec: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f srec -o $@ -MD $@.dep -l $@.lst $<
|
2009-07-06 07:14:33 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.o: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f elf32 -o $@ -MD $@.dep -l $@.lst $<
|
2007-09-20 07:15:22 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.o64: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f elf64 -o $@ -MD $@.dep -l $@.lst $<
|
2007-09-20 07:15:22 +08:00
|
|
|
|
2018-12-19 03:23:46 +08:00
|
|
|
%.aout: %.asm $(NASMDEP)
|
|
|
|
$(NASM) $(NASMOPT) -f aout -o $@ -MD $@.dep -l $@.lst $<
|
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.obj: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f obj -o $@ -MD $@.dep -l $@.lst $<
|
2009-07-17 10:44:43 +08:00
|
|
|
|
2017-09-28 06:53:48 +08:00
|
|
|
%.rdf: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f rdf -o $@ -MD $@.dep -l $@.lst $<
|
2017-09-28 06:53:48 +08:00
|
|
|
|
2017-05-02 06:09:44 +08:00
|
|
|
%.od: %.obj ../misc/omfdump
|
|
|
|
../misc/omfdump $< > $@
|
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.coff: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f coff -o $@ -MD $@.dep -l $@.lst $<
|
2009-07-17 10:44:43 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.win32: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f win32 -o $@ -MD $@.dep -l $@.lst $<
|
2007-09-20 07:15:22 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.win64: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f win64 -o $@ -MD $@.dep -l $@.lst $<
|
2007-09-20 07:15:22 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.mo32: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f macho32 -o $@ -MD $@.dep -l $@.lst $<
|
2009-07-17 10:44:43 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.mo64: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f macho64 -o $@ -MD $@.dep -l $@.lst $<
|
2009-07-17 10:44:43 +08:00
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.dbg: %.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f dbg -o $@ -MD $@.dep -l $@.lst $<
|
2009-06-28 12:28:09 +08:00
|
|
|
|
2007-10-05 06:18:23 +08:00
|
|
|
%.asm: %.pl
|
|
|
|
$(PERL) $< > $@
|
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
%.i: %.asm $(NASMDEP)
|
2017-08-17 07:43:04 +08:00
|
|
|
$(NASM) $(NASMOPT) -E -o $@ -MD $@.dep $<
|
2016-10-05 05:56:37 +08:00
|
|
|
|
2007-09-20 07:15:22 +08:00
|
|
|
all:
|
|
|
|
|
2008-10-05 12:59:38 +08:00
|
|
|
golden: performtest.pl $(TESTS)
|
|
|
|
$(PERL) performtest.pl --golden --nasm='$(NASM)' $(TESTS)
|
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
test: performtest.pl $(NASMDEP) $(TESTS)
|
2008-10-05 12:59:38 +08:00
|
|
|
$(PERL) performtest.pl --nasm='$(NASM)' $(TESTS)
|
|
|
|
|
2017-06-26 10:31:35 +08:00
|
|
|
diff: performtest.pl $(NASMDEP) $(TESTS)
|
2008-10-05 13:02:44 +08:00
|
|
|
$(PERL) performtest.pl --diff --nasm='$(NASM)' $(TESTS)
|
|
|
|
|
2002-05-01 04:51:32 +08:00
|
|
|
clean:
|
2018-12-19 03:23:46 +08:00
|
|
|
$(RM_F) *.com *.o *.o64 *.aout *.obj *.win32 *.win64 *.exe *.lst *.bin
|
2017-09-28 06:53:48 +08:00
|
|
|
$(RM_F) *.dbg *.coff *.ith *.srec *.mo32 *.mo64 *.i *.dep *.rdf
|
2017-04-04 02:13:29 +08:00
|
|
|
$(RM_RF) testresults
|
|
|
|
$(RM_F) elftest elftest64
|
2008-10-05 12:59:38 +08:00
|
|
|
|
|
|
|
spotless: clean
|
2017-04-04 02:13:29 +08:00
|
|
|
$(RM_RF) golden
|
2008-10-18 08:13:26 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test for ELF32 shared libraries; assumes an x86 Linux system
|
|
|
|
#
|
2017-06-26 10:31:35 +08:00
|
|
|
elfso.o: elfso.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f elf32 -F stabs -o $@ -MD $@.dep -l $@.lst $<
|
2008-10-18 08:13:26 +08:00
|
|
|
|
|
|
|
elfso.so: elfso.o
|
2017-08-17 07:43:04 +08:00
|
|
|
$(LD) -m elf_i386 -shared -o $@ -MD $@.dep $<
|
2008-10-18 08:13:26 +08:00
|
|
|
|
|
|
|
elftest: elftest.c elfso.so
|
2017-08-17 07:43:04 +08:00
|
|
|
$(CC) -g -m32 -o $@ -MD $@.dep $^
|
2008-10-18 14:03:04 +08:00
|
|
|
-env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./elftest
|
2008-10-18 08:13:26 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# Test for ELF64 shared libraries; assumes an x86-64 Linux system
|
|
|
|
#
|
2017-06-26 10:31:35 +08:00
|
|
|
elf64so.o: elf64so.asm $(NASMDEP)
|
2018-06-19 02:30:48 +08:00
|
|
|
$(NASM) $(NASMOPT) -f elf64 -F dwarf -o $@ -MD $@.dep -l $@.lst $<
|
2008-10-18 08:13:26 +08:00
|
|
|
|
|
|
|
elf64so.so: elf64so.o
|
2017-08-17 07:43:04 +08:00
|
|
|
$(LD) -shared -o $@ -MD $@.dep $<
|
2008-10-18 08:13:26 +08:00
|
|
|
|
|
|
|
elftest64: elftest64.c elf64so.so
|
2017-08-17 07:43:04 +08:00
|
|
|
$(CC) -g -o $@ -MD $@.dep $^
|
2008-10-18 14:03:04 +08:00
|
|
|
-env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH ./elftest64
|