631fc0e5c16c5bbc21176911347d121780e0a9c8
[cacao.git] / Makefile
1 ################################################################################
2 #                    Makefile for the JavaVM - compiler CACAO                  #
3 ################################################################################
4 #
5 # Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
6 #
7 # See file COPYRIGHT for information on usage and disclaimer of warranties
8 #
9 # Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
10 #          Andreas  Krall      EMAIL: cacao@complang.tuwien.ac.at
11 #
12 # Last Change: 1998/10/30
13 #
14 #
15 # ATTENTION: This version of the makefile only works with gmake.
16 #            This Makefile not only generates object files, but also additional
17 #            files needed during compilation:
18 #                nativetypes.hh
19 #                nativetables.hh
20 #            All object files and the *.hh can be deleted savely. They will be
21 #            generated automatically.
22 #
23 ################################################################################
24
25 VERSION_MAJOR = 0
26 VERSION_MINOR = 30
27 VERSION_POSTFIX = 
28
29 VERSION_STRING=$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POSTFIX)
30
31 ##################### generation of the excutable ##############################
32
33 # Enabling/disabling thread support
34 USE_THREADS = YES
35 #USE_THREADS = NO
36
37 ifeq ($(USE_THREADS),YES)
38 THREAD_OBJ = threads/threads.a
39 THREAD_CFLAGS = -DUSE_THREADS -DEXTERNAL_OVERFLOW -DDONT_FREE_FIRST
40 else
41 THREAD_OBJ =
42 THREAD_CFLAGS =
43 endif
44
45 #CC = cc
46 #CFLAGS = -g -mieee -Wall $(THREAD_CFLAGS)
47 #CFLAGS = -mieee -O3 -Wall $(THREAD_CFLAGS)
48 #LFLAGS = -lm
49
50 CC = cc
51 #CFLAGS = -g3 -ieee $(THREAD_CFLAGS)
52 CFLAGS = -O3 -ieee $(THREAD_CFLAGS)
53 LFLAGS = -lm
54
55 # IRIX 6.5 MIPSPro 7.2.1
56 #CC = cc
57 #CFLAGS = -g $(THREAD_CFLAGS) -DMAP_ANONYMOUS=0 -woff 1048,1110,1164,1515
58 #CFLAGS = -O2 -OPT:Olimit=0 $(THREAD_CFLAGS) -DMAP_ANONYMOUS=0
59 #LFLAGS = -lm -lelfutil
60
61 OBJ = main.o tables.o loader.o compiler.o newcomp.o builtin.o asmpart.o \
62         toolbox/toolbox.a native.o $(THREAD_OBJ) mm/mm.o
63 OBJH = headers.o tables.o loader.o builtin.o toolbox/toolbox.a $(THREAD_OBJ) \
64 mm/mm.o
65
66 cacao: $(OBJ)
67         $(CC) $(CFLAGS) -o cacao $(OBJ) $(LFLAGS)
68 cacaoh: $(OBJH)
69         $(CC) $(CFLAGS) -o cacaoh $(OBJH) $(LFLAGS)
70
71 main.o: main.c global.h tables.h compiler.h ncomp/ncomp.h loader.h \
72         asmpart.h builtin.h native.h
73
74 headers.o:  headers.c global.h tables.h loader.h
75
76 loader.o:   loader.c global.h loader.h tables.h native.h asmpart.h
77
78 compiler.o: builtin.h compiler.h global.h loader.h tables.h native.h \
79             asmpart.h compiler.c comp/*.c sysdep/gen.c sysdep/disass.c
80
81 newcomp.o:  builtin.h ncomp/ncomp.h global.h loader.h tables.h native.h \
82             asmpart.h ncomp/ncompdef.h ncomp/*.c sysdep/ngen.h sysdep/ngen.c sysdep/disass.c
83
84 builtin.o: builtin.c global.h loader.h builtin.h tables.h sysdep/native-math.h
85
86 native.o: native.c global.h tables.h native.h asmpart.h builtin.h \
87           nativetypes.hh nativetable.hh nat/*.c
88
89 tables.o: tables.c global.h tables.h
90
91 global.h: sysdep/types.h toolbox/*.h
92         touch global.h
93
94 toolbox/toolbox.a: toolbox/*.c toolbox/*.h
95         cd toolbox; $(MAKE) toolbox.a "CFLAGS=$(CFLAGS)" "CC=$(CC)" 
96
97 ifeq ($(USE_THREADS),YES)
98 threads/threads.a: threads/*.c threads/*.h sysdep/threads.h
99         cd threads; $(MAKE) threads.a "USE_THREADS=$(USE_THREADS)" "CFLAGS=$(CFLAGS)" "CC=$(CC)" 
100 endif
101
102 mm/mm.o: mm/*.[ch] mm/Makefile
103         cd mm; $(MAKE) mm.o "USE_THREADS=$(USE_THREADS)" "CFLAGS=$(CFLAGS)" "CC=$(CC)"
104
105 asmpart.o: sysdep/asmpart.c sysdep/offsets.h
106         rm -f asmpart.s
107         $(CC) -E sysdep/asmpart.c > asmpart.s
108         $(CC) -c -o asmpart.o asmpart.s
109         rm -f asmpart.s
110
111
112 ########################### support targets ####################################
113
114 clean:
115         rm -f *.o cacao cacaoh cacao.tgz nativetable.hh nativetypes.hh \
116               core tst/core
117         cd toolbox; $(MAKE) clean
118         cd threads; $(MAKE) clean
119         cd mm; $(MAKE) clean
120 tar:
121         rm -f cacao.tgz cacao.tar
122         tar -cvf cacao.tar Makefile */Makefile README COPYRIGHT tst/*.java \
123             doc/*.doc html/*.html *.[ch] comp/*.[ch] ncomp/*.[ch] alpha/*.doc alpha/*.[ch] \
124             nat/*.[ch] toolbox/*.[ch] threads/*.[ch] # sparc/*.[ch]
125         ls -l cacao.tar
126         gzip -9 cacao.tar
127         mv cacao.tar.gz cacao.tgz
128         ls -l cacao.tgz
129
130 dist:
131         rm -rf cacao-$(VERSION_STRING).tar.gz cacao-$(VERSION_STRING);
132         ( mkdir cacao-$(VERSION_STRING); \
133 #         tar -cf cacao-$(VERSION_STRING).tar -T FILES; \
134           tar -cvf cacao-$(VERSION_STRING).tar Makefile */Makefile README COPYRIGHT \
135             tst/*.java doc/*.doc html/*.html *.[ch] comp/*.[ch] ncomp/*.[ch] \
136             alpha/*.doc alpha/*.[ch] nat/*.[ch] toolbox/*.[ch] threads/*.[ch]; \
137           cd cacao-$(VERSION_STRING); \
138           tar -xf ../cacao-$(VERSION_STRING).tar; \
139           cd ..; \
140           rm cacao-$(VERSION_STRING).tar; \
141           tar -cvf cacao-$(VERSION_STRING).tar cacao-$(VERSION_STRING); \
142           rm -rf cacao-$(VERSION_STRING); )
143         gzip -9 cacao-$(VERSION_STRING).tar
144         ls -l cacao-$(VERSION_STRING).tar.gz
145
146 ########################## supported architectures #############################
147
148 config-alpha:
149         rm -f sysdep
150         ln -s alpha sysdep
151         rm -f threads/sysdep
152         ln -s ../sysdep threads/sysdep
153         $(MAKE) clean
154
155 config-sparc:
156         rm -f sysdep
157         ln -s sparc sysdep
158         rm -f threads/sysdep
159         ln -s ../sysdep threads/sysdep
160         $(MAKE) clean
161
162 config-mips:
163         rm -f sysdep
164         ln -s mips sysdep
165         rm -f threads/sysdep
166         ln -s ../sysdep threads/sysdep
167         $(MAKE) clean
168
169
170 ##################### generation of NATIVE - header files ######################
171
172 sysdep/offsets.h nativetypes.hh nativetable.hh : cacaoh
173         ./cacaoh java.lang.Object \
174        java.lang.String \
175        java.lang.Class \
176        java.lang.ClassLoader \
177        java.lang.Compiler \
178        java.lang.Double \
179        java.lang.Float \
180        java.lang.Math \
181        java.lang.Runtime \
182        java.lang.SecurityManager \
183        java.lang.System \
184        java.lang.Thread \
185        java.lang.ThreadGroup \
186        java.lang.Throwable \
187 \
188        java.io.File \
189        java.io.FileDescriptor \
190        java.io.FileInputStream \
191        java.io.FileOutputStream \
192        java.io.PrintStream \
193        java.io.RandomAccessFile \
194 \
195        java.util.Properties \
196        java.util.Date
197        
198