Blame view

Makefile 4.3 KB
bellard authored
1
include config.mak
bellard authored
2
bellard authored
3
CFLAGS=-Wall -O2 -g
4
LDFLAGS=-g
bellard authored
5
6
LIBS=
DEFINES=-DHAVE_BYTESWAP_H
bellard authored
7
8
9

ifeq ($(ARCH),i386)
CFLAGS+=-fomit-frame-pointer
bellard authored
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
bellard authored
16
17
18
19
# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
# that the kernel ELF loader considers as an executable. I think this
# is the simplest way to make it self virtualizable!
LDFLAGS+=-Wl,-shared
bellard authored
20
21
22
endif

ifeq ($(ARCH),ppc)
bellard authored
23
OP_CFLAGS=$(CFLAGS)
bellard authored
24
LDFLAGS+=-Wl,-T,ppc.ld
bellard authored
25
26
endif
bellard authored
27
28
ifeq ($(ARCH),s390)
OP_CFLAGS=$(CFLAGS)
bellard authored
29
LDFLAGS+=-Wl,-T,s390.ld
bellard authored
30
31
endif
32
33
34
35
36
37
38
39
40
41
42
43
ifeq ($(ARCH),sparc)
CFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
LDFLAGS+=-m32
OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
endif

ifeq ($(ARCH),sparc64)
CFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
LDFLAGS+=-m64
OP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0
endif
bellard authored
44
ifeq ($(ARCH),alpha)
bellard authored
45
46
47
# -msmall-data is not used because we want two-instruction relocations
# for the constant constructions
OP_CFLAGS=-Wall -O2 -g
bellard authored
48
49
50
51
52
53
54
55
56
# Ensure there's only a single GP
CFLAGS += -msmall-data -msmall-text
LDFLAGS+=-Wl,-T,alpha.ld
endif

ifeq ($(ARCH),ia64)
OP_CFLAGS=$(CFLAGS)
endif
bellard authored
57
58
59
60
61
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
bellard authored
62
63
#########################################################
bellard authored
64
DEFINES+=-D_GNU_SOURCE
bellard authored
65
LIBS+=-lm
bellard authored
66
67
68
69

# profiling code
ifdef TARGET_GPROF
LDFLAGS+=-p
70
main.o: CFLAGS+=-p
bellard authored
71
endif
72
bellard authored
73
OBJS= elfload.o main.o syscall.o mmap.o signal.o vm86.o path.o
bellard authored
74
75
SRCS:= $(OBJS:.o=.c)
OBJS+= libqemu.a
bellard authored
76
bellard authored
77
LIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o exec.o
bellard authored
78
bellard authored
79
# NOTE: the disassembler code is only needed for debugging
bellard authored
80
81
82
83
84
85
86
LIBOBJS+=disas.o i386-dis.o dis-buf.o
ifeq ($(ARCH),alpha)
LIBOBJS+=alpha-dis.o
endif
ifeq ($(ARCH),ppc)
LIBOBJS+=ppc-dis.o
endif
87
bellard authored
88
89
90
91
ifeq ($(ARCH),ia64)
OBJS += ia64-syscall.o
endif
bellard authored
92
all: qemu qemu-doc.html
93
bellard authored
94
qemu: $(OBJS)
bellard authored
95
	$(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
bellard authored
96
97
98
99
100
ifeq ($(ARCH),alpha)
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
# the address space (31 bit so sign extending doesn't matter)
	echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc
endif
101
102
103
104

depend: $(SRCS)
	$(CC) -MM $(CFLAGS) $^ 1>.depend
bellard authored
105
# libqemu 
bellard authored
106
bellard authored
107
libqemu.a: $(LIBOBJS)
bellard authored
108
109
110
	rm -f $@
	$(AR) rcs $@ $(LIBOBJS)
bellard authored
111
112
113
114
115
116
117
118
119
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
bellard authored
120
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
bellard authored
121
122
123
124
125
%.o: %.c
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<

clean:
bellard authored
126
	$(MAKE) -C tests clean
bellard authored
127
	rm -f *.o  *.a *~ qemu dyngen TAGS
128
bellard authored
129
130
131
distclean: clean
	rm -f config.mak config.h
bellard authored
132
133
install: qemu
	install -m 755 -s qemu $(prefix)/bin
bellard authored
134
bellard authored
135
# various test targets
bellard authored
136
test speed: qemu
bellard authored
137
	make -C tests $@
138
bellard authored
139
TAGS: 
bellard authored
140
	etags *.[ch] tests/*.[ch]
141
bellard authored
142
143
144
145
# documentation
qemu-doc.html: qemu-doc.texi
	texi2html -monolithic -number $<
bellard authored
146
FILES= \
bellard authored
147
148
README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \
dyngen.c ioctls.h ops_template.h op_string.h  syscall_types.h\
149
Makefile     elf.h       thunk.c\
bellard authored
150
elfload.c   main.c            signal.c        thunk.h exec.h\
bellard authored
151
cpu-i386.h qemu.h op-i386.c opc-i386.h syscall-i386.h  translate-i386.c\
bellard authored
152
153
154
syscall.c opreg_template.h  syscall_defs.h vm86.c\
dis-asm.h dis-buf.c disas.c disas.h alpha-dis.c ppc-dis.c i386-dis.c\
ppc.ld s390.ld exec-i386.h exec-i386.c path.c exec.c mmap.c configure \
155
tests/Makefile\
bellard authored
156
tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
bellard authored
157
158
tests/test-i386-muldiv.h tests/test-i386-code16.S\
tests/hello.c tests/hello tests/sha1.c \
bellard authored
159
tests/testsig.c tests/testclone.c tests/testthread.c \
bellard authored
160
tests/runcom.c tests/pi_10.com \
bellard authored
161
tests/test_path.c \
bellard authored
162
qemu-doc.texi qemu-doc.html
bellard authored
163
bellard authored
164
FILE=qemu-$(VERSION)
bellard authored
165
166
167
168
169
170
171
172

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)
173
174
175
176
# generate a binary distribution including the test binary environnment 
BINPATH=/usr/local/qemu-i386

tarbin:
bellard authored
177
178
179
180
	tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \
                 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr
	tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \
                 $(BINPATH)/wine
181
182
183
184
ifneq ($(wildcard .depend),)
include .depend
endif