xref: /openbmc/qemu/Makefile (revision 7d13299d)
1*7d13299dSbellardinclude config.mak
2766a487aSbellard
3*7d13299dSbellardCFLAGS=-Wall -O2 -g
431e31b8aSbellardLDFLAGS=-g
5766a487aSbellardLIBS=
6766a487aSbellardDEFINES=-DHAVE_BYTESWAP_H
7*7d13299dSbellard
8*7d13299dSbellardifeq ($(ARCH),i386)
9*7d13299dSbellardCFLAGS+=-fomit-frame-pointer
10927f621eSbellardOP_CFLAGS=$(CFLAGS) -malign-functions=0 -mpreferred-stack-boundary=2
11766a487aSbellardendif
12766a487aSbellard
13766a487aSbellardifeq ($(ARCH),ppc)
14927f621eSbellardOP_CFLAGS=$(CFLAGS)
15766a487aSbellardendif
16766a487aSbellard
17766a487aSbellard#########################################################
18766a487aSbellard
190ecfa993SbellardDEFINES+=-D_GNU_SOURCE
20766a487aSbellardLDSCRIPT=$(ARCH).ld
21927f621eSbellardLIBS+=-ldl -lm
22*7d13299dSbellard
23*7d13299dSbellard# profiling code
24*7d13299dSbellardifdef TARGET_GPROF
25*7d13299dSbellardLDFLAGS+=-p
26*7d13299dSbellardCFLAGS+=-p
27*7d13299dSbellardendif
2831e31b8aSbellard
29586314f2SbellardOBJS= elfload.o main.o thunk.o syscall.o
30*7d13299dSbellardOBJS+=translate-i386.o op-i386.o exec-i386.o
310ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging
320ecfa993SbellardOBJS+=i386-dis.o dis-buf.o
3331e31b8aSbellardSRCS = $(OBJS:.o=.c)
3431e31b8aSbellard
3531e31b8aSbellardall: gemu
3631e31b8aSbellard
3731e31b8aSbellardgemu: $(OBJS)
38367e86e8Sbellard	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS)
3931e31b8aSbellard
4031e31b8aSbellarddepend: $(SRCS)
4131e31b8aSbellard	$(CC) -MM $(CFLAGS) $^ 1>.depend
4231e31b8aSbellard
43367e86e8Sbellard# new i386 emulator
44367e86e8Sbellarddyngen: dyngen.c
45367e86e8Sbellard	$(HOST_CC) -O2 -Wall -g $< -o $@
46367e86e8Sbellard
47367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h
48367e86e8Sbellard
49367e86e8Sbellardop-i386.h: op-i386.o dyngen
50367e86e8Sbellard	./dyngen -o $@ $<
51367e86e8Sbellard
52367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h
53927f621eSbellard	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
54367e86e8Sbellard
5531e31b8aSbellard%.o: %.c
5631e31b8aSbellard	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
5731e31b8aSbellard
5831e31b8aSbellardclean:
59*7d13299dSbellard	$(MAKE) -C tests clean
60586314f2Sbellard	rm -f *.o *~ gemu dyngen TAGS
6131e31b8aSbellard
62*7d13299dSbellarddistclean: clean
63*7d13299dSbellard	rm -f config.mak config.h
64*7d13299dSbellard
65367e86e8Sbellard# various test targets
66367e86e8Sbellardtest speed: gemu
67367e86e8Sbellard	make -C tests $@
6831e31b8aSbellard
69367e86e8SbellardTAGS:
70367e86e8Sbellard	etags *.[ch] i386/*.[ch]
7131e31b8aSbellard
72586314f2SbellardFILES= \
73586314f2SbellardCOPYING.LIB  dyngen.c    ioctls.h          ops_template.h  syscall_types.h\
74586314f2SbellardMakefile     elf.h       linux_bin.h       segment.h       thunk.c\
75586314f2SbellardTODO         elfload.c   main.c            signal.c        thunk.h\
76586314f2Sbellardcpu-i386.h   gemu.h      op-i386.c         syscall-i386.h  translate-i386.c\
77586314f2Sbellarddis-asm.h    gen-i386.h  op-i386.h         syscall.c\
78586314f2Sbellarddis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
79*7d13299dSbellardi386.ld ppc.ld exec-i386.h exec-i386.c configure VERSION \
8077f8dd5aSbellardtests/Makefile\
81586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
82d57c4e01Sbellardtests/test-i386-muldiv.h\
831017ebe9Sbellardtests/test2.c tests/hello.c tests/sha1.c
84586314f2Sbellard
85586314f2SbellardFILE=gemu-$(VERSION)
86586314f2Sbellard
87586314f2Sbellardtar:
88586314f2Sbellard	rm -rf /tmp/$(FILE)
89586314f2Sbellard	mkdir -p /tmp/$(FILE)
90586314f2Sbellard	cp -P $(FILES) /tmp/$(FILE)
91586314f2Sbellard	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
92586314f2Sbellard	rm -rf /tmp/$(FILE)
93586314f2Sbellard
9431e31b8aSbellardifneq ($(wildcard .depend),)
9531e31b8aSbellardinclude .depend
9631e31b8aSbellardendif
97