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