xref: /openbmc/qemu/Makefile (revision 927f621e)
1766a487aSbellardARCH=i386
2766a487aSbellard#ARCH=ppc
3367e86e8SbellardHOST_CC=gcc
4766a487aSbellard
5766a487aSbellardifeq ($(ARCH),i386)
6367e86e8SbellardCFLAGS=-Wall -O2 -g -fomit-frame-pointer
731e31b8aSbellardLDFLAGS=-g
8766a487aSbellardLIBS=
9766a487aSbellardCC=gcc
10766a487aSbellardDEFINES=-DHAVE_BYTESWAP_H
11*927f621eSbellardOP_CFLAGS=$(CFLAGS) -malign-functions=0 -mpreferred-stack-boundary=2
12766a487aSbellardendif
13766a487aSbellard
14766a487aSbellardifeq ($(ARCH),ppc)
15766a487aSbellardGCC_LIBS_DIR=/usr/netgem/tools/lib/gcc-lib/powerpc-linux/2.95.2
16766a487aSbellardDIST=/home/fbe/nsv/dist/hw/n6-dtt
17766a487aSbellardCC=powerpc-linux-gcc -msoft-float
18766a487aSbellardCFLAGS=-Wall -pipe -O2 -mcpu=405 -mbig -nostdinc -g -I$(GCC_LIBS_DIR)/include -I$(DIST)/include
19766a487aSbellardLIBS_DIR=$(DIST)/lib
20766a487aSbellardCRT1=$(LIBS_DIR)/crt1.o
21766a487aSbellardCRTI=$(LIBS_DIR)/crti.o
22766a487aSbellardCRTN=$(LIBS_DIR)/crtn.o
23766a487aSbellardCRTBEGIN=$(GCC_LIBS_DIR)/crtbegin.o
24766a487aSbellardCRTEND=$(GCC_LIBS_DIR)/crtend.o
25766a487aSbellardLDFLAGS=-static -g -nostdlib $(CRT1) $(CRTI) $(CRTBEGIN)
26766a487aSbellardLIBS=-L$(LIBS_DIR) -ltinyc -lgcc $(CRTEND) $(CRTN)
27766a487aSbellardDEFINES=-Dsocklen_t=int
28*927f621eSbellardOP_CFLAGS=$(CFLAGS)
29766a487aSbellardendif
30766a487aSbellard
31766a487aSbellard#########################################################
32766a487aSbellard
33367e86e8SbellardDEFINES+=-D_GNU_SOURCE -DGEMU -DDOSEMU -DNO_TRACE_MSGS
34367e86e8SbellardDEFINES+=-DCONFIG_PREFIX=\"/usr/local\"
35766a487aSbellardLDSCRIPT=$(ARCH).ld
36*927f621eSbellardLIBS+=-ldl -lm
3731e31b8aSbellard
3831e31b8aSbellardOBJS= i386/fp87.o i386/interp_main.o i386/interp_modrm.o i386/interp_16_32.o \
3931e31b8aSbellard      i386/interp_32_16.o i386/interp_32_32.o i386/emu-utils.o \
4031e31b8aSbellard      i386/dis8086.o i386/emu-ldt.o
41367e86e8SbellardOBJS+=translate-i386.o op-i386.o
4231e31b8aSbellardOBJS+= elfload.o main.o thunk.o syscall.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# old i386 emulator
54367e86e8Sbellardi386/interp_32_32.o: i386/interp_32_32.c i386/interp_gen.h
55367e86e8Sbellard
56367e86e8Sbellardi386/interp_gen.h: i386/gencode
57367e86e8Sbellard	./i386/gencode > $@
58367e86e8Sbellard
59367e86e8Sbellardi386/gencode: i386/gencode.c
60367e86e8Sbellard	$(CC) -O2 -Wall -g $< -o $@
61367e86e8Sbellard
62367e86e8Sbellard# new i386 emulator
63367e86e8Sbellarddyngen: dyngen.c
64367e86e8Sbellard	$(HOST_CC) -O2 -Wall -g $< -o $@
65367e86e8Sbellard
66367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h
67367e86e8Sbellard
68367e86e8Sbellardop-i386.h: op-i386.o dyngen
69367e86e8Sbellard	./dyngen -o $@ $<
70367e86e8Sbellard
71367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h
72*927f621eSbellard	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
73367e86e8Sbellard
7431e31b8aSbellard%.o: %.c
7531e31b8aSbellard	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
7631e31b8aSbellard
7731e31b8aSbellardclean:
78367e86e8Sbellard	rm -f *.o *~ i386/*.o i386/*~ gemu TAGS
7931e31b8aSbellard
80367e86e8Sbellard# various test targets
81367e86e8Sbellardtest speed: gemu
82367e86e8Sbellard	make -C tests $@
8331e31b8aSbellard
84367e86e8SbellardTAGS:
85367e86e8Sbellard	etags *.[ch] i386/*.[ch]
8631e31b8aSbellard
8731e31b8aSbellardifneq ($(wildcard .depend),)
8831e31b8aSbellardinclude .depend
8931e31b8aSbellardendif
90