Makefile 1.4 KB
Newer Older
B
bellard 已提交
1 2
include ../config.mak

B
bellard 已提交
3 4 5
CFLAGS=-Wall -O2 -g
LDFLAGS=

B
bellard 已提交
6
ifeq ($(ARCH),i386)
B
bellard 已提交
7
TESTS=testclone testsig testthread sha1-i386 test-i386 runcom
B
bellard 已提交
8
endif
B
update  
bellard 已提交
9
TESTS+=sha1 test_path
B
bellard 已提交
10

B
bellard 已提交
11
QEMU=../qemu
B
bellard 已提交
12 13 14 15 16

all: $(TESTS)

hello: hello.c
	$(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
B
bellard 已提交
17
	strip hello
B
bellard 已提交
18

B
bellard 已提交
19
testclone: testclone.c
B
bellard 已提交
20 21
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
22 23 24 25 26 27
testsig: testsig.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

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

B
update  
bellard 已提交
28 29 30 31
test_path: test_path.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
	./$@ || { rm $@; exit 1; }

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

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

# speed test
B
bellard 已提交
48
sha1-i386: sha1.c
B
bellard 已提交
49 50
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
51 52 53 54
sha1: sha1.c
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

speed: sha1 sha1-i386
B
bellard 已提交
55
	time ./sha1
B
bellard 已提交
56
	time $(QEMU) ./sha1-i386
B
bellard 已提交
57

B
bellard 已提交
58 59 60 61
# vm86 test
runcom: runcom.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
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 $@ $<

B
bellard 已提交
69 70
clean:
	rm -f *~ *.o $(TESTS)