blob: e6d1dedc26c9b1e2dc11dbfa7ee6e1d572d2b678 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001include config.mak
bellard766a4872003-02-18 23:35:48 +00002
bellard7d132992003-03-06 23:23:54 +00003CFLAGS=-Wall -O2 -g
bellard31e31b82003-02-18 22:55:36 +00004LDFLAGS=-g
bellard766a4872003-02-18 23:35:48 +00005LIBS=
bellard766a4872003-02-18 23:35:48 +00006DEFINES=-DHAVE_BYTESWAP_H
bellard7d132992003-03-06 23:23:54 +00007
8ifeq ($(ARCH),i386)
9CFLAGS+=-fomit-frame-pointer
bellardca735202003-03-18 20:41:34 +000010OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
11ifeq ($(GCC_MAJOR),3)
12OP_CFLAGS+= -falign-functions=0
13else
14OP_CFLAGS+= -malign-functions=0
15endif
bellard766a4872003-02-18 23:35:48 +000016endif
17
18ifeq ($(ARCH),ppc)
bellard927f6212003-03-02 19:39:42 +000019OP_CFLAGS=$(CFLAGS)
bellard766a4872003-02-18 23:35:48 +000020endif
21
bellardfd429f22003-03-30 20:59:46 +000022ifeq ($(ARCH),s390)
23OP_CFLAGS=$(CFLAGS)
24endif
25
bellardca735202003-03-18 20:41:34 +000026ifeq ($(GCC_MAJOR),3)
27# very important to generate a return at the end of every operation
28OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
29endif
30
bellard766a4872003-02-18 23:35:48 +000031#########################################################
32
bellard0ecfa992003-03-03 14:32:43 +000033DEFINES+=-D_GNU_SOURCE
bellard766a4872003-02-18 23:35:48 +000034LDSCRIPT=$(ARCH).ld
bellard3ef693a2003-03-23 20:17:16 +000035LIBS+=-lm
bellard7d132992003-03-06 23:23:54 +000036
37# profiling code
38ifdef TARGET_GPROF
39LDFLAGS+=-p
bellarddc990652003-03-19 00:00:28 +000040main.o: CFLAGS+=-p
bellard7d132992003-03-06 23:23:54 +000041endif
bellard31e31b82003-02-18 22:55:36 +000042
bellard3ef693a2003-03-23 20:17:16 +000043OBJS= elfload.o main.o syscall.o signal.o
44SRCS:= $(OBJS:.o=.c)
45OBJS+= libqemu.a
bellard612384d2003-03-22 17:31:19 +000046
bellard3ef693a2003-03-23 20:17:16 +000047LIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o
bellard0ecfa992003-03-03 14:32:43 +000048# NOTE: the disassembler code is only needed for debugging
bellard612384d2003-03-22 17:31:19 +000049LIBOBJS+=i386-dis.o dis-buf.o
bellard31e31b82003-02-18 22:55:36 +000050
bellard3ef693a2003-03-23 20:17:16 +000051all: qemu qemu-doc.html
bellard31e31b82003-02-18 22:55:36 +000052
bellard3ef693a2003-03-23 20:17:16 +000053qemu: $(OBJS)
bellard612384d2003-03-22 17:31:19 +000054 $(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS)
bellard31e31b82003-02-18 22:55:36 +000055
56depend: $(SRCS)
57 $(CC) -MM $(CFLAGS) $^ 1>.depend
58
bellard3ef693a2003-03-23 20:17:16 +000059# libqemu
bellard612384d2003-03-22 17:31:19 +000060
bellard3ef693a2003-03-23 20:17:16 +000061libqemu.a: $(LIBOBJS)
bellard612384d2003-03-22 17:31:19 +000062 rm -f $@
63 $(AR) rcs $@ $(LIBOBJS)
64
bellard367e86e2003-03-01 17:13:26 +000065dyngen: dyngen.c
66 $(HOST_CC) -O2 -Wall -g $< -o $@
67
68translate-i386.o: translate-i386.c op-i386.h cpu-i386.h
69
70op-i386.h: op-i386.o dyngen
71 ./dyngen -o $@ $<
72
73op-i386.o: op-i386.c opreg_template.h ops_template.h
bellard927f6212003-03-02 19:39:42 +000074 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
bellard367e86e2003-03-01 17:13:26 +000075
bellard31e31b82003-02-18 22:55:36 +000076%.o: %.c
77 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
78
79clean:
bellard7d132992003-03-06 23:23:54 +000080 $(MAKE) -C tests clean
bellard3ef693a2003-03-23 20:17:16 +000081 rm -f *.o *.a *~ qemu dyngen TAGS
bellard31e31b82003-02-18 22:55:36 +000082
bellard7d132992003-03-06 23:23:54 +000083distclean: clean
84 rm -f config.mak config.h
85
bellard3ef693a2003-03-23 20:17:16 +000086install: qemu
87 install -m 755 -s qemu $(prefix)/bin
bellard612384d2003-03-22 17:31:19 +000088
bellard367e86e2003-03-01 17:13:26 +000089# various test targets
bellard3ef693a2003-03-23 20:17:16 +000090test speed: qemu
bellard367e86e2003-03-01 17:13:26 +000091 make -C tests $@
bellard31e31b82003-02-18 22:55:36 +000092
bellard367e86e2003-03-01 17:13:26 +000093TAGS:
94 etags *.[ch] i386/*.[ch]
bellard31e31b82003-02-18 22:55:36 +000095
bellard3ef693a2003-03-23 20:17:16 +000096# documentation
97qemu-doc.html: qemu-doc.texi
98 texi2html -monolithic -number $<
99
bellard586314f2003-03-03 15:02:29 +0000100FILES= \
bellardfd429f22003-03-30 20:59:46 +0000101README README.distrib COPYING COPYING.LIB TODO Changelog VERSION \
102dyngen.c ioctls.h ops_template.h op_string.h syscall_types.h\
bellard586314f2003-03-03 15:02:29 +0000103Makefile elf.h linux_bin.h segment.h thunk.c\
bellard3ef693a2003-03-23 20:17:16 +0000104elfload.c main.c signal.c thunk.h\
bellardfd429f22003-03-30 20:59:46 +0000105cpu-i386.h qemu.h op-i386.c opc-i386.h syscall-i386.h translate-i386.c\
bellard586314f2003-03-03 15:02:29 +0000106dis-asm.h gen-i386.h op-i386.h syscall.c\
107dis-buf.c i386-dis.c opreg_template.h syscall_defs.h\
bellardfd429f22003-03-30 20:59:46 +0000108i386.ld ppc.ld s390.ld exec-i386.h exec-i386.c configure \
bellard77f8dd52003-03-05 22:24:48 +0000109tests/Makefile\
bellard586314f2003-03-03 15:02:29 +0000110tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
bellard612384d2003-03-22 17:31:19 +0000111tests/test-i386-muldiv.h tests/test-i386-code16.S\
112tests/hello.c tests/hello tests/sha1.c \
bellard3ef693a2003-03-23 20:17:16 +0000113tests/testsig.c tests/testclone.c tests/testthread.c \
bellardfd429f22003-03-30 20:59:46 +0000114tests/runcom.c tests/pi_10.com \
bellard3ef693a2003-03-23 20:17:16 +0000115qemu-doc.texi qemu-doc.html
bellard586314f2003-03-03 15:02:29 +0000116
bellard3ef693a2003-03-23 20:17:16 +0000117FILE=qemu-$(VERSION)
bellard586314f2003-03-03 15:02:29 +0000118
119tar:
120 rm -rf /tmp/$(FILE)
121 mkdir -p /tmp/$(FILE)
122 cp -P $(FILES) /tmp/$(FILE)
123 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
124 rm -rf /tmp/$(FILE)
125
bellardd691f662003-03-24 21:58:34 +0000126# generate a binary distribution including the test binary environnment
127BINPATH=/usr/local/qemu-i386
128
129tarbin:
130 tar zcvf /tmp/qemu-i386-glibc21.tar.gz \
131 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin
132 tar zcvf /tmp/qemu-i386-wine.tar.gz \
133 $(BINPATH)/X11R6 $(BINPATH)/wine
134
bellard31e31b82003-02-18 22:55:36 +0000135ifneq ($(wildcard .depend),)
136include .depend
137endif