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 32*d6cdca95Sbellardifeq ($(ARCH),alpha) 33*d6cdca95Sbellard# Ensure there's only a single GP 34*d6cdca95SbellardCFLAGS += -msmall-data -msmall-text 35*d6cdca95Sbellard# FIXME Too lazy to deal with gprelhigh/gprellow for now, inhibit them 36*d6cdca95SbellardOP_CFLAGS=$(CFLAGS) -mno-explicit-relocs 37*d6cdca95SbellardLDFLAGS+=-Wl,-T,alpha.ld 38*d6cdca95Sbellardendif 39*d6cdca95Sbellard 40*d6cdca95Sbellardifeq ($(ARCH),ia64) 41*d6cdca95SbellardOP_CFLAGS=$(CFLAGS) 42*d6cdca95Sbellardendif 43*d6cdca95Sbellard 44ca735206Sbellardifeq ($(GCC_MAJOR),3) 45ca735206Sbellard# very important to generate a return at the end of every operation 46ca735206SbellardOP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls 47ca735206Sbellardendif 48ca735206Sbellard 49766a487aSbellard######################################################### 50766a487aSbellard 510ecfa993SbellardDEFINES+=-D_GNU_SOURCE 523ef693a0SbellardLIBS+=-lm 537d13299dSbellard 547d13299dSbellard# profiling code 557d13299dSbellardifdef TARGET_GPROF 567d13299dSbellardLDFLAGS+=-p 57dc99065bSbellardmain.o: CFLAGS+=-p 587d13299dSbellardendif 5931e31b8aSbellard 601eb87257SbellardOBJS= elfload.o main.o syscall.o signal.o path.o 613ef693a0SbellardSRCS:= $(OBJS:.o=.c) 623ef693a0SbellardOBJS+= libqemu.a 63612384d7Sbellard 643ef693a0SbellardLIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o 650ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging 66b9adb4a6SbellardLIBOBJS+=disas.o ppc-dis.o i386-dis.o dis-buf.o 6731e31b8aSbellard 68*d6cdca95Sbellardifeq ($(ARCH),ia64) 69*d6cdca95SbellardOBJS += ia64-syscall.o 70*d6cdca95Sbellardendif 71*d6cdca95Sbellard 723ef693a0Sbellardall: qemu qemu-doc.html 7331e31b8aSbellard 743ef693a0Sbellardqemu: $(OBJS) 7527c75a9aSbellard $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) 7631e31b8aSbellard 7731e31b8aSbellarddepend: $(SRCS) 7831e31b8aSbellard $(CC) -MM $(CFLAGS) $^ 1>.depend 7931e31b8aSbellard 803ef693a0Sbellard# libqemu 81612384d7Sbellard 823ef693a0Sbellardlibqemu.a: $(LIBOBJS) 83612384d7Sbellard rm -f $@ 84612384d7Sbellard $(AR) rcs $@ $(LIBOBJS) 85612384d7Sbellard 86367e86e8Sbellarddyngen: dyngen.c 87367e86e8Sbellard $(HOST_CC) -O2 -Wall -g $< -o $@ 88367e86e8Sbellard 89367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h 90367e86e8Sbellard 91367e86e8Sbellardop-i386.h: op-i386.o dyngen 92367e86e8Sbellard ./dyngen -o $@ $< 93367e86e8Sbellard 94367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h 95927f621eSbellard $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< 96367e86e8Sbellard 9731e31b8aSbellard%.o: %.c 9831e31b8aSbellard $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 9931e31b8aSbellard 10031e31b8aSbellardclean: 1017d13299dSbellard $(MAKE) -C tests clean 1023ef693a0Sbellard rm -f *.o *.a *~ qemu dyngen TAGS 10331e31b8aSbellard 1047d13299dSbellarddistclean: clean 1057d13299dSbellard rm -f config.mak config.h 1067d13299dSbellard 1073ef693a0Sbellardinstall: qemu 1083ef693a0Sbellard install -m 755 -s qemu $(prefix)/bin 109612384d7Sbellard 110367e86e8Sbellard# various test targets 1113ef693a0Sbellardtest speed: qemu 112367e86e8Sbellard make -C tests $@ 11331e31b8aSbellard 114367e86e8SbellardTAGS: 115b9adb4a6Sbellard etags *.[ch] tests/*.[ch] 11631e31b8aSbellard 1173ef693a0Sbellard# documentation 1183ef693a0Sbellardqemu-doc.html: qemu-doc.texi 1193ef693a0Sbellard texi2html -monolithic -number $< 1203ef693a0Sbellard 121586314f2SbellardFILES= \ 122fd429f2fSbellardREADME README.distrib COPYING COPYING.LIB TODO Changelog VERSION \ 123fd429f2fSbellarddyngen.c ioctls.h ops_template.h op_string.h syscall_types.h\ 12409bfb054SbellardMakefile elf.h thunk.c\ 1253ef693a0Sbellardelfload.c main.c signal.c thunk.h\ 1263ef693a0Sbellardcpu-i386.h qemu.h op-i386.c opc-i386.h syscall-i386.h translate-i386.c\ 12727c75a9aSbellarddis-asm.h gen-i386.h syscall.c\ 128b9adb4a6Sbellarddis-buf.c disas.c disas.h ppc-dis.c i386-dis.c opreg_template.h syscall_defs.h\ 1291eb87257Sbellardppc.ld s390.ld exec-i386.h exec-i386.c path.c configure \ 13077f8dd5aSbellardtests/Makefile\ 131586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\ 132612384d7Sbellardtests/test-i386-muldiv.h tests/test-i386-code16.S\ 133612384d7Sbellardtests/hello.c tests/hello tests/sha1.c \ 1343ef693a0Sbellardtests/testsig.c tests/testclone.c tests/testthread.c \ 135fd429f2fSbellardtests/runcom.c tests/pi_10.com \ 1361eb87257Sbellardtests/test_path.c \ 1373ef693a0Sbellardqemu-doc.texi qemu-doc.html 138586314f2Sbellard 1393ef693a0SbellardFILE=qemu-$(VERSION) 140586314f2Sbellard 141586314f2Sbellardtar: 142586314f2Sbellard rm -rf /tmp/$(FILE) 143586314f2Sbellard mkdir -p /tmp/$(FILE) 144586314f2Sbellard cp -P $(FILES) /tmp/$(FILE) 145586314f2Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) ) 146586314f2Sbellard rm -rf /tmp/$(FILE) 147586314f2Sbellard 148d691f669Sbellard# generate a binary distribution including the test binary environnment 149d691f669SbellardBINPATH=/usr/local/qemu-i386 150d691f669Sbellard 151d691f669Sbellardtarbin: 1521eb87257Sbellard tar zcvf /tmp/qemu-$(VERSION)-i386-glibc21.tar.gz \ 1531eb87257Sbellard $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin $(BINPATH)/usr 1541eb87257Sbellard tar zcvf /tmp/qemu-$(VERSION)-i386-wine.tar.gz \ 1551eb87257Sbellard $(BINPATH)/wine 156d691f669Sbellard 15731e31b8aSbellardifneq ($(wildcard .depend),) 15831e31b8aSbellardinclude .depend 15931e31b8aSbellardendif 160