Statistics
| Branch: | Revision:

root / Makefile @ d57c4e01

History | View | Annotate | Download (2.5 kB)

1
ARCH=i386
2
#ARCH=ppc
3
HOST_CC=gcc
4

    
5
ifeq ($(ARCH),i386)
6
CFLAGS=-Wall -O2 -g -fomit-frame-pointer
7
LDFLAGS=-g
8
LIBS=
9
CC=gcc
10
DEFINES=-DHAVE_BYTESWAP_H
11
OP_CFLAGS=$(CFLAGS) -malign-functions=0 -mpreferred-stack-boundary=2
12
endif
13

    
14
ifeq ($(ARCH),ppc)
15
GCC_LIBS_DIR=/usr/netgem/tools/lib/gcc-lib/powerpc-linux/2.95.2
16
DIST=/home/fbe/nsv/dist/hw/n6-dtt
17
CC=powerpc-linux-gcc -msoft-float 
18
CFLAGS=-Wall -pipe -O2 -mcpu=405 -mbig -nostdinc -g -I$(GCC_LIBS_DIR)/include -I$(DIST)/include
19
LIBS_DIR=$(DIST)/lib
20
CRT1=$(LIBS_DIR)/crt1.o
21
CRTI=$(LIBS_DIR)/crti.o
22
CRTN=$(LIBS_DIR)/crtn.o
23
CRTBEGIN=$(GCC_LIBS_DIR)/crtbegin.o
24
CRTEND=$(GCC_LIBS_DIR)/crtend.o
25
LDFLAGS=-static -g -nostdlib $(CRT1) $(CRTI) $(CRTBEGIN) 
26
LIBS=-L$(LIBS_DIR) -ltinyc -lgcc $(CRTEND) $(CRTN)
27
DEFINES=-Dsocklen_t=int
28
OP_CFLAGS=$(CFLAGS)
29
endif
30

    
31
#########################################################
32

    
33
DEFINES+=-D_GNU_SOURCE
34
DEFINES+=-DCONFIG_PREFIX=\"/usr/local\"
35
LDSCRIPT=$(ARCH).ld
36
LIBS+=-ldl -lm
37
VERSION=0.1
38

    
39
OBJS= elfload.o main.o thunk.o syscall.o
40
OBJS+=translate-i386.o op-i386.o
41
# NOTE: the disassembler code is only needed for debugging
42
OBJS+=i386-dis.o dis-buf.o
43
SRCS = $(OBJS:.o=.c)
44

    
45
all: gemu
46

    
47
gemu: $(OBJS)
48
	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS)
49

    
50
depend: $(SRCS)
51
	$(CC) -MM $(CFLAGS) $^ 1>.depend
52

    
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
63
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
64

    
65
%.o: %.c
66
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
67

    
68
clean:
69
	rm -f *.o *~ gemu dyngen TAGS
70

    
71
# various test targets
72
test speed: gemu
73
	make -C tests $@
74

    
75
TAGS: 
76
	etags *.[ch] i386/*.[ch]
77

    
78
FILES= \
79
COPYING.LIB  dyngen.c    ioctls.h          ops_template.h  syscall_types.h\
80
Makefile     elf.h       linux_bin.h       segment.h       thunk.c\
81
TODO         elfload.c   main.c            signal.c        thunk.h\
82
cpu-i386.h   gemu.h      op-i386.c         syscall-i386.h  translate-i386.c\
83
dis-asm.h    gen-i386.h  op-i386.h         syscall.c\
84
dis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
85
i386.ld ppc.ld\
86
tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
87
tests/test-i386-muldiv.h\
88
tests/test2.c tests/hello.c tests/sha1.c tests/test1.c
89

    
90
FILE=gemu-$(VERSION)
91

    
92
tar:
93
	rm -rf /tmp/$(FILE)
94
	mkdir -p /tmp/$(FILE)
95
	cp -P $(FILES) /tmp/$(FILE)
96
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
97
	rm -rf /tmp/$(FILE)
98

    
99
ifneq ($(wildcard .depend),)
100
include .depend
101
endif