17d13299dSbellardinclude config.mak 2766a487aSbellard 37d13299dSbellardCFLAGS=-Wall -O2 -g 431e31b8aSbellardLDFLAGS=-g 5766a487aSbellardLIBS= 6766a487aSbellardDEFINES=-DHAVE_BYTESWAP_H 79c5d1246SbellardHELPER_CFLAGS=$(CFLAGS) 87d13299dSbellard 943ce4dfeSbellardifdef CONFIG_STATIC 1043ce4dfeSbellardLDFLAGS+=-static 1143ce4dfeSbellardendif 1243ce4dfeSbellard 137d13299dSbellardifeq ($(ARCH),i386) 147d13299dSbellardCFLAGS+=-fomit-frame-pointer 15ca735206SbellardOP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 16ca735206Sbellardifeq ($(GCC_MAJOR),3) 17ca735206SbellardOP_CFLAGS+= -falign-functions=0 18ca735206Sbellardelse 19ca735206SbellardOP_CFLAGS+= -malign-functions=0 20ca735206Sbellardendif 212d92f0b8Sbellardifdef TARGET_GPROF 222d92f0b8SbellardLDFLAGS+=-Wl,-T,i386.ld 232d92f0b8Sbellardelse 2427c75a9aSbellard# WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object 2527c75a9aSbellard# that the kernel ELF loader considers as an executable. I think this 2627c75a9aSbellard# is the simplest way to make it self virtualizable! 2727c75a9aSbellardLDFLAGS+=-Wl,-shared 28766a487aSbellardendif 292d92f0b8Sbellardendif 30766a487aSbellard 31766a487aSbellardifeq ($(ARCH),ppc) 32927f621eSbellardOP_CFLAGS=$(CFLAGS) 3327c75a9aSbellardLDFLAGS+=-Wl,-T,ppc.ld 34766a487aSbellardendif 35766a487aSbellard 36fd429f2fSbellardifeq ($(ARCH),s390) 37fd429f2fSbellardOP_CFLAGS=$(CFLAGS) 3827c75a9aSbellardLDFLAGS+=-Wl,-T,s390.ld 39fd429f2fSbellardendif 40fd429f2fSbellard 41ae228531Sbellardifeq ($(ARCH),sparc) 42ae228531SbellardCFLAGS+=-m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 43ae228531SbellardLDFLAGS+=-m32 44ae228531SbellardOP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 459c5d1246SbellardHELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat 469c5d1246SbellardLDFLAGS+=-Wl,-T,sparc.ld 47ae228531Sbellardendif 48ae228531Sbellard 49ae228531Sbellardifeq ($(ARCH),sparc64) 50ae228531SbellardCFLAGS+=-m64 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6 51ae228531SbellardLDFLAGS+=-m64 52ae228531SbellardOP_CFLAGS=$(CFLAGS) -fno-delayed-branch -ffixed-i0 53ae228531Sbellardendif 54ae228531Sbellard 55d6cdca95Sbellardifeq ($(ARCH),alpha) 56a993ba85Sbellard# -msmall-data is not used because we want two-instruction relocations 57a993ba85Sbellard# for the constant constructions 58a993ba85SbellardOP_CFLAGS=-Wall -O2 -g 59d6cdca95Sbellard# Ensure there's only a single GP 6082d19dafSbellardCFLAGS += -msmall-data 61d6cdca95SbellardLDFLAGS+=-Wl,-T,alpha.ld 62d6cdca95Sbellardendif 63d6cdca95Sbellard 64d6cdca95Sbellardifeq ($(ARCH),ia64) 65d6cdca95SbellardOP_CFLAGS=$(CFLAGS) 66d6cdca95Sbellardendif 67d6cdca95Sbellard 689c5d1246Sbellardifeq ($(ARCH),arm) 699c5d1246SbellardOP_CFLAGS=$(CFLAGS) -mno-sched-prolog 709c5d1246SbellardLDFLAGS+=-Wl,-T,arm.ld 719c5d1246Sbellardendif 729c5d1246Sbellard 73ca735206Sbellardifeq ($(GCC_MAJOR),3) 74ca735206Sbellard# very important to generate a return at the end of every operation 75ca735206SbellardOP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls 76ca735206Sbellardendif 77ca735206Sbellard 78766a487aSbellard######################################################### 79766a487aSbellard 800ecfa993SbellardDEFINES+=-D_GNU_SOURCE 813ef693a0SbellardLIBS+=-lm 827d13299dSbellard 837d13299dSbellard# profiling code 847d13299dSbellardifdef TARGET_GPROF 857d13299dSbellardLDFLAGS+=-p 86dc99065bSbellardmain.o: CFLAGS+=-p 877d13299dSbellardendif 8831e31b8aSbellard 89de83cd02SbellardOBJS= elfload.o main.o syscall.o mmap.o signal.o path.o 90de83cd02Sbellardifeq ($(TARGET_ARCH), i386) 91de83cd02SbellardOBJS+= vm86.o 92de83cd02Sbellardendif 933ef693a0SbellardSRCS:= $(OBJS:.o=.c) 943ef693a0SbellardOBJS+= libqemu.a 95612384d7Sbellard 96de83cd02Sbellard# cpu emulator library 97de83cd02SbellardLIBOBJS=thunk.o exec.o translate.o cpu-exec.o 98de83cd02Sbellard 99de83cd02Sbellardifeq ($(TARGET_ARCH), i386) 100de83cd02SbellardLIBOBJS+=translate-i386.o op-i386.o helper-i386.o 101de83cd02Sbellardendif 102de83cd02Sbellardifeq ($(TARGET_ARCH), arm) 103de83cd02SbellardLIBOBJS+=translate-arm.o op-arm.o 104de83cd02Sbellardendif 105aa05ae6fSbellard 1060ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging 107de83cd02SbellardLIBOBJS+=disas.o 108de83cd02Sbellardifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386) 109de83cd02SbellardLIBOBJS+=i386-dis.o 110de83cd02Sbellardendif 111de83cd02Sbellardifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha) 112aa05ae6fSbellardLIBOBJS+=alpha-dis.o 113aa05ae6fSbellardendif 114de83cd02Sbellardifeq ($(findstring ppc, $(TARGET_ARCH) $(ARCH)),ppc) 115aa05ae6fSbellardLIBOBJS+=ppc-dis.o 116aa05ae6fSbellardendif 117de83cd02Sbellardifeq ($(findstring sparc, $(TARGET_ARCH) $(ARCH)),sparc) 1189c5d1246SbellardLIBOBJS+=sparc-dis.o 1199c5d1246Sbellardendif 120de83cd02Sbellardifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm) 1219c5d1246SbellardLIBOBJS+=arm-dis.o 1229c5d1246Sbellardendif 12331e31b8aSbellard 124d6cdca95Sbellardifeq ($(ARCH),ia64) 125d6cdca95SbellardOBJS += ia64-syscall.o 126d6cdca95Sbellardendif 127d6cdca95Sbellard 1283ef693a0Sbellardall: qemu qemu-doc.html 12931e31b8aSbellard 1303ef693a0Sbellardqemu: $(OBJS) 13127c75a9aSbellard $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 132a993ba85Sbellardifeq ($(ARCH),alpha) 133a993ba85Sbellard# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of 134a993ba85Sbellard# the address space (31 bit so sign extending doesn't matter) 135a993ba85Sbellard echo -ne '\001\000\000\000' | dd of=qemu bs=1 seek=48 count=4 conv=notrunc 136a993ba85Sbellardendif 13731e31b8aSbellard 13831e31b8aSbellarddepend: $(SRCS) 13931e31b8aSbellard $(CC) -MM $(CFLAGS) $^ 1>.depend 14031e31b8aSbellard 1413ef693a0Sbellard# libqemu 142612384d7Sbellard 1433ef693a0Sbellardlibqemu.a: $(LIBOBJS) 144612384d7Sbellard rm -f $@ 145612384d7Sbellard $(AR) rcs $@ $(LIBOBJS) 146612384d7Sbellard 147367e86e8Sbellarddyngen: dyngen.c 148367e86e8Sbellard $(HOST_CC) -O2 -Wall -g $< -o $@ 149367e86e8Sbellard 150de83cd02Sbellardtranslate-$(TARGET_ARCH).o: translate-$(TARGET_ARCH).c gen-op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h 151367e86e8Sbellard 152de83cd02Sbellardtranslate.o: translate.c op-$(TARGET_ARCH).h opc-$(TARGET_ARCH).h cpu-$(TARGET_ARCH).h 153de83cd02Sbellard 154de83cd02Sbellardop-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen 155367e86e8Sbellard ./dyngen -o $@ $< 156367e86e8Sbellard 157de83cd02Sbellardopc-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen 1582d92f0b8Sbellard ./dyngen -c -o $@ $< 1592d92f0b8Sbellard 160de83cd02Sbellardgen-op-$(TARGET_ARCH).h: op-$(TARGET_ARCH).o dyngen 161de83cd02Sbellard ./dyngen -g -o $@ $< 162de83cd02Sbellard 163de83cd02Sbellardop-$(TARGET_ARCH).o: op-$(TARGET_ARCH).c 164927f621eSbellard $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< 165367e86e8Sbellard 166de83cd02Sbellardhelper-$(TARGET_ARCH).o: helper-$(TARGET_ARCH).c 1679c5d1246Sbellard $(CC) $(HELPER_CFLAGS) $(DEFINES) -c -o $@ $< 1689c5d1246Sbellard 169de83cd02Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h 170de83cd02Sbellard 171de83cd02Sbellardop-arm.o: op-arm.c op-arm-template.h 172de83cd02Sbellard 17331e31b8aSbellard%.o: %.c 17431e31b8aSbellard $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 17531e31b8aSbellard 17631e31b8aSbellardclean: 1777d13299dSbellard $(MAKE) -C tests clean 1783ef693a0Sbellard rm -f *.o *.a *~ qemu dyngen TAGS 17931e31b8aSbellard 1807d13299dSbellarddistclean: clean 1817d13299dSbellard rm -f config.mak config.h 1827d13299dSbellard 1833ef693a0Sbellardinstall: qemu 1843ef693a0Sbellard install -m 755 -s qemu $(prefix)/bin 185612384d7Sbellard 186367e86e8Sbellard# various test targets 1873ef693a0Sbellardtest speed: qemu 188367e86e8Sbellard make -C tests $@ 18931e31b8aSbellard 190367e86e8SbellardTAGS: 191b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 19231e31b8aSbellard 1933ef693a0Sbellard# documentation 1943ef693a0Sbellardqemu-doc.html: qemu-doc.texi 1953ef693a0Sbellard texi2html -monolithic -number $< 1963ef693a0Sbellard 197586314f2SbellardFILES= \ 198fd429f2fSbellardREADME README.distrib COPYING COPYING.LIB TODO Changelog VERSION \ 199de83cd02Sbellardconfigure \ 200de83cd02Sbellarddyngen.c dyngen.h dyngen-exec.h ioctls.h syscall_types.h \ 201de83cd02SbellardMakefile elf.h elfload.c main.c signal.c qemu.h \ 202de83cd02Sbellardsyscall.c syscall_defs.h vm86.c path.c mmap.c \ 203de83cd02Sbellardppc.ld alpha.ld s390.ld sparc.ld arm.ld\ 204de83cd02Sbellardthunk.c cpu-exec.c translate.c cpu-all.h thunk.h exec.h\ 205de83cd02Sbellardexec.c cpu-exec.c\ 206de83cd02Sbellardcpu-i386.h op-i386.c helper-i386.c syscall-i386.h translate-i386.c \ 207de83cd02Sbellardexec-i386.h ops_template.h op_string.h opreg_template.h \ 208de83cd02Sbellardcpu-arm.h syscall-arm.h exec-arm.h op-arm.c translate-arm.c op-arm-template.h \ 209de83cd02Sbellarddis-asm.h disas.c disas.h alpha-dis.c ppc-dis.c i386-dis.c sparc-dis.c \ 210de83cd02Sbellardarm-dis.c \ 21177f8dd5aSbellardtests/Makefile \ 212586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h \ 213de83cd02Sbellardtests/test-i386-muldiv.h tests/test-i386-code16.S tests/test-i386-vm86.S \ 214*322d0c66Sbellardtests/hello-i386.c tests/hello-i386 \ 215de83cd02Sbellardtests/hello-arm.c tests/hello-arm \ 216de83cd02Sbellardtests/sha1.c \ 2173ef693a0Sbellardtests/testsig.c tests/testclone.c tests/testthread.c \ 218fd429f2fSbellardtests/runcom.c tests/pi_10.com \ 2191eb87257Sbellardtests/test_path.c \ 2203ef693a0Sbellardqemu-doc.texi qemu-doc.html 221586314f2Sbellard 2223ef693a0SbellardFILE=qemu-$(VERSION) 223586314f2Sbellard 224586314f2Sbellardtar: 225586314f2Sbellard rm -rf /tmp/$(FILE) 226586314f2Sbellard mkdir -p /tmp/$(FILE) 227586314f2Sbellard cp -P $(FILES) /tmp/$(FILE) 228586314f2Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) ) 229586314f2Sbellard rm -rf /tmp/$(FILE) 230586314f2Sbellard 231d691f669Sbellard# generate a binary distribution including the test binary environnment 232d691f669SbellardBINPATH=/usr/local/qemu-i386 233d691f669Sbellard 234d691f669Sbellardtarbin: 2351eb87257Sbellard tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \ 2361eb87257Sbellard $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr 2371eb87257Sbellard tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \ 2381eb87257Sbellard $(BINPATH)/wine 239d691f669Sbellard 24031e31b8aSbellardifneq ($(wildcard .depend),) 24131e31b8aSbellardinclude .depend 24231e31b8aSbellardendif 243