Statistics
| Branch: | Revision:

root / Makefile @ b03c60f3

History | View | Annotate | Download (2.5 kB)

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