xref: /openbmc/qemu/Makefile (revision ca735206)
17d13299dSbellardinclude config.mak
2766a487aSbellard
37d13299dSbellardCFLAGS=-Wall -O2 -g
431e31b8aSbellardLDFLAGS=-g
5766a487aSbellardLIBS=
6766a487aSbellardDEFINES=-DHAVE_BYTESWAP_H
77d13299dSbellard
87d13299dSbellardifeq ($(ARCH),i386)
97d13299dSbellardCFLAGS+=-fomit-frame-pointer
10*ca735206SbellardOP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2
11*ca735206Sbellardifeq ($(GCC_MAJOR),3)
12*ca735206SbellardOP_CFLAGS+= -falign-functions=0
13*ca735206Sbellardelse
14*ca735206SbellardOP_CFLAGS+= -malign-functions=0
15*ca735206Sbellardendif
16766a487aSbellardendif
17766a487aSbellard
18766a487aSbellardifeq ($(ARCH),ppc)
19927f621eSbellardOP_CFLAGS=$(CFLAGS)
20766a487aSbellardendif
21766a487aSbellard
22*ca735206Sbellardifeq ($(GCC_MAJOR),3)
23*ca735206Sbellard# very important to generate a return at the end of every operation
24*ca735206SbellardOP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls
25*ca735206Sbellardendif
26*ca735206Sbellard
27766a487aSbellard#########################################################
28766a487aSbellard
290ecfa993SbellardDEFINES+=-D_GNU_SOURCE
30766a487aSbellardLDSCRIPT=$(ARCH).ld
31927f621eSbellardLIBS+=-ldl -lm
327d13299dSbellard
337d13299dSbellard# profiling code
347d13299dSbellardifdef TARGET_GPROF
357d13299dSbellardLDFLAGS+=-p
367d13299dSbellardCFLAGS+=-p
377d13299dSbellardendif
3831e31b8aSbellard
39586314f2SbellardOBJS= elfload.o main.o thunk.o syscall.o
407d13299dSbellardOBJS+=translate-i386.o op-i386.o exec-i386.o
410ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging
420ecfa993SbellardOBJS+=i386-dis.o dis-buf.o
4331e31b8aSbellardSRCS = $(OBJS:.o=.c)
4431e31b8aSbellard
4531e31b8aSbellardall: gemu
4631e31b8aSbellard
4731e31b8aSbellardgemu: $(OBJS)
48367e86e8Sbellard	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS)
4931e31b8aSbellard
5031e31b8aSbellarddepend: $(SRCS)
5131e31b8aSbellard	$(CC) -MM $(CFLAGS) $^ 1>.depend
5231e31b8aSbellard
53367e86e8Sbellard# new i386 emulator
54367e86e8Sbellarddyngen: dyngen.c
55367e86e8Sbellard	$(HOST_CC) -O2 -Wall -g $< -o $@
56367e86e8Sbellard
57367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h
58367e86e8Sbellard
59367e86e8Sbellardop-i386.h: op-i386.o dyngen
60367e86e8Sbellard	./dyngen -o $@ $<
61367e86e8Sbellard
62367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h
63927f621eSbellard	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
64367e86e8Sbellard
6531e31b8aSbellard%.o: %.c
6631e31b8aSbellard	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
6731e31b8aSbellard
6831e31b8aSbellardclean:
697d13299dSbellard	$(MAKE) -C tests clean
70586314f2Sbellard	rm -f *.o *~ gemu dyngen TAGS
7131e31b8aSbellard
727d13299dSbellarddistclean: clean
737d13299dSbellard	rm -f config.mak config.h
747d13299dSbellard
75367e86e8Sbellard# various test targets
76367e86e8Sbellardtest speed: gemu
77367e86e8Sbellard	make -C tests $@
7831e31b8aSbellard
79367e86e8SbellardTAGS:
80367e86e8Sbellard	etags *.[ch] i386/*.[ch]
8131e31b8aSbellard
82586314f2SbellardFILES= \
83586314f2SbellardCOPYING.LIB  dyngen.c    ioctls.h          ops_template.h  syscall_types.h\
84586314f2SbellardMakefile     elf.h       linux_bin.h       segment.h       thunk.c\
85586314f2SbellardTODO         elfload.c   main.c            signal.c        thunk.h\
86586314f2Sbellardcpu-i386.h   gemu.h      op-i386.c         syscall-i386.h  translate-i386.c\
87586314f2Sbellarddis-asm.h    gen-i386.h  op-i386.h         syscall.c\
88586314f2Sbellarddis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
897d13299dSbellardi386.ld ppc.ld exec-i386.h exec-i386.c configure VERSION \
9077f8dd5aSbellardtests/Makefile\
91586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
92d57c4e01Sbellardtests/test-i386-muldiv.h\
931017ebe9Sbellardtests/test2.c tests/hello.c tests/sha1.c
94586314f2Sbellard
95586314f2SbellardFILE=gemu-$(VERSION)
96586314f2Sbellard
97586314f2Sbellardtar:
98586314f2Sbellard	rm -rf /tmp/$(FILE)
99586314f2Sbellard	mkdir -p /tmp/$(FILE)
100586314f2Sbellard	cp -P $(FILES) /tmp/$(FILE)
101586314f2Sbellard	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
102586314f2Sbellard	rm -rf /tmp/$(FILE)
103586314f2Sbellard
10431e31b8aSbellardifneq ($(wildcard .depend),)
10531e31b8aSbellardinclude .depend
10631e31b8aSbellardendif
107