xref: /openbmc/qemu/Makefile (revision d691f669)
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
22ca735206Sbellardifeq ($(GCC_MAJOR),3)
23ca735206Sbellard# very important to generate a return at the end of every operation
24ca735206SbellardOP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
25ca735206Sbellardendif
26ca735206Sbellard
27766a487aSbellard#########################################################
28766a487aSbellard
290ecfa993SbellardDEFINES+=-D_GNU_SOURCE
30766a487aSbellardLDSCRIPT=$(ARCH).ld
313ef693a0SbellardLIBS+=-lm
327d13299dSbellard
337d13299dSbellard# profiling code
347d13299dSbellardifdef TARGET_GPROF
357d13299dSbellardLDFLAGS+=-p
36dc99065bSbellardmain.o: CFLAGS+=-p
377d13299dSbellardendif
3831e31b8aSbellard
393ef693a0SbellardOBJS= elfload.o main.o syscall.o signal.o
403ef693a0SbellardSRCS:= $(OBJS:.o=.c)
413ef693a0SbellardOBJS+= libqemu.a
42612384d7Sbellard
433ef693a0SbellardLIBOBJS+=thunk.o translate-i386.o op-i386.o exec-i386.o
440ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging
45612384d7SbellardLIBOBJS+=i386-dis.o dis-buf.o
4631e31b8aSbellard
473ef693a0Sbellardall: qemu qemu-doc.html
4831e31b8aSbellard
493ef693a0Sbellardqemu: $(OBJS)
50367e86e8Sbellard	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^  $(LIBS)
5131e31b8aSbellard
5231e31b8aSbellarddepend: $(SRCS)
5331e31b8aSbellard	$(CC) -MM $(CFLAGS) $^ 1>.depend
5431e31b8aSbellard
553ef693a0Sbellard# libqemu
56612384d7Sbellard
573ef693a0Sbellardlibqemu.a: $(LIBOBJS)
58612384d7Sbellard	rm -f $@
59612384d7Sbellard	$(AR) rcs $@ $(LIBOBJS)
60612384d7Sbellard
61367e86e8Sbellarddyngen: dyngen.c
62367e86e8Sbellard	$(HOST_CC) -O2 -Wall -g $< -o $@
63367e86e8Sbellard
64367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h
65367e86e8Sbellard
66367e86e8Sbellardop-i386.h: op-i386.o dyngen
67367e86e8Sbellard	./dyngen -o $@ $<
68367e86e8Sbellard
69367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h
70927f621eSbellard	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
71367e86e8Sbellard
7231e31b8aSbellard%.o: %.c
7331e31b8aSbellard	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
7431e31b8aSbellard
7531e31b8aSbellardclean:
767d13299dSbellard	$(MAKE) -C tests clean
773ef693a0Sbellard	rm -f *.o  *.a *~ qemu dyngen TAGS
7831e31b8aSbellard
797d13299dSbellarddistclean: clean
807d13299dSbellard	rm -f config.mak config.h
817d13299dSbellard
823ef693a0Sbellardinstall: qemu
833ef693a0Sbellard	install -m 755 -s qemu $(prefix)/bin
84612384d7Sbellard
85367e86e8Sbellard# various test targets
863ef693a0Sbellardtest speed: qemu
87367e86e8Sbellard	make -C tests $@
8831e31b8aSbellard
89367e86e8SbellardTAGS:
90367e86e8Sbellard	etags *.[ch] i386/*.[ch]
9131e31b8aSbellard
923ef693a0Sbellard# documentation
933ef693a0Sbellardqemu-doc.html: qemu-doc.texi
943ef693a0Sbellard	texi2html -monolithic -number $<
953ef693a0Sbellard
96586314f2SbellardFILES= \
973ef693a0SbellardREADME COPYING COPYING.LIB TODO Changelog VERSION \
983ef693a0Sbellarddyngen.c ioctls.h ops_template.h  syscall_types.h\
99586314f2SbellardMakefile     elf.h       linux_bin.h       segment.h       thunk.c\
1003ef693a0Sbellardelfload.c   main.c            signal.c        thunk.h\
1013ef693a0Sbellardcpu-i386.h   qemu.h      op-i386.c opc-i386.h syscall-i386.h  translate-i386.c\
102586314f2Sbellarddis-asm.h    gen-i386.h  op-i386.h         syscall.c\
103586314f2Sbellarddis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
1043ef693a0Sbellardi386.ld ppc.ld exec-i386.h exec-i386.c configure \
10577f8dd5aSbellardtests/Makefile\
106586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
107612384d7Sbellardtests/test-i386-muldiv.h tests/test-i386-code16.S\
108612384d7Sbellardtests/hello.c tests/hello tests/sha1.c \
1093ef693a0Sbellardtests/testsig.c tests/testclone.c tests/testthread.c \
1103ef693a0Sbellardqemu-doc.texi qemu-doc.html
111586314f2Sbellard
1123ef693a0SbellardFILE=qemu-$(VERSION)
113586314f2Sbellard
114586314f2Sbellardtar:
115586314f2Sbellard	rm -rf /tmp/$(FILE)
116586314f2Sbellard	mkdir -p /tmp/$(FILE)
117586314f2Sbellard	cp -P $(FILES) /tmp/$(FILE)
118586314f2Sbellard	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
119586314f2Sbellard	rm -rf /tmp/$(FILE)
120586314f2Sbellard
121*d691f669Sbellard# generate a binary distribution including the test binary environnment
122*d691f669SbellardBINPATH=/usr/local/qemu-i386
123*d691f669Sbellard
124*d691f669Sbellardtarbin:
125*d691f669Sbellard	tar zcvf /tmp/qemu-i386-glibc21.tar.gz \
126*d691f669Sbellard                 $(BINPATH)/etc $(BINPATH)/lib $(BINPATH)/bin
127*d691f669Sbellard	tar zcvf /tmp/qemu-i386-wine.tar.gz \
128*d691f669Sbellard                 $(BINPATH)/X11R6 $(BINPATH)/wine
129*d691f669Sbellard
13031e31b8aSbellardifneq ($(wildcard .depend),)
13131e31b8aSbellardinclude .depend
13231e31b8aSbellardendif
133