Statistics
| Branch: | Revision:

root / Makefile @ 3ef693a0

History | View | Annotate | Download (2.7 kB)

1 7d13299d bellard
include config.mak
2 766a487a bellard
3 7d13299d bellard
CFLAGS=-Wall -O2 -g
4 31e31b8a bellard
LDFLAGS=-g
5 766a487a bellard
LIBS=
6 766a487a bellard
DEFINES=-DHAVE_BYTESWAP_H
7 7d13299d bellard
8 7d13299d bellard
ifeq ($(ARCH),i386)
9 7d13299d bellard
CFLAGS+=-fomit-frame-pointer
10 ca735206 bellard
OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
11 ca735206 bellard
ifeq ($(GCC_MAJOR),3)
12 ca735206 bellard
OP_CFLAGS+= -falign-functions=0
13 ca735206 bellard
else
14 ca735206 bellard
OP_CFLAGS+= -malign-functions=0
15 ca735206 bellard
endif
16 766a487a bellard
endif
17 766a487a bellard
18 766a487a bellard
ifeq ($(ARCH),ppc)
19 927f621e bellard
OP_CFLAGS=$(CFLAGS)
20 766a487a bellard
endif
21 766a487a bellard
22 ca735206 bellard
ifeq ($(GCC_MAJOR),3)
23 ca735206 bellard
# very important to generate a return at the end of every operation
24 ca735206 bellard
OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
25 ca735206 bellard
endif
26 ca735206 bellard
27 766a487a bellard
#########################################################
28 766a487a bellard
29 0ecfa993 bellard
DEFINES+=-D_GNU_SOURCE
30 766a487a bellard
LDSCRIPT=$(ARCH).ld
31 3ef693a0 bellard
LIBS+=-lm
32 7d13299d bellard
33 7d13299d bellard
# profiling code
34 7d13299d bellard
ifdef TARGET_GPROF
35 7d13299d bellard
LDFLAGS+=-p
36 dc99065b bellard
main.o: CFLAGS+=-p
37 7d13299d bellard
endif
38 31e31b8a bellard
39 3ef693a0 bellard
OBJS= elfload.o main.o syscall.o signal.o
40 3ef693a0 bellard
SRCS:= $(OBJS:.o=.c)
41 3ef693a0 bellard
OBJS+= libqemu.a
42 612384d7 bellard
43 3ef693a0 bellard
LIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o
44 0ecfa993 bellard
# NOTE: the disassembler code is only needed for debugging
45 612384d7 bellard
LIBOBJS+=i386-dis.o dis-buf.o
46 31e31b8a bellard
47 3ef693a0 bellard
all: qemu qemu-doc.html
48 31e31b8a bellard
49 3ef693a0 bellard
qemu: $(OBJS)
50 612384d7 bellard
	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^  $(LIBS)
51 31e31b8a bellard
52 31e31b8a bellard
depend: $(SRCS)
53 31e31b8a bellard
	$(CC) -MM $(CFLAGS) $^ 1>.depend
54 31e31b8a bellard
55 3ef693a0 bellard
# libqemu 
56 612384d7 bellard
57 3ef693a0 bellard
libqemu.a: $(LIBOBJS)
58 612384d7 bellard
	rm -f $@
59 612384d7 bellard
	$(AR) rcs $@ $(LIBOBJS)
60 612384d7 bellard
61 367e86e8 bellard
dyngen: dyngen.c
62 367e86e8 bellard
	$(HOST_CC) -O2 -Wall -g $< -o $@
63 367e86e8 bellard
64 367e86e8 bellard
translate-i386.o: translate-i386.c op-i386.h cpu-i386.h
65 367e86e8 bellard
66 367e86e8 bellard
op-i386.h: op-i386.o dyngen
67 367e86e8 bellard
	./dyngen -o $@ $<
68 367e86e8 bellard
69 367e86e8 bellard
op-i386.o: op-i386.c opreg_template.h ops_template.h
70 927f621e bellard
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
71 367e86e8 bellard
72 31e31b8a bellard
%.o: %.c
73 31e31b8a bellard
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
74 31e31b8a bellard
75 31e31b8a bellard
clean:
76 7d13299d bellard
	$(MAKE) -C tests clean
77 3ef693a0 bellard
	rm -f *.o  *.a *~ qemu dyngen TAGS
78 31e31b8a bellard
79 7d13299d bellard
distclean: clean
80 7d13299d bellard
	rm -f config.mak config.h
81 7d13299d bellard
82 3ef693a0 bellard
install: qemu
83 3ef693a0 bellard
	install -m 755 -s qemu $(prefix)/bin
84 612384d7 bellard
85 367e86e8 bellard
# various test targets
86 3ef693a0 bellard
test speed: qemu
87 367e86e8 bellard
	make -C tests $@
88 31e31b8a bellard
89 367e86e8 bellard
TAGS: 
90 367e86e8 bellard
	etags *.[ch] i386/*.[ch]
91 31e31b8a bellard
92 3ef693a0 bellard
# documentation
93 3ef693a0 bellard
qemu-doc.html: qemu-doc.texi
94 3ef693a0 bellard
	texi2html -monolithic -number $<
95 3ef693a0 bellard
96 586314f2 bellard
FILES= \
97 3ef693a0 bellard
README COPYING COPYING.LIB TODO Changelog VERSION \
98 3ef693a0 bellard
dyngen.c ioctls.h ops_template.h  syscall_types.h\
99 586314f2 bellard
Makefile     elf.h       linux_bin.h       segment.h       thunk.c\
100 3ef693a0 bellard
elfload.c   main.c            signal.c        thunk.h\
101 3ef693a0 bellard
cpu-i386.h   qemu.h      op-i386.c opc-i386.h syscall-i386.h  translate-i386.c\
102 586314f2 bellard
dis-asm.h    gen-i386.h  op-i386.h         syscall.c\
103 586314f2 bellard
dis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
104 3ef693a0 bellard
i386.ld ppc.ld exec-i386.h exec-i386.c configure \
105 77f8dd5a bellard
tests/Makefile\
106 586314f2 bellard
tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
107 612384d7 bellard
tests/test-i386-muldiv.h tests/test-i386-code16.S\
108 612384d7 bellard
tests/hello.c tests/hello tests/sha1.c \
109 3ef693a0 bellard
tests/testsig.c tests/testclone.c tests/testthread.c \
110 3ef693a0 bellard
qemu-doc.texi qemu-doc.html
111 586314f2 bellard
112 3ef693a0 bellard
FILE=qemu-$(VERSION)
113 586314f2 bellard
114 586314f2 bellard
tar:
115 586314f2 bellard
	rm -rf /tmp/$(FILE)
116 586314f2 bellard
	mkdir -p /tmp/$(FILE)
117 586314f2 bellard
	cp -P $(FILES) /tmp/$(FILE)
118 586314f2 bellard
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
119 586314f2 bellard
	rm -rf /tmp/$(FILE)
120 586314f2 bellard
121 31e31b8a bellard
ifneq ($(wildcard .depend),)
122 31e31b8a bellard
include .depend
123 31e31b8a bellard
endif