17d13299dSbellardinclude config.mak 2766a487aSbellard 37d13299dSbellardCFLAGS=-Wall -O2 -g 431e31b8aSbellardLDFLAGS=-g 5766a487aSbellardLIBS= 6766a487aSbellardDEFINES=-DHAVE_BYTESWAP_H 77d13299dSbellard 87d13299dSbellardifeq ($(ARCH),i386) 97d13299dSbellardCFLAGS+=-fomit-frame-pointer 10ca735206SbellardOP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 11ca735206Sbellardifeq ($(GCC_MAJOR),3) 12ca735206SbellardOP_CFLAGS+= -falign-functions=0 13ca735206Sbellardelse 14ca735206SbellardOP_CFLAGS+= -malign-functions=0 15ca735206Sbellardendif 1627c75a9aSbellard# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object 1727c75a9aSbellard# that the kernel ELF loader considers as an executable. I think this 1827c75a9aSbellard# is the simplest way to make it self virtualizable! 1927c75a9aSbellardLDFLAGS+=-Wl,-shared 20766a487aSbellardendif 21766a487aSbellard 22766a487aSbellardifeq ($(ARCH),ppc) 23927f621eSbellardOP_CFLAGS=$(CFLAGS) 2427c75a9aSbellardLDFLAGS+=-Wl,-T,ppc.ld 25766a487aSbellardendif 26766a487aSbellard 27fd429f2fSbellardifeq ($(ARCH),s390) 28fd429f2fSbellardOP_CFLAGS=$(CFLAGS) 2927c75a9aSbellardLDFLAGS+=-Wl,-T,s390.ld 30fd429f2fSbellardendif 31fd429f2fSbellard 32ca735206Sbellardifeq ($(GCC_MAJOR),3) 33ca735206Sbellard# very important to generate a return at the end of every operation 34ca735206SbellardOP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls 35ca735206Sbellardendif 36ca735206Sbellard 37766a487aSbellard######################################################### 38766a487aSbellard 390ecfa993SbellardDEFINES+=-D_GNU_SOURCE 403ef693a0SbellardLIBS+=-lm 417d13299dSbellard 427d13299dSbellard# profiling code 437d13299dSbellardifdef TARGET_GPROF 447d13299dSbellardLDFLAGS+=-p 45dc99065bSbellardmain.o: CFLAGS+=-p 467d13299dSbellardendif 4731e31b8aSbellard 48*1eb87257SbellardOBJS= elfload.o main.o syscall.o signal.o path.o 493ef693a0SbellardSRCS:= $(OBJS:.o=.c) 503ef693a0SbellardOBJS+= libqemu.a 51612384d7Sbellard 523ef693a0SbellardLIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o 530ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging 54612384d7SbellardLIBOBJS+=i386-dis.o dis-buf.o 5531e31b8aSbellard 563ef693a0Sbellardall: qemu qemu-doc.html 5731e31b8aSbellard 583ef693a0Sbellardqemu: $(OBJS) 5927c75a9aSbellard $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 6031e31b8aSbellard 6131e31b8aSbellarddepend: $(SRCS) 6231e31b8aSbellard $(CC) -MM $(CFLAGS) $^ 1>.depend 6331e31b8aSbellard 643ef693a0Sbellard# libqemu 65612384d7Sbellard 663ef693a0Sbellardlibqemu.a: $(LIBOBJS) 67612384d7Sbellard rm -f $@ 68612384d7Sbellard $(AR) rcs $@ $(LIBOBJS) 69612384d7Sbellard 70367e86e8Sbellarddyngen: dyngen.c 71367e86e8Sbellard $(HOST_CC) -O2 -Wall -g $< -o $@ 72367e86e8Sbellard 73367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h 74367e86e8Sbellard 75367e86e8Sbellardop-i386.h: op-i386.o dyngen 76367e86e8Sbellard ./dyngen -o $@ $< 77367e86e8Sbellard 78367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h 79927f621eSbellard $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< 80367e86e8Sbellard 8131e31b8aSbellard%.o: %.c 8231e31b8aSbellard $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 8331e31b8aSbellard 8431e31b8aSbellardclean: 857d13299dSbellard $(MAKE) -C tests clean 863ef693a0Sbellard rm -f *.o *.a *~ qemu dyngen TAGS 8731e31b8aSbellard 887d13299dSbellarddistclean: clean 897d13299dSbellard rm -f config.mak config.h 907d13299dSbellard 913ef693a0Sbellardinstall: qemu 923ef693a0Sbellard install -m 755 -s qemu $(prefix)/bin 93612384d7Sbellard 94367e86e8Sbellard# various test targets 953ef693a0Sbellardtest speed: qemu 96367e86e8Sbellard make -C tests $@ 9731e31b8aSbellard 98367e86e8SbellardTAGS: 99367e86e8Sbellard etags *.[ch] i386/*.[ch] 10031e31b8aSbellard 1013ef693a0Sbellard# documentation 1023ef693a0Sbellardqemu-doc.html: qemu-doc.texi 1033ef693a0Sbellard texi2html -monolithic -number $< 1043ef693a0Sbellard 105586314f2SbellardFILES= \ 106fd429f2fSbellardREADME README.distrib COPYING COPYING.LIB TODO Changelog VERSION \ 107fd429f2fSbellarddyngen.c ioctls.h ops_template.h op_string.h syscall_types.h\ 10809bfb054SbellardMakefile elf.h thunk.c\ 1093ef693a0Sbellardelfload.c main.c signal.c thunk.h\ 1103ef693a0Sbellardcpu-i386.h qemu.h op-i386.c opc-i386.h syscall-i386.h translate-i386.c\ 11127c75a9aSbellarddis-asm.h gen-i386.h syscall.c\ 112586314f2Sbellarddis-buf.c i386-dis.c opreg_template.h syscall_defs.h\ 113*1eb87257Sbellardppc.ld s390.ld exec-i386.h exec-i386.c path.c configure \ 11477f8dd5aSbellardtests/Makefile\ 115586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\ 116612384d7Sbellardtests/test-i386-muldiv.h tests/test-i386-code16.S\ 117612384d7Sbellardtests/hello.c tests/hello tests/sha1.c \ 1183ef693a0Sbellardtests/testsig.c tests/testclone.c tests/testthread.c \ 119fd429f2fSbellardtests/runcom.c tests/pi_10.com \ 120*1eb87257Sbellardtests/test_path.c \ 1213ef693a0Sbellardqemu-doc.texi qemu-doc.html 122586314f2Sbellard 1233ef693a0SbellardFILE=qemu-$(VERSION) 124586314f2Sbellard 125586314f2Sbellardtar: 126586314f2Sbellard rm -rf /tmp/$(FILE) 127586314f2Sbellard mkdir -p /tmp/$(FILE) 128586314f2Sbellard cp -P $(FILES) /tmp/$(FILE) 129586314f2Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) ) 130586314f2Sbellard rm -rf /tmp/$(FILE) 131586314f2Sbellard 132d691f669Sbellard# generate a binary distribution including the test binary environnment 133d691f669SbellardBINPATH=/usr/local/qemu-i386 134d691f669Sbellard 135d691f669Sbellardtarbin: 136*1eb87257Sbellard tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \ 137*1eb87257Sbellard $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr 138*1eb87257Sbellard tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \ 139*1eb87257Sbellard $(BINPATH)/wine 140d691f669Sbellard 14131e31b8aSbellardifneq ($(wildcard .depend),) 14231e31b8aSbellardinclude .depend 14331e31b8aSbellardendif 144