Removed some statics generating warnings.
[libfirm] / firmjni / build_firm_jni.in
1 #!/bin/sh
2
3 # Project:     FIRM
4 # File name:   script/build_firm_jni
5 # Purpose:     skript to build a java native interface for the public headers of firm.
6 # Author:      Goetz Lindenmaier
7 # Modified by:
8 # Created:     30.10.2002
9 # CVS-ID:      $Id$
10 # Copyright:   (c) 2002 Universität Karlsruhe
11 # Licence:
12
13 top_srcdir=@top_srcdir@
14 srcdir=@srcdir@
15 topdir=..
16 subdir=firmjni
17
18 # This is the list of firm headers a JNI interface is generated for
19 # If you change this list, also change FRIM_PATH_HEADERS and the list
20 # in Makefile.in
21 FIRM_HEADERS="firm.h firm_common.h dbginfo.h ident.h tv.h
22         type.h entity.h type_or_entity.h tpop.h mangle.h
23         irprog.h irgraph.h irnode.h irmode.h irop.h ircons.h ircgcons.h
24         irflag.h irvrfy.h irdump.h iropt.h irgopt.h ircgopt.h
25         irouts.h irdom.h irloop.h cgana.h
26         irgmod.h typegmod.h"
27 # How to pass function pointers? Therefore removed.
28 # irgwalk.h typewalk.h
29
30 FIRM_PATH_HEADERS="common/firm.h common/firm_common.h
31         debug/dbginfo.h ident/ident.h tv/tv.h
32         tr/type.h tr/entity.h tr/type_or_entity.h tr/tpop.h tr/mangle.h
33         ir/irprog.h ir/irgraph.h ir/irnode.h ir/irmode.h ir/irop.h
34         ir/ircons.h ir/ircgcons.h ir/irflag.h ir/irvrfy.h ir/irdump.h
35         ir/iropt.h ir/irgopt.h ir/ircgopt.h
36         ana/irouts.h ana/irdom.h ana/irloop.h ana/cgana.h
37         ir/irgmod.h tr/typegmod.h"
38
39 # The directory containing crecoder.jar and, for now,
40 # remove_cpp_comands.perl
41 FIRM_JNI_TOOLS_DIR=$top_srcdir/tools
42
43 WORK_DIR=.
44
45 ###############################################################################
46
47 SOURCE_DIR=sources
48
49 REMOVE_CPP_COMMANDS=$FIRM_JNI_TOOLS_DIR/remove_cpp_comands.perl
50 CRECODER=$FIRM_JNI_TOOLS_DIR/crecoder.jar
51
52
53 ###############################################################################
54 # Get all the necessary Firm headers.
55 cd $WORK_DIR
56
57 rm -rf $SOURCE_DIR
58 mkdir $SOURCE_DIR
59
60 for file in $FIRM_PATH_HEADERS; do
61     cp $top_srcdir/ir/$file $SOURCE_DIR
62 done;
63
64 ###############################################################################
65 # Remove C preprocessor commands.  Overwrite the header files.
66 # This part should be removed if crecoder integrates the preprocessor.
67
68 rm -f $SOURCE_DIR/firm_typedefs.h
69 for file in $FIRM_HEADERS; do
70     perl $REMOVE_CPP_COMMANDS $SOURCE_DIR/$file
71 done;
72 # the perl script dumps this file in the dir it is called from
73 mv firm_typedefs.h $SOURCE_DIR
74
75 for file in $FIRM_HEADERS; do
76     gcc -E -C -P $SOURCE_DIR/$file -o $file
77 done;
78
79
80 ###############################################################################
81 # Call crecoder to construct from each header a .java file specifying the
82 # java native interface.  Further crecoder constructs an implementation of
83 # the java native interface in C calling the real libfirm functions.
84 # For a file "file.h" files "File.java" and "File.c" are generated.
85
86 export CLASSPATH=$FIRM_JNI_TOOLS_DIR/crecoder.jar:$CLASSPATH
87 for file in $FIRM_HEADERS; do
88    java crecoder/tools/jniBuilder/BuildJNI $file
89 done;
90
91 # Remove the C headers which are no more needed.  They contain
92 # nonsense no C compiler ever should see ;-)
93 rm -f $FIRM_HEADERS
94
95 # javah renames these files.  the jnibuilder doesn't anticipate this
96 # and generates #includes with the original names.
97 ln -s Firm_0005fcommon.h Firm_common.h
98 ln -s Type_0005for_0005fentity.h Type_or_entity.h
99
100 make