Statistics
| Branch: | Revision:

root / Makefile @ 2a29ca73

History | View | Annotate | Download (3.9 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 27c75a9a bellard
# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
17 27c75a9a bellard
# that the kernel ELF loader considers as an executable. I think this
18 27c75a9a bellard
# is the simplest way to make it self virtualizable!
19 27c75a9a bellard
LDFLAGS+=-Wl,-shared
20 766a487a bellard
endif
21 766a487a bellard
22 766a487a bellard
ifeq ($(ARCH),ppc)
23 927f621e bellard
OP_CFLAGS=$(CFLAGS)
24 27c75a9a bellard
LDFLAGS+=-Wl,-T,ppc.ld
25 766a487a bellard
endif
26 766a487a bellard
27 fd429f2f bellard
ifeq ($(ARCH),s390)
28 fd429f2f bellard
OP_CFLAGS=$(CFLAGS)
29 27c75a9a bellard
LDFLAGS+=-Wl,-T,s390.ld
30 fd429f2f bellard
endif
31 fd429f2f bellard
32 d6cdca95 bellard
ifeq ($(ARCH),alpha)
33 a993ba85 bellard
# -msmall-data is not used because we want two-instruction relocations
34 a993ba85 bellard
# for the constant constructions
35 a993ba85 bellard
OP_CFLAGS=-Wall -O2 -g
36 d6cdca95 bellard
# Ensure there's only a single GP
37 d6cdca95 bellard
CFLAGS += -msmall-data -msmall-text
38 d6cdca95 bellard
LDFLAGS+=-Wl,-T,alpha.ld
39 d6cdca95 bellard
endif
40 d6cdca95 bellard
41 d6cdca95 bellard
ifeq ($(ARCH),ia64)
42 d6cdca95 bellard
OP_CFLAGS=$(CFLAGS)
43 d6cdca95 bellard
endif
44 d6cdca95 bellard
45 ca735206 bellard
ifeq ($(GCC_MAJOR),3)
46 ca735206 bellard
# very important to generate a return at the end of every operation
47 ca735206 bellard
OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
48 ca735206 bellard
endif
49 ca735206 bellard
50 766a487a bellard
#########################################################
51 766a487a bellard
52 0ecfa993 bellard
DEFINES+=-D_GNU_SOURCE
53 3ef693a0 bellard
LIBS+=-lm
54 7d13299d bellard
55 7d13299d bellard
# profiling code
56 7d13299d bellard
ifdef TARGET_GPROF
57 7d13299d bellard
LDFLAGS+=-p
58 dc99065b bellard
main.o: CFLAGS+=-p
59 7d13299d bellard
endif
60 31e31b8a bellard
61 54936004 bellard
OBJS= elfload.o main.o syscall.o mmap.o signal.o vm86.o path.o
62 3ef693a0 bellard
SRCS:= $(OBJS:.o=.c)
63 3ef693a0 bellard
OBJS+= libqemu.a
64 612384d7 bellard
65 54936004 bellard
LIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o exec.o
66 0ecfa993 bellard
# NOTE: the disassembler code is only needed for debugging
67 a993ba85 bellard
LIBOBJS+=disas.o ppc-dis.o i386-dis.o alpha-dis.o dis-buf.o
68 31e31b8a bellard
69 d6cdca95 bellard
ifeq ($(ARCH),ia64)
70 d6cdca95 bellard
OBJS += ia64-syscall.o
71 d6cdca95 bellard
endif
72 d6cdca95 bellard
73 3ef693a0 bellard
all: qemu qemu-doc.html
74 31e31b8a bellard
75 3ef693a0 bellard
qemu: $(OBJS)
76 27c75a9a bellard
	$(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
77 a993ba85 bellard
ifeq ($(ARCH),alpha)
78 a993ba85 bellard
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
79 a993ba85 bellard
# the address space (31 bit so sign extending doesn't matter)
80 a993ba85 bellard
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
81 a993ba85 bellard
endif
82 31e31b8a bellard
83 31e31b8a bellard
depend: $(SRCS)
84 31e31b8a bellard
	$(CC) -MM $(CFLAGS) $^ 1>.depend
85 31e31b8a bellard
86 3ef693a0 bellard
# libqemu 
87 612384d7 bellard
88 3ef693a0 bellard
libqemu.a: $(LIBOBJS)
89 612384d7 bellard
	rm -f $@
90 612384d7 bellard
	$(AR) rcs $@ $(LIBOBJS)
91 612384d7 bellard
92 367e86e8 bellard
dyngen: dyngen.c
93 367e86e8 bellard
	$(HOST_CC) -O2 -Wall -g $< -o $@
94 367e86e8 bellard
95 367e86e8 bellard
translate-i386.o: translate-i386.c op-i386.h cpu-i386.h
96 367e86e8 bellard
97 367e86e8 bellard
op-i386.h: op-i386.o dyngen
98 367e86e8 bellard
	./dyngen -o $@ $<
99 367e86e8 bellard
100 367e86e8 bellard
op-i386.o: op-i386.c opreg_template.h ops_template.h
101 927f621e bellard
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
102 367e86e8 bellard
103 31e31b8a bellard
%.o: %.c
104 31e31b8a bellard
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
105 31e31b8a bellard
106 31e31b8a bellard
clean:
107 7d13299d bellard
	$(MAKE) -C tests clean
108 3ef693a0 bellard
	rm -f *.o  *.a *~ qemu dyngen TAGS
109 31e31b8a bellard
110 7d13299d bellard
distclean: clean
111 7d13299d bellard
	rm -f config.mak config.h
112 7d13299d bellard
113 3ef693a0 bellard
install: qemu
114 3ef693a0 bellard
	install -m 755 -s qemu $(prefix)/bin
115 612384d7 bellard
116 367e86e8 bellard
# various test targets
117 3ef693a0 bellard
test speed: qemu
118 367e86e8 bellard
	make -C tests $@
119 31e31b8a bellard
120 367e86e8 bellard
TAGS: 
121 b9adb4a6 bellard
	etags *.[ch] tests/*.[ch]
122 31e31b8a bellard
123 3ef693a0 bellard
# documentation
124 3ef693a0 bellard
qemu-doc.html: qemu-doc.texi
125 3ef693a0 bellard
	texi2html -monolithic -number $<
126 3ef693a0 bellard
127 586314f2 bellard
FILES= \
128 fd429f2f bellard
README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \
129 fd429f2f bellard
dyngen.c ioctls.h ops_template.h op_string.h  syscall_types.h\
130 09bfb054 bellard
Makefile     elf.h       thunk.c\
131 3ef693a0 bellard
elfload.c   main.c            signal.c        thunk.h\
132 fd429f2f bellard
cpu-i386.h qemu.h op-i386.c opc-i386.h syscall-i386.h  translate-i386.c\
133 27c75a9a bellard
dis-asm.h    gen-i386.h  syscall.c\
134 b9adb4a6 bellard
dis-buf.c disas.c disas.h ppc-dis.c i386-dis.c  opreg_template.h  syscall_defs.h\
135 1eb87257 bellard
ppc.ld s390.ld exec-i386.h exec-i386.c path.c configure \
136 77f8dd5a bellard
tests/Makefile\
137 586314f2 bellard
tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
138 612384d7 bellard
tests/test-i386-muldiv.h tests/test-i386-code16.S\
139 612384d7 bellard
tests/hello.c tests/hello tests/sha1.c \
140 3ef693a0 bellard
tests/testsig.c tests/testclone.c tests/testthread.c \
141 fd429f2f bellard
tests/runcom.c tests/pi_10.com \
142 1eb87257 bellard
tests/test_path.c \
143 3ef693a0 bellard
qemu-doc.texi qemu-doc.html
144 586314f2 bellard
145 3ef693a0 bellard
FILE=qemu-$(VERSION)
146 586314f2 bellard
147 586314f2 bellard
tar:
148 586314f2 bellard
	rm -rf /tmp/$(FILE)
149 586314f2 bellard
	mkdir -p /tmp/$(FILE)
150 586314f2 bellard
	cp -P $(FILES) /tmp/$(FILE)
151 586314f2 bellard
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
152 586314f2 bellard
	rm -rf /tmp/$(FILE)
153 586314f2 bellard
154 d691f669 bellard
# generate a binary distribution including the test binary environnment 
155 d691f669 bellard
BINPATH=/usr/local/qemu-i386
156 d691f669 bellard
157 d691f669 bellard
tarbin:
158 1eb87257 bellard
	tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \
159 1eb87257 bellard
                 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr
160 1eb87257 bellard
	tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \
161 1eb87257 bellard
                 $(BINPATH)/wine
162 d691f669 bellard
163 31e31b8a bellard
ifneq ($(wildcard .depend),)
164 31e31b8a bellard
include .depend
165 31e31b8a bellard
endif