Statistics
| Branch: | Revision:

root / Makefile @ ae48a073

History | View | Annotate | Download (3.3 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 ca735206 bellard
ifeq ($(GCC_MAJOR),3)
33 ca735206 bellard
# very important to generate a return at the end of every operation
34 ca735206 bellard
OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
35 ca735206 bellard
endif
36 ca735206 bellard
37 766a487a bellard
#########################################################
38 766a487a bellard
39 0ecfa993 bellard
DEFINES+=-D_GNU_SOURCE
40 3ef693a0 bellard
LIBS+=-lm
41 7d13299d bellard
42 7d13299d bellard
# profiling code
43 7d13299d bellard
ifdef TARGET_GPROF
44 7d13299d bellard
LDFLAGS+=-p
45 dc99065b bellard
main.o: CFLAGS+=-p
46 7d13299d bellard
endif
47 31e31b8a bellard
48 1eb87257 bellard
OBJS= elfload.o main.o syscall.o signal.o path.o
49 3ef693a0 bellard
SRCS:= $(OBJS:.o=.c)
50 3ef693a0 bellard
OBJS+= libqemu.a
51 612384d7 bellard
52 3ef693a0 bellard
LIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o
53 0ecfa993 bellard
# NOTE: the disassembler code is only needed for debugging
54 612384d7 bellard
LIBOBJS+=i386-dis.o dis-buf.o
55 31e31b8a bellard
56 3ef693a0 bellard
all: qemu qemu-doc.html
57 31e31b8a bellard
58 3ef693a0 bellard
qemu: $(OBJS)
59 27c75a9a bellard
	$(CC) $(LDFLAGS) -o $@ $^  $(LIBS)
60 31e31b8a bellard
61 31e31b8a bellard
depend: $(SRCS)
62 31e31b8a bellard
	$(CC) -MM $(CFLAGS) $^ 1>.depend
63 31e31b8a bellard
64 3ef693a0 bellard
# libqemu 
65 612384d7 bellard
66 3ef693a0 bellard
libqemu.a: $(LIBOBJS)
67 612384d7 bellard
	rm -f $@
68 612384d7 bellard
	$(AR) rcs $@ $(LIBOBJS)
69 612384d7 bellard
70 367e86e8 bellard
dyngen: dyngen.c
71 367e86e8 bellard
	$(HOST_CC) -O2 -Wall -g $< -o $@
72 367e86e8 bellard
73 367e86e8 bellard
translate-i386.o: translate-i386.c op-i386.h cpu-i386.h
74 367e86e8 bellard
75 367e86e8 bellard
op-i386.h: op-i386.o dyngen
76 367e86e8 bellard
	./dyngen -o $@ $<
77 367e86e8 bellard
78 367e86e8 bellard
op-i386.o: op-i386.c opreg_template.h ops_template.h
79 927f621e bellard
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
80 367e86e8 bellard
81 31e31b8a bellard
%.o: %.c
82 31e31b8a bellard
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
83 31e31b8a bellard
84 31e31b8a bellard
clean:
85 7d13299d bellard
	$(MAKE) -C tests clean
86 3ef693a0 bellard
	rm -f *.o  *.a *~ qemu dyngen TAGS
87 31e31b8a bellard
88 7d13299d bellard
distclean: clean
89 7d13299d bellard
	rm -f config.mak config.h
90 7d13299d bellard
91 3ef693a0 bellard
install: qemu
92 3ef693a0 bellard
	install -m 755 -s qemu $(prefix)/bin
93 612384d7 bellard
94 367e86e8 bellard
# various test targets
95 3ef693a0 bellard
test speed: qemu
96 367e86e8 bellard
	make -C tests $@
97 31e31b8a bellard
98 367e86e8 bellard
TAGS: 
99 367e86e8 bellard
	etags *.[ch] i386/*.[ch]
100 31e31b8a bellard
101 3ef693a0 bellard
# documentation
102 3ef693a0 bellard
qemu-doc.html: qemu-doc.texi
103 3ef693a0 bellard
	texi2html -monolithic -number $<
104 3ef693a0 bellard
105 586314f2 bellard
FILES= \
106 fd429f2f bellard
README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \
107 fd429f2f bellard
dyngen.c ioctls.h ops_template.h op_string.h  syscall_types.h\
108 09bfb054 bellard
Makefile     elf.h       thunk.c\
109 3ef693a0 bellard
elfload.c   main.c            signal.c        thunk.h\
110 fd429f2f bellard
cpu-i386.h qemu.h op-i386.c opc-i386.h syscall-i386.h  translate-i386.c\
111 27c75a9a bellard
dis-asm.h    gen-i386.h  syscall.c\
112 586314f2 bellard
dis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
113 1eb87257 bellard
ppc.ld s390.ld exec-i386.h exec-i386.c path.c configure \
114 77f8dd5a bellard
tests/Makefile\
115 586314f2 bellard
tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
116 612384d7 bellard
tests/test-i386-muldiv.h tests/test-i386-code16.S\
117 612384d7 bellard
tests/hello.c tests/hello tests/sha1.c \
118 3ef693a0 bellard
tests/testsig.c tests/testclone.c tests/testthread.c \
119 fd429f2f bellard
tests/runcom.c tests/pi_10.com \
120 1eb87257 bellard
tests/test_path.c \
121 3ef693a0 bellard
qemu-doc.texi qemu-doc.html
122 586314f2 bellard
123 3ef693a0 bellard
FILE=qemu-$(VERSION)
124 586314f2 bellard
125 586314f2 bellard
tar:
126 586314f2 bellard
	rm -rf /tmp/$(FILE)
127 586314f2 bellard
	mkdir -p /tmp/$(FILE)
128 586314f2 bellard
	cp -P $(FILES) /tmp/$(FILE)
129 586314f2 bellard
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
130 586314f2 bellard
	rm -rf /tmp/$(FILE)
131 586314f2 bellard
132 d691f669 bellard
# generate a binary distribution including the test binary environnment 
133 d691f669 bellard
BINPATH=/usr/local/qemu-i386
134 d691f669 bellard
135 d691f669 bellard
tarbin:
136 1eb87257 bellard
	tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \
137 1eb87257 bellard
                 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr
138 1eb87257 bellard
	tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \
139 1eb87257 bellard
                 $(BINPATH)/wine
140 d691f669 bellard
141 31e31b8a bellard
ifneq ($(wildcard .depend),)
142 31e31b8a bellard
include .depend
143 31e31b8a bellard
endif