xref: /openbmc/qemu/Makefile (revision 367e86e8)
1ARCH=i386
2#ARCH=ppc
3HOST_CC=gcc
4
5ifeq ($(ARCH),i386)
6CFLAGS=-Wall -O2 -g -fomit-frame-pointer
7LDFLAGS=-g
8LIBS=
9CC=gcc
10DEFINES=-DHAVE_BYTESWAP_H
11endif
12
13ifeq ($(ARCH),ppc)
14GCC_LIBS_DIR=/usr/netgem/tools/lib/gcc-lib/powerpc-linux/2.95.2
15DIST=/home/fbe/nsv/dist/hw/n6-dtt
16CC=powerpc-linux-gcc -msoft-float
17CFLAGS=-Wall -pipe -O2 -mcpu=405 -mbig -nostdinc -g -I$(GCC_LIBS_DIR)/include -I$(DIST)/include
18LIBS_DIR=$(DIST)/lib
19CRT1=$(LIBS_DIR)/crt1.o
20CRTI=$(LIBS_DIR)/crti.o
21CRTN=$(LIBS_DIR)/crtn.o
22CRTBEGIN=$(GCC_LIBS_DIR)/crtbegin.o
23CRTEND=$(GCC_LIBS_DIR)/crtend.o
24LDFLAGS=-static -g -nostdlib $(CRT1) $(CRTI) $(CRTBEGIN)
25LIBS=-L$(LIBS_DIR) -ltinyc -lgcc $(CRTEND) $(CRTN)
26DEFINES=-Dsocklen_t=int
27endif
28
29#########################################################
30
31DEFINES+=-D_GNU_SOURCE -DGEMU -DDOSEMU -DNO_TRACE_MSGS
32DEFINES+=-DCONFIG_PREFIX=\"/usr/local\"
33LDSCRIPT=$(ARCH).ld
34LIBS+=-ldl
35
36OBJS= i386/fp87.o i386/interp_main.o i386/interp_modrm.o i386/interp_16_32.o \
37      i386/interp_32_16.o i386/interp_32_32.o i386/emu-utils.o \
38      i386/dis8086.o i386/emu-ldt.o
39OBJS+=translate-i386.o op-i386.o
40OBJS+= elfload.o main.o thunk.o syscall.o
41SRCS = $(OBJS:.o=.c)
42
43all: gemu
44
45gemu: $(OBJS)
46	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS)
47
48depend: $(SRCS)
49	$(CC) -MM $(CFLAGS) $^ 1>.depend
50
51# old i386 emulator
52i386/interp_32_32.o: i386/interp_32_32.c i386/interp_gen.h
53
54i386/interp_gen.h: i386/gencode
55	./i386/gencode > $@
56
57i386/gencode: i386/gencode.c
58	$(CC) -O2 -Wall -g $< -o $@
59
60# new i386 emulator
61dyngen: dyngen.c
62	$(HOST_CC) -O2 -Wall -g $< -o $@
63
64translate-i386.o: translate-i386.c op-i386.h cpu-i386.h
65
66op-i386.h: op-i386.o dyngen
67	./dyngen -o $@ $<
68
69op-i386.o: op-i386.c opreg_template.h ops_template.h
70	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
71
72%.o: %.c
73	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
74
75clean:
76	rm -f *.o *~ i386/*.o i386/*~ gemu TAGS
77
78# various test targets
79test speed: gemu
80	make -C tests $@
81
82TAGS:
83	etags *.[ch] i386/*.[ch]
84
85ifneq ($(wildcard .depend),)
86include .depend
87endif
88