blob: 0f0b22db72d29e3304828264c012158260291d48 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001include config.mak
bellard766a4872003-02-18 23:35:48 +00002
bellard7d132992003-03-06 23:23:54 +00003CFLAGS=-Wall -O2 -g
bellard31e31b82003-02-18 22:55:36 +00004LDFLAGS=-g
bellard766a4872003-02-18 23:35:48 +00005LIBS=
bellard766a4872003-02-18 23:35:48 +00006DEFINES=-DHAVE_BYTESWAP_H
bellard7d132992003-03-06 23:23:54 +00007
8ifeq ($(ARCH),i386)
9CFLAGS+=-fomit-frame-pointer
bellard927f6212003-03-02 19:39:42 +000010OP_CFLAGS=$(CFLAGS) -malign-functions=0 -mpreferred-stack-boundary=2
bellard766a4872003-02-18 23:35:48 +000011endif
12
13ifeq ($(ARCH),ppc)
bellard927f6212003-03-02 19:39:42 +000014OP_CFLAGS=$(CFLAGS)
bellard766a4872003-02-18 23:35:48 +000015endif
16
17#########################################################
18
bellard0ecfa992003-03-03 14:32:43 +000019DEFINES+=-D_GNU_SOURCE
bellard766a4872003-02-18 23:35:48 +000020LDSCRIPT=$(ARCH).ld
bellard927f6212003-03-02 19:39:42 +000021LIBS+=-ldl -lm
bellard7d132992003-03-06 23:23:54 +000022
23# profiling code
24ifdef TARGET_GPROF
25LDFLAGS+=-p
26CFLAGS+=-p
27endif
bellard31e31b82003-02-18 22:55:36 +000028
bellard586314f2003-03-03 15:02:29 +000029OBJS= elfload.o main.o thunk.o syscall.o
bellard7d132992003-03-06 23:23:54 +000030OBJS+=translate-i386.o op-i386.o exec-i386.o
bellard0ecfa992003-03-03 14:32:43 +000031# NOTE: the disassembler code is only needed for debugging
32OBJS+=i386-dis.o dis-buf.o
bellard31e31b82003-02-18 22:55:36 +000033SRCS = $(OBJS:.o=.c)
34
35all: gemu
36
37gemu: $(OBJS)
bellard367e86e2003-03-01 17:13:26 +000038 $(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS)
bellard31e31b82003-02-18 22:55:36 +000039
40depend: $(SRCS)
41 $(CC) -MM $(CFLAGS) $^ 1>.depend
42
bellard367e86e2003-03-01 17:13:26 +000043# new i386 emulator
44dyngen: dyngen.c
45 $(HOST_CC) -O2 -Wall -g $< -o $@
46
47translate-i386.o: translate-i386.c op-i386.h cpu-i386.h
48
49op-i386.h: op-i386.o dyngen
50 ./dyngen -o $@ $<
51
52op-i386.o: op-i386.c opreg_template.h ops_template.h
bellard927f6212003-03-02 19:39:42 +000053 $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
bellard367e86e2003-03-01 17:13:26 +000054
bellard31e31b82003-02-18 22:55:36 +000055%.o: %.c
56 $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
57
58clean:
bellard7d132992003-03-06 23:23:54 +000059 $(MAKE) -C tests clean
bellard586314f2003-03-03 15:02:29 +000060 rm -f *.o *~ gemu dyngen TAGS
bellard31e31b82003-02-18 22:55:36 +000061
bellard7d132992003-03-06 23:23:54 +000062distclean: clean
63 rm -f config.mak config.h
64
bellard367e86e2003-03-01 17:13:26 +000065# various test targets
66test speed: gemu
67 make -C tests $@
bellard31e31b82003-02-18 22:55:36 +000068
bellard367e86e2003-03-01 17:13:26 +000069TAGS:
70 etags *.[ch] i386/*.[ch]
bellard31e31b82003-02-18 22:55:36 +000071
bellard586314f2003-03-03 15:02:29 +000072FILES= \
73COPYING.LIB dyngen.c ioctls.h ops_template.h syscall_types.h\
74Makefile elf.h linux_bin.h segment.h thunk.c\
75TODO elfload.c main.c signal.c thunk.h\
76cpu-i386.h gemu.h op-i386.c syscall-i386.h translate-i386.c\
77dis-asm.h gen-i386.h op-i386.h syscall.c\
78dis-buf.c i386-dis.c opreg_template.h syscall_defs.h\
bellard7d132992003-03-06 23:23:54 +000079i386.ld ppc.ld exec-i386.h exec-i386.c configure VERSION \
bellard77f8dd52003-03-05 22:24:48 +000080tests/Makefile\
bellard586314f2003-03-03 15:02:29 +000081tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
bellardd57c4e02003-03-04 01:14:13 +000082tests/test-i386-muldiv.h\
bellard1017ebe2003-03-05 23:26:16 +000083tests/test2.c tests/hello.c tests/sha1.c
bellard586314f2003-03-03 15:02:29 +000084
85FILE=gemu-$(VERSION)
86
87tar:
88 rm -rf /tmp/$(FILE)
89 mkdir -p /tmp/$(FILE)
90 cp -P $(FILES) /tmp/$(FILE)
91 ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
92 rm -rf /tmp/$(FILE)
93
bellard31e31b82003-02-18 22:55:36 +000094ifneq ($(wildcard .depend),)
95include .depend
96endif