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

B
bellard 已提交
3
CFLAGS=-Wall -O2 -g
4
LDFLAGS=-g
B
bellard 已提交
5 6
LIBS=
DEFINES=-DHAVE_BYTESWAP_H
B
bellard 已提交
7 8 9

ifeq ($(ARCH),i386)
CFLAGS+=-fomit-frame-pointer
B
bellard 已提交
10 11 12 13 14 15
OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
ifeq ($(GCC_MAJOR),3)
OP_CFLAGS+= -falign-functions=0
else
OP_CFLAGS+= -malign-functions=0
endif
B
bellard 已提交
16 17 18
endif

ifeq ($(ARCH),ppc)
B
bellard 已提交
19
OP_CFLAGS=$(CFLAGS)
B
bellard 已提交
20 21
endif

B
bellard 已提交
22 23 24 25 26
ifeq ($(GCC_MAJOR),3)
# very important to generate a return at the end of every operation
OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
endif

B
bellard 已提交
27 28
#########################################################

B
bellard 已提交
29
DEFINES+=-D_GNU_SOURCE
B
bellard 已提交
30
LDSCRIPT=$(ARCH).ld
B
bellard 已提交
31
LIBS+=-lm
B
bellard 已提交
32 33 34 35

# profiling code
ifdef TARGET_GPROF
LDFLAGS+=-p
B
bellard 已提交
36
main.o: CFLAGS+=-p
B
bellard 已提交
37
endif
38

B
bellard 已提交
39 40 41
OBJS= elfload.o main.o syscall.o signal.o
SRCS:= $(OBJS:.o=.c)
OBJS+= libqemu.a
B
bellard 已提交
42

B
bellard 已提交
43
LIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o
B
bellard 已提交
44
# NOTE: the disassembler code is only needed for debugging
B
bellard 已提交
45
LIBOBJS+=i386-dis.o dis-buf.o
46

B
bellard 已提交
47
all: qemu qemu-doc.html
48

B
bellard 已提交
49
qemu: $(OBJS)
B
bellard 已提交
50
	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^  $(LIBS)
51 52 53 54

depend: $(SRCS)
	$(CC) -MM $(CFLAGS) $^ 1>.depend

B
bellard 已提交
55
# libqemu 
B
bellard 已提交
56

B
bellard 已提交
57
libqemu.a: $(LIBOBJS)
B
bellard 已提交
58 59 60
	rm -f $@
	$(AR) rcs $@ $(LIBOBJS)

B
bellard 已提交
61 62 63 64 65 66 67 68 69
dyngen: dyngen.c
	$(HOST_CC) -O2 -Wall -g $< -o $@

translate-i386.o: translate-i386.c op-i386.h cpu-i386.h

op-i386.h: op-i386.o dyngen
	./dyngen -o $@ $<

op-i386.o: op-i386.c opreg_template.h ops_template.h
B
bellard 已提交
70
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
B
bellard 已提交
71

72 73 74 75
%.o: %.c
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<

clean:
B
bellard 已提交
76
	$(MAKE) -C tests clean
B
bellard 已提交
77
	rm -f *.o  *.a *~ qemu dyngen TAGS
78

B
bellard 已提交
79 80 81
distclean: clean
	rm -f config.mak config.h

B
bellard 已提交
82 83
install: qemu
	install -m 755 -s qemu $(prefix)/bin
B
bellard 已提交
84

B
bellard 已提交
85
# various test targets
B
bellard 已提交
86
test speed: qemu
B
bellard 已提交
87
	make -C tests $@
88

B
bellard 已提交
89 90
TAGS: 
	etags *.[ch] i386/*.[ch]
91

B
bellard 已提交
92 93 94 95
# documentation
qemu-doc.html: qemu-doc.texi
	texi2html -monolithic -number $<

B
bellard 已提交
96
FILES= \
B
bellard 已提交
97 98
README COPYING COPYING.LIB TODO Changelog VERSION \
dyngen.c ioctls.h ops_template.h  syscall_types.h\
B
bellard 已提交
99
Makefile     elf.h       linux_bin.h       segment.h       thunk.c\
B
bellard 已提交
100 101
elfload.c   main.c            signal.c        thunk.h\
cpu-i386.h   qemu.h      op-i386.c opc-i386.h syscall-i386.h  translate-i386.c\
B
bellard 已提交
102 103
dis-asm.h    gen-i386.h  op-i386.h         syscall.c\
dis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
B
bellard 已提交
104
i386.ld ppc.ld exec-i386.h exec-i386.c configure \
B
bellard 已提交
105
tests/Makefile\
B
bellard 已提交
106
tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
B
bellard 已提交
107 108
tests/test-i386-muldiv.h tests/test-i386-code16.S\
tests/hello.c tests/hello tests/sha1.c \
B
bellard 已提交
109 110
tests/testsig.c tests/testclone.c tests/testthread.c \
qemu-doc.texi qemu-doc.html
B
bellard 已提交
111

B
bellard 已提交
112
FILE=qemu-$(VERSION)
B
bellard 已提交
113 114 115 116 117 118 119 120

tar:
	rm -rf /tmp/$(FILE)
	mkdir -p /tmp/$(FILE)
	cp -P $(FILES) /tmp/$(FILE)
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
	rm -rf /tmp/$(FILE)

121 122 123
ifneq ($(wildcard .depend),)
include .depend
endif