xref: /openbmc/qemu/Makefile (revision fd429f2f)
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
16766a487aSbellardendif
17766a487aSbellard
18766a487aSbellardifeq ($(ARCH),ppc)
19927f621eSbellardOP_CFLAGS=$(CFLAGS)
20766a487aSbellardendif
21766a487aSbellard
22*fd429f2fSbellardifeq ($(ARCH),s390)
23*fd429f2fSbellardOP_CFLAGS=$(CFLAGS)
24*fd429f2fSbellardendif
25*fd429f2fSbellard
26ca735206Sbellardifeq ($(GCC_MAJOR),3)
27ca735206Sbellard# very important to generate a return at the end of every operation
28ca735206SbellardOP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
29ca735206Sbellardendif
30ca735206Sbellard
31766a487aSbellard#########################################################
32766a487aSbellard
330ecfa993SbellardDEFINES+=-D_GNU_SOURCE
34766a487aSbellardLDSCRIPT=$(ARCH).ld
353ef693a0SbellardLIBS+=-lm
367d13299dSbellard
377d13299dSbellard# profiling code
387d13299dSbellardifdef TARGET_GPROF
397d13299dSbellardLDFLAGS+=-p
40dc99065bSbellardmain.o: CFLAGS+=-p
417d13299dSbellardendif
4231e31b8aSbellard
433ef693a0SbellardOBJS= elfload.o main.o syscall.o signal.o
443ef693a0SbellardSRCS:= $(OBJS:.o=.c)
453ef693a0SbellardOBJS+= libqemu.a
46612384d7Sbellard
473ef693a0SbellardLIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o
480ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging
49612384d7SbellardLIBOBJS+=i386-dis.o dis-buf.o
5031e31b8aSbellard
513ef693a0Sbellardall: qemu qemu-doc.html
5231e31b8aSbellard
533ef693a0Sbellardqemu: $(OBJS)
54367e86e8Sbellard	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^  $(LIBS)
5531e31b8aSbellard
5631e31b8aSbellarddepend: $(SRCS)
5731e31b8aSbellard	$(CC) -MM $(CFLAGS) $^ 1>.depend
5831e31b8aSbellard
593ef693a0Sbellard# libqemu
60612384d7Sbellard
613ef693a0Sbellardlibqemu.a: $(LIBOBJS)
62612384d7Sbellard	rm -f $@
63612384d7Sbellard	$(AR) rcs $@ $(LIBOBJS)
64612384d7Sbellard
65367e86e8Sbellarddyngen: dyngen.c
66367e86e8Sbellard	$(HOST_CC) -O2 -Wall -g $< -o $@
67367e86e8Sbellard
68367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h
69367e86e8Sbellard
70367e86e8Sbellardop-i386.h: op-i386.o dyngen
71367e86e8Sbellard	./dyngen -o $@ $<
72367e86e8Sbellard
73367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h
74927f621eSbellard	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
75367e86e8Sbellard
7631e31b8aSbellard%.o: %.c
7731e31b8aSbellard	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
7831e31b8aSbellard
7931e31b8aSbellardclean:
807d13299dSbellard	$(MAKE) -C tests clean
813ef693a0Sbellard	rm -f *.o  *.a *~ qemu dyngen TAGS
8231e31b8aSbellard
837d13299dSbellarddistclean: clean
847d13299dSbellard	rm -f config.mak config.h
857d13299dSbellard
863ef693a0Sbellardinstall: qemu
873ef693a0Sbellard	install -m 755 -s qemu $(prefix)/bin
88612384d7Sbellard
89367e86e8Sbellard# various test targets
903ef693a0Sbellardtest speed: qemu
91367e86e8Sbellard	make -C tests $@
9231e31b8aSbellard
93367e86e8SbellardTAGS:
94367e86e8Sbellard	etags *.[ch] i386/*.[ch]
9531e31b8aSbellard
963ef693a0Sbellard# documentation
973ef693a0Sbellardqemu-doc.html: qemu-doc.texi
983ef693a0Sbellard	texi2html -monolithic -number $<
993ef693a0Sbellard
100586314f2SbellardFILES= \
101*fd429f2fSbellardREADME README.distrib COPYING COPYING.LIB TODO Changelog VERSION \
102*fd429f2fSbellarddyngen.c ioctls.h ops_template.h op_string.h  syscall_types.h\
103586314f2SbellardMakefile     elf.h       linux_bin.h       segment.h       thunk.c\
1043ef693a0Sbellardelfload.c   main.c            signal.c        thunk.h\
1053ef693a0Sbellardcpu-i386.h qemu.h op-i386.c opc-i386.h syscall-i386.h  translate-i386.c\
106586314f2Sbellarddis-asm.h    gen-i386.h  op-i386.h         syscall.c\
107586314f2Sbellarddis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
108*fd429f2fSbellardi386.ld ppc.ld s390.ld exec-i386.h exec-i386.c configure \
10977f8dd5aSbellardtests/Makefile\
110586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
111612384d7Sbellardtests/test-i386-muldiv.h tests/test-i386-code16.S\
112612384d7Sbellardtests/hello.c tests/hello tests/sha1.c \
1133ef693a0Sbellardtests/testsig.c tests/testclone.c tests/testthread.c \
114*fd429f2fSbellardtests/runcom.c tests/pi_10.com \
1153ef693a0Sbellardqemu-doc.texi qemu-doc.html
116586314f2Sbellard
1173ef693a0SbellardFILE=qemu-$(VERSION)
118586314f2Sbellard
119586314f2Sbellardtar:
120586314f2Sbellard	rm -rf /tmp/$(FILE)
121586314f2Sbellard	mkdir -p /tmp/$(FILE)
122586314f2Sbellard	cp -P $(FILES) /tmp/$(FILE)
123586314f2Sbellard	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
124586314f2Sbellard	rm -rf /tmp/$(FILE)
125586314f2Sbellard
126d691f669Sbellard# generate a binary distribution including the test binary environnment
127d691f669SbellardBINPATH=/usr/local/qemu-i386
128d691f669Sbellard
129d691f669Sbellardtarbin:
130d691f669Sbellard	tar zcvf /tmp/qemu-i386-glibc21.tar.gz \
131d691f669Sbellard                 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin
132d691f669Sbellard	tar zcvf /tmp/qemu-i386-wine.tar.gz \
133d691f669Sbellard                 $(BINPATH)/X11R6 $(BINPATH)/wine
134d691f669Sbellard
13531e31b8aSbellardifneq ($(wildcard .depend),)
13631e31b8aSbellardinclude .depend
13731e31b8aSbellardendif
138