Statistics
| Branch: | Revision:

root / Makefile @ 5132455e

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