]>
Commit | Line | Data |
---|---|---|
7d13299d | 1 | include config.mak |
766a487a | 2 | |
7d13299d | 3 | CFLAGS=-Wall -O2 -g |
31e31b8a | 4 | LDFLAGS=-g |
766a487a | 5 | LIBS= |
766a487a | 6 | DEFINES=-DHAVE_BYTESWAP_H |
7d13299d FB |
7 | |
8 | ifeq ($(ARCH),i386) | |
9 | CFLAGS+=-fomit-frame-pointer | |
ca735206 FB |
10 | OP_CFLAGS=$(CFLAGS) -mpreferred-stack-boundary=2 |
11 | ifeq ($(GCC_MAJOR),3) | |
12 | OP_CFLAGS+= -falign-functions=0 | |
13 | else | |
14 | OP_CFLAGS+= -malign-functions=0 | |
15 | endif | |
766a487a FB |
16 | endif |
17 | ||
18 | ifeq ($(ARCH),ppc) | |
927f621e | 19 | OP_CFLAGS=$(CFLAGS) |
766a487a FB |
20 | endif |
21 | ||
ca735206 FB |
22 | ifeq ($(GCC_MAJOR),3) |
23 | # very important to generate a return at the end of every operation | |
24 | OP_CFLAGS+=-fno-reorder-blocks -fno-optimize-sibling-calls | |
25 | endif | |
26 | ||
766a487a FB |
27 | ######################################################### |
28 | ||
0ecfa993 | 29 | DEFINES+=-D_GNU_SOURCE |
766a487a | 30 | LDSCRIPT=$(ARCH).ld |
927f621e | 31 | LIBS+=-ldl -lm |
7d13299d FB |
32 | |
33 | # profiling code | |
34 | ifdef TARGET_GPROF | |
35 | LDFLAGS+=-p | |
36 | CFLAGS+=-p | |
37 | endif | |
31e31b8a | 38 | |
586314f2 | 39 | OBJS= elfload.o main.o thunk.o syscall.o |
7d13299d | 40 | OBJS+=translate-i386.o op-i386.o exec-i386.o |
0ecfa993 FB |
41 | # NOTE: the disassembler code is only needed for debugging |
42 | OBJS+=i386-dis.o dis-buf.o | |
31e31b8a FB |
43 | SRCS = $(OBJS:.o=.c) |
44 | ||
45 | all: gemu | |
46 | ||
47 | gemu: $(OBJS) | |
367e86e8 | 48 | $(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS) |
31e31b8a FB |
49 | |
50 | depend: $(SRCS) | |
51 | $(CC) -MM $(CFLAGS) $^ 1>.depend | |
52 | ||
367e86e8 FB |
53 | # new i386 emulator |
54 | dyngen: dyngen.c | |
55 | $(HOST_CC) -O2 -Wall -g $< -o $@ | |
56 | ||
57 | translate-i386.o: translate-i386.c op-i386.h cpu-i386.h | |
58 | ||
59 | op-i386.h: op-i386.o dyngen | |
60 | ./dyngen -o $@ $< | |
61 | ||
62 | op-i386.o: op-i386.c opreg_template.h ops_template.h | |
927f621e | 63 | $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< |
367e86e8 | 64 | |
31e31b8a FB |
65 | %.o: %.c |
66 | $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< | |
67 | ||
68 | clean: | |
7d13299d | 69 | $(MAKE) -C tests clean |
586314f2 | 70 | rm -f *.o *~ gemu dyngen TAGS |
31e31b8a | 71 | |
7d13299d FB |
72 | distclean: clean |
73 | rm -f config.mak config.h | |
74 | ||
367e86e8 FB |
75 | # various test targets |
76 | test speed: gemu | |
77 | make -C tests $@ | |
31e31b8a | 78 | |
367e86e8 FB |
79 | TAGS: |
80 | etags *.[ch] i386/*.[ch] | |
31e31b8a | 81 | |
586314f2 FB |
82 | FILES= \ |
83 | COPYING.LIB dyngen.c ioctls.h ops_template.h syscall_types.h\ | |
84 | Makefile elf.h linux_bin.h segment.h thunk.c\ | |
85 | TODO elfload.c main.c signal.c thunk.h\ | |
86 | cpu-i386.h gemu.h op-i386.c syscall-i386.h translate-i386.c\ | |
87 | dis-asm.h gen-i386.h op-i386.h syscall.c\ | |
88 | dis-buf.c i386-dis.c opreg_template.h syscall_defs.h\ | |
7d13299d | 89 | i386.ld ppc.ld exec-i386.h exec-i386.c configure VERSION \ |
77f8dd5a | 90 | tests/Makefile\ |
586314f2 | 91 | tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\ |
d57c4e01 | 92 | tests/test-i386-muldiv.h\ |
1017ebe9 | 93 | tests/test2.c tests/hello.c tests/sha1.c |
586314f2 FB |
94 | |
95 | FILE=gemu-$(VERSION) | |
96 | ||
97 | tar: | |
98 | rm -rf /tmp/$(FILE) | |
99 | mkdir -p /tmp/$(FILE) | |
100 | cp -P $(FILES) /tmp/$(FILE) | |
101 | ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) ) | |
102 | rm -rf /tmp/$(FILE) | |
103 | ||
31e31b8a FB |
104 | ifneq ($(wildcard .depend),) |
105 | include .depend | |
106 | endif |