Initial revision
[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: 1997/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 ##################### generation of the excutable ##############################
26
27 # Enabling/disabling thread support
28 USE_THREADS = YES
29 #USE_THREADS = NO
30
31 ifeq ($(USE_THREADS),YES)
32 THREAD_OBJ = threads/threads.a
33 THREAD_CFLAGS = -DUSE_THREADS -DEXTERNAL_OVERFLOW -DDONT_FREE_FIRST
34 else
35 THREAD_OBJ =
36 THREAD_CFLAGS =
37 endif
38
39 CC = cc
40 #CFLAGS = -g -mieee -Wall $(THREAD_CFLAGS)
41 CFLAGS = -mieee -O3 -Wall $(THREAD_CFLAGS)
42
43 #CC = cc
44 #CFLAGS = -g3 -ieee $(THREAD_CFLAGS)
45 #CFLAGS = -O3 -ieee $(THREAD_CFLAGS)
46
47 OBJ = main.o tables.o loader.o compiler.o newcomp.o builtin.o asmpart.o \
48     toolbox/toolbox.a native.o $(THREAD_OBJ)
49 OBJH = headers.o tables.o loader.o builtin.o toolbox/toolbox.a $(THREAD_OBJ)
50
51 cacao: $(OBJ)
52         $(CC) $(CFLAGS) -o cacao $(OBJ) -lm
53 cacaoh: $(OBJH)
54         $(CC) $(CFLAGS) -o cacaoh $(OBJH) -lm
55
56 main.o: main.c global.h tables.h compiler.h ncomp/ncomp.h loader.h \
57         asmpart.h builtin.h native.h
58
59 headers.o:  headers.c global.h tables.h loader.h
60
61 loader.o:   loader.c global.h loader.h tables.h native.h asmpart.h
62
63 compiler.o: builtin.h compiler.h global.h loader.h tables.h native.h \
64             asmpart.h compiler.c comp/*.c sysdep/gen.c sysdep/disass.c
65
66 newcomp.o:  builtin.h ncomp/ncomp.h global.h loader.h tables.h native.h \
67             asmpart.h ncomp/ncompdef.h ncomp/*.c sysdep/ngen.h sysdep/ngen.c sysdep/disass.c
68
69 builtin.o: builtin.c global.h loader.h builtin.h tables.h sysdep/native-math.h
70
71 native.o: native.c global.h tables.h native.h asmpart.h builtin.h \
72           nativetypes.hh nativetable.hh nat/*.c
73
74 tables.o: tables.c global.h tables.h
75
76 global.h: sysdep/types.h toolbox/*.h
77         touch global.h
78
79 toolbox/toolbox.a: toolbox/*.c toolbox/*.h
80         cd toolbox; make toolbox.a "CFLAGS=$(CFLAGS)" "CC=$(CC)" 
81
82 ifeq ($(USE_THREADS),YES)
83 threads/threads.a: threads/*.c threads/*.h sysdep/threads.h
84         cd threads; make threads.a "USE_THREADS=$(USE_THREADS)" "CFLAGS=$(CFLAGS)" "CC=$(CC)" 
85 endif
86
87 asmpart.o: sysdep/asmpart.c
88         rm -f asmpart.s
89         $(CC) -E sysdep/asmpart.c > asmpart.s
90         $(CC) -c -o asmpart.o asmpart.s
91         rm -f asmpart.s
92
93
94 ########################### support targets ####################################
95
96 clean:
97         rm -f *.o cacao cacaoh cacao.tgz nativetable.hh nativetypes.hh \
98               core tst/core
99         cd toolbox; make clean
100         cd threads; make clean
101
102 tar:
103         rm -f cacao.tgz cacao.tar
104         tar -cvf cacao.tar Makefile */Makefile README COPYRIGHT tst/*.java \
105             doc/*.doc html/*.html *.[ch] comp/*.[ch] ncomp/*.[ch] alpha/*.doc alpha/*.[ch] \
106             nat/*.[ch] toolbox/*.[ch] threads/*.[ch] # sparc/*.[ch]
107         ls -l cacao.tar
108         gzip -9 cacao.tar
109         mv cacao.tar.gz cacao.tgz
110         ls -l cacao.tgz
111
112
113 ########################## supported architectures #############################
114
115 config-alpha:
116         rm -f sysdep
117         ln -s alpha sysdep
118         rm -f threads/sysdep
119         ln -s ../sysdep threads/sysdep
120         make clean
121
122 config-sparc:
123         rm -f sysdep
124         ln -s sparc sysdep
125         rm -f threads/sysdep
126         ln -s ../sysdep threads/sysdep
127         make clean
128
129
130
131 ##################### generation of NATIVE - header files ######################
132
133 nativetypes.hh nativetable.hh : cacaoh
134         ./cacaoh java.lang.Object \
135        java.lang.String \
136        java.lang.Class \
137        java.lang.ClassLoader \
138        java.lang.Compiler \
139        java.lang.Double \
140        java.lang.Float \
141        java.lang.Math \
142        java.lang.Runtime \
143        java.lang.SecurityManager \
144        java.lang.System \
145        java.lang.Thread \
146        java.lang.ThreadGroup \
147        java.lang.Throwable \
148 \
149        java.io.File \
150        java.io.FileDescriptor \
151        java.io.FileInputStream \
152        java.io.FileOutputStream \
153        java.io.PrintStream \
154        java.io.RandomAccessFile \
155 \
156        java.util.Properties \
157        java.util.Date
158        
159