bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 1 | include config.mak |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 2 | |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 3 | CFLAGS=-Wall -O2 -g |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 4 | LDFLAGS=-g |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 5 | LIBS= |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 6 | DEFINES=-DHAVE_BYTESWAP_H |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 7 | |
| 8 | ifeq ($(ARCH),i386) |
| 9 | CFLAGS+=-fomit-frame-pointer |
bellard | ca73520 | 2003-03-18 20:41:34 +0000 | [diff] [blame] | 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 |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 16 | endif |
| 17 | |
| 18 | ifeq ($(ARCH),ppc) |
bellard | 927f621 | 2003-03-02 19:39:42 +0000 | [diff] [blame] | 19 | OP_CFLAGS=$(CFLAGS) |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 20 | endif |
| 21 | |
bellard | ca73520 | 2003-03-18 20:41:34 +0000 | [diff] [blame] | 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 | |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 27 | ######################################################### |
| 28 | |
bellard | 0ecfa99 | 2003-03-03 14:32:43 +0000 | [diff] [blame] | 29 | DEFINES+=-D_GNU_SOURCE |
bellard | 766a487 | 2003-02-18 23:35:48 +0000 | [diff] [blame] | 30 | LDSCRIPT=$(ARCH).ld |
bellard | 927f621 | 2003-03-02 19:39:42 +0000 | [diff] [blame] | 31 | LIBS+=-ldl -lm |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 32 | |
| 33 | # profiling code |
| 34 | ifdef TARGET_GPROF |
| 35 | LDFLAGS+=-p |
bellard | dc99065 | 2003-03-19 00:00:28 +0000 | [diff] [blame^] | 36 | main.o: CFLAGS+=-p |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 37 | endif |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 38 | |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 39 | OBJS= elfload.o main.o thunk.o syscall.o |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 40 | OBJS+=translate-i386.o op-i386.o exec-i386.o |
bellard | 0ecfa99 | 2003-03-03 14:32:43 +0000 | [diff] [blame] | 41 | # NOTE: the disassembler code is only needed for debugging |
| 42 | OBJS+=i386-dis.o dis-buf.o |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 43 | SRCS = $(OBJS:.o=.c) |
| 44 | |
| 45 | all: gemu |
| 46 | |
| 47 | gemu: $(OBJS) |
bellard | 367e86e | 2003-03-01 17:13:26 +0000 | [diff] [blame] | 48 | $(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS) |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 49 | |
| 50 | depend: $(SRCS) |
| 51 | $(CC) -MM $(CFLAGS) $^ 1>.depend |
| 52 | |
bellard | 367e86e | 2003-03-01 17:13:26 +0000 | [diff] [blame] | 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 |
bellard | 927f621 | 2003-03-02 19:39:42 +0000 | [diff] [blame] | 63 | $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< |
bellard | 367e86e | 2003-03-01 17:13:26 +0000 | [diff] [blame] | 64 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 65 | %.o: %.c |
| 66 | $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< |
| 67 | |
| 68 | clean: |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 69 | $(MAKE) -C tests clean |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 70 | rm -f *.o *~ gemu dyngen TAGS |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 71 | |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 72 | distclean: clean |
| 73 | rm -f config.mak config.h |
| 74 | |
bellard | 367e86e | 2003-03-01 17:13:26 +0000 | [diff] [blame] | 75 | # various test targets |
| 76 | test speed: gemu |
| 77 | make -C tests $@ |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 78 | |
bellard | 367e86e | 2003-03-01 17:13:26 +0000 | [diff] [blame] | 79 | TAGS: |
| 80 | etags *.[ch] i386/*.[ch] |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 81 | |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 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\ |
bellard | 7d13299 | 2003-03-06 23:23:54 +0000 | [diff] [blame] | 89 | i386.ld ppc.ld exec-i386.h exec-i386.c configure VERSION \ |
bellard | 77f8dd5 | 2003-03-05 22:24:48 +0000 | [diff] [blame] | 90 | tests/Makefile\ |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 91 | tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\ |
bellard | d57c4e0 | 2003-03-04 01:14:13 +0000 | [diff] [blame] | 92 | tests/test-i386-muldiv.h\ |
bellard | 1017ebe | 2003-03-05 23:26:16 +0000 | [diff] [blame] | 93 | tests/test2.c tests/hello.c tests/sha1.c |
bellard | 586314f | 2003-03-03 15:02:29 +0000 | [diff] [blame] | 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 | |
bellard | 31e31b8 | 2003-02-18 22:55:36 +0000 | [diff] [blame] | 104 | ifneq ($(wildcard .depend),) |
| 105 | include .depend |
| 106 | endif |