Makefile 1.4 KB
Newer Older
bellard's avatar
bellard committed
1
2
include ../config.mak

bellard's avatar
bellard committed
3
4
5
CFLAGS=-Wall -O2 -g
LDFLAGS=

bellard's avatar
bellard committed
6
ifeq ($(ARCH),i386)
bellard's avatar
bellard committed
7
TESTS=testclone testsig testthread sha1-i386 test-i386 runcom
bellard's avatar
bellard committed
8
endif
bellard's avatar
update    
bellard committed
9
TESTS+=sha1 test_path
bellard's avatar
bellard committed
10

bellard's avatar
bellard committed
11
QEMU=../qemu
bellard's avatar
bellard committed
12
13
14

all: $(TESTS)

bellard's avatar
bellard committed
15
hello-i386: hello-i386.c
bellard's avatar
bellard committed
16
	$(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
bellard's avatar
bellard committed
17
	strip $@
bellard's avatar
bellard committed
18

bellard's avatar
bellard committed
19
testclone: testclone.c
bellard's avatar
bellard committed
20
21
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

bellard's avatar
bellard committed
22
23
24
25
26
27
testsig: testsig.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

testthread: testthread.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread

bellard's avatar
update    
bellard committed
28
29
30
31
test_path: test_path.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
	./$@ || { rm $@; exit 1; }

bellard's avatar
bellard committed
32
# i386 emulation test (test various opcodes) */
bellard's avatar
bellard committed
33
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
bellard's avatar
bellard committed
34
           test-i386.h test-i386-shift.h test-i386-muldiv.h
bellard's avatar
bellard committed
35
36
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ test-i386.c \
              test-i386-code16.S test-i386-vm86.S -lm
bellard's avatar
bellard committed
37

bellard's avatar
bellard committed
38
ifeq ($(ARCH),i386)
bellard's avatar
bellard committed
39
test: test-i386
bellard's avatar
bellard committed
40
	./test-i386 > test-i386.ref
bellard's avatar
bellard committed
41
42
else
test:
bellard's avatar
bellard committed
43
endif
bellard's avatar
bellard committed
44
	$(QEMU) test-i386 > test-i386.out
bellard's avatar
bellard committed
45
46
47
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi

# speed test
bellard's avatar
bellard committed
48
sha1-i386: sha1.c
bellard's avatar
bellard committed
49
50
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

bellard's avatar
bellard committed
51
52
53
54
sha1: sha1.c
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

speed: sha1 sha1-i386
bellard's avatar
bellard committed
55
	time ./sha1
bellard's avatar
bellard committed
56
	time $(QEMU) ./sha1-i386
bellard's avatar
bellard committed
57

bellard's avatar
bellard committed
58
59
60
61
# vm86 test
runcom: runcom.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

bellard's avatar
bellard committed
62
63
64
65
66
67
68
# arm test
hello-arm: hello-arm.o
	arm-linux-ld -o $@ $<

hello-arm.o: hello-arm.c
	arm-linux-gcc -Wall -g -O2 -c -o $@ $<

bellard's avatar
bellard committed
69
70
clean:
	rm -f *~ *.o $(TESTS)