Statistics
| Branch: | Revision:

root / Makefile @ 586314f2

History | View | Annotate | Download (2.4 kB)

1 766a487a bellard
ARCH=i386
2 766a487a bellard
#ARCH=ppc
3 367e86e8 bellard
HOST_CC=gcc
4 766a487a bellard
5 766a487a bellard
ifeq ($(ARCH),i386)
6 367e86e8 bellard
CFLAGS=-Wall -O2 -g -fomit-frame-pointer
7 31e31b8a bellard
LDFLAGS=-g
8 766a487a bellard
LIBS=
9 766a487a bellard
CC=gcc
10 766a487a bellard
DEFINES=-DHAVE_BYTESWAP_H
11 927f621e bellard
OP_CFLAGS=$(CFLAGS) -malign-functions=0 -mpreferred-stack-boundary=2
12 766a487a bellard
endif
13 766a487a bellard
14 766a487a bellard
ifeq ($(ARCH),ppc)
15 766a487a bellard
GCC_LIBS_DIR=/usr/netgem/tools/lib/gcc-lib/powerpc-linux/2.95.2
16 766a487a bellard
DIST=/home/fbe/nsv/dist/hw/n6-dtt
17 766a487a bellard
CC=powerpc-linux-gcc -msoft-float 
18 766a487a bellard
CFLAGS=-Wall -pipe -O2 -mcpu=405 -mbig -nostdinc -g -I$(GCC_LIBS_DIR)/include -I$(DIST)/include
19 766a487a bellard
LIBS_DIR=$(DIST)/lib
20 766a487a bellard
CRT1=$(LIBS_DIR)/crt1.o
21 766a487a bellard
CRTI=$(LIBS_DIR)/crti.o
22 766a487a bellard
CRTN=$(LIBS_DIR)/crtn.o
23 766a487a bellard
CRTBEGIN=$(GCC_LIBS_DIR)/crtbegin.o
24 766a487a bellard
CRTEND=$(GCC_LIBS_DIR)/crtend.o
25 766a487a bellard
LDFLAGS=-static -g -nostdlib $(CRT1) $(CRTI) $(CRTBEGIN) 
26 766a487a bellard
LIBS=-L$(LIBS_DIR) -ltinyc -lgcc $(CRTEND) $(CRTN)
27 766a487a bellard
DEFINES=-Dsocklen_t=int
28 927f621e bellard
OP_CFLAGS=$(CFLAGS)
29 766a487a bellard
endif
30 766a487a bellard
31 766a487a bellard
#########################################################
32 766a487a bellard
33 0ecfa993 bellard
DEFINES+=-D_GNU_SOURCE
34 367e86e8 bellard
DEFINES+=-DCONFIG_PREFIX=\"/usr/local\"
35 766a487a bellard
LDSCRIPT=$(ARCH).ld
36 927f621e bellard
LIBS+=-ldl -lm
37 586314f2 bellard
VERSION=0.1
38 31e31b8a bellard
39 586314f2 bellard
OBJS= elfload.o main.o thunk.o syscall.o
40 367e86e8 bellard
OBJS+=translate-i386.o op-i386.o
41 0ecfa993 bellard
# NOTE: the disassembler code is only needed for debugging
42 0ecfa993 bellard
OBJS+=i386-dis.o dis-buf.o
43 31e31b8a bellard
SRCS = $(OBJS:.o=.c)
44 31e31b8a bellard
45 31e31b8a bellard
all: gemu
46 31e31b8a bellard
47 31e31b8a bellard
gemu: $(OBJS)
48 367e86e8 bellard
	$(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS)
49 31e31b8a bellard
50 31e31b8a bellard
depend: $(SRCS)
51 31e31b8a bellard
	$(CC) -MM $(CFLAGS) $^ 1>.depend
52 31e31b8a bellard
53 367e86e8 bellard
# new i386 emulator
54 367e86e8 bellard
dyngen: dyngen.c
55 367e86e8 bellard
	$(HOST_CC) -O2 -Wall -g $< -o $@
56 367e86e8 bellard
57 367e86e8 bellard
translate-i386.o: translate-i386.c op-i386.h cpu-i386.h
58 367e86e8 bellard
59 367e86e8 bellard
op-i386.h: op-i386.o dyngen
60 367e86e8 bellard
	./dyngen -o $@ $<
61 367e86e8 bellard
62 367e86e8 bellard
op-i386.o: op-i386.c opreg_template.h ops_template.h
63 927f621e bellard
	$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
64 367e86e8 bellard
65 31e31b8a bellard
%.o: %.c
66 31e31b8a bellard
	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
67 31e31b8a bellard
68 31e31b8a bellard
clean:
69 586314f2 bellard
	rm -f *.o *~ gemu dyngen TAGS
70 31e31b8a bellard
71 367e86e8 bellard
# various test targets
72 367e86e8 bellard
test speed: gemu
73 367e86e8 bellard
	make -C tests $@
74 31e31b8a bellard
75 367e86e8 bellard
TAGS: 
76 367e86e8 bellard
	etags *.[ch] i386/*.[ch]
77 31e31b8a bellard
78 586314f2 bellard
FILES= \
79 586314f2 bellard
COPYING.LIB  dyngen.c    ioctls.h          ops_template.h  syscall_types.h\
80 586314f2 bellard
Makefile     elf.h       linux_bin.h       segment.h       thunk.c\
81 586314f2 bellard
TODO         elfload.c   main.c            signal.c        thunk.h\
82 586314f2 bellard
cpu-i386.h   gemu.h      op-i386.c         syscall-i386.h  translate-i386.c\
83 586314f2 bellard
dis-asm.h    gen-i386.h  op-i386.h         syscall.c\
84 586314f2 bellard
dis-buf.c    i386-dis.c  opreg_template.h  syscall_defs.h\
85 586314f2 bellard
i386.ld ppc.ld\
86 586314f2 bellard
tests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\
87 586314f2 bellard
tests/test2.c tests/hello.c tests/sha1.c tests/test1.c
88 586314f2 bellard
89 586314f2 bellard
FILE=gemu-$(VERSION)
90 586314f2 bellard
91 586314f2 bellard
tar:
92 586314f2 bellard
	rm -rf /tmp/$(FILE)
93 586314f2 bellard
	mkdir -p /tmp/$(FILE)
94 586314f2 bellard
	cp -P $(FILES) /tmp/$(FILE)
95 586314f2 bellard
	( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) )
96 586314f2 bellard
	rm -rf /tmp/$(FILE)
97 586314f2 bellard
98 31e31b8a bellard
ifneq ($(wildcard .depend),)
99 31e31b8a bellard
include .depend
100 31e31b8a bellard
endif