X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=firmjni%2FMakefile.in;h=fd156f6fb63598d0ecf3ec7928f73a3913fc474d;hb=b2509ebc03f0b178683087886a9d9269cb84bd03;hp=9deaad43904c75a84c1fa497d3936d4731e6dac4;hpb=afc57eade392aae2647c739b9103be6cf59d4c0f;p=libfirm diff --git a/firmjni/Makefile.in b/firmjni/Makefile.in index 9deaad439..fd156f6fb 100644 --- a/firmjni/Makefile.in +++ b/firmjni/Makefile.in @@ -1,11 +1,22 @@ - -# $Id$ +# +# Project: libFIRM +# File name: firmjni/Makefile.in +# Purpose: +# Author: Till Riedel, Goetz Lindenmaier +# Modified by: +# Created: 2002 +# CVS-ID: $Id$ +# Copyright: (c) 2002 Universität Karlsruhe +# Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. +# top_srcdir := @top_srcdir@ srcdir = @srcdir@ topdir = .. subdir = firmjni +enable_heapanal := @enable_heapanalysis@ + # The library implementing the JNI methods. This name is also # known to the generator for the JNI interface and used in the # static initializer. @@ -14,6 +25,8 @@ LIBNAME = libfirmjni.so # The name of the package containing the Firm JNI PACKAGENAME = firmjni +include $(topdir)/MakeRules + # where to put libfirmjni.so libdir = @libdir@ # where to put the directory firmjni containing the generated @@ -27,18 +40,24 @@ SHELL_TOLOWER = awk '{for (i=1;i<(NF+1);i=i+1) {printf(tolower(substr($$i,1,1)) OFILES = $(MEMBERS:.m=.o) HFILES = $(MEMBERS:.m=.h) +JAVAFILES = $(MEMBERS:.m=.java) CLASSFILES = $(MEMBERS:.m=.class) -CPPFLAGS = -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/common \ +CPPFLAGS += -I$(top_srcdir)/ir/ir -I$(top_srcdir)/ir/common \ -I$(top_srcdir)/ir/ident -I$(top_srcdir)/ir/tr \ -I$(top_srcdir)/ir/tv -I$(top_srcdir)/ir/debug \ - -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/st @CPPFLAGS@ \ - -D_SIZE_T_ + -I$(top_srcdir)/ir/ana -I$(top_srcdir)/ir/opt \ + -I$(top_srcdir)/ir/st -I$(top_srcdir)/ir/stat -LDFLAGS += $(topdir) +LDFLAGS += -I$(topdir) + +ifeq ($enable_heapanal,yes) +LDFLAGS += -L$(libdir) -lfirmlower -labor +endif FIRM_HEADERS=$(notdir $(FIRM_PATH_HEADERS)) MEMBERS=$(subst .h,.m,$(shell echo $(FIRM_HEADERS)|$(SHELL_TOUPPER))) +MEMBERS += $(IMPL_MEMBERS) # How to pass function pointers? Therefore removed. # irgwalk.h typewalk.h @@ -47,15 +66,24 @@ MEMBERS=$(subst .h,.m,$(shell echo $(FIRM_HEADERS)|$(SHELL_TOUPPER))) # Irgwalk.m Typewalk.m # FIRM_PATH_HEADERS=common/firm.h common/firm_common.h \ - debug/dbginfo.h ident/ident.h tv/tv.h \ + ident/ident.h tv/tv.h \ tr/type.h tr/entity.h tr/type_or_entity.h tr/tpop.h tr/mangle.h \ + tr/type_identify.h \ ir/irprog.h ir/irgraph.h ir/irnode.h ir/irmode.h ir/irop.h \ ir/ircons.h ir/ircgcons.h ir/irflag.h ir/irvrfy.h ir/irdump.h \ ir/iropt.h ir/irgopt.h ir/ircgopt.h \ ana/irouts.h ana/irdom.h ana/irloop.h ana/cgana.h \ - ir/irgmod.h tr/typegmod.h + ir/irgmod.h tr/typegmod.h opt/tailrec.h + FIRM_SOURCE_DIR_HEADERS=$(addprefix $(SOURCE_DIR)/,$(FIRM_HEADERS)) +# hand implemented members +IMPL_MEMBERS = Dbginfo.m + +ifeq ($(enable_heapanal),yes) +IMPL_MEMBERS += Heapanal.m +endif + # The directory containing crecoder.jar and, for now, # remove_cpp_comands.perl FIRM_JNI_TOOLS_DIR=$(top_srcdir)/tools @@ -69,12 +97,13 @@ SOURCE_DIR=sources REMOVE_CPP_COMMANDS=$(FIRM_JNI_TOOLS_DIR)/remove_cpp_comands.perl CRECODER=$(FIRM_JNI_TOOLS_DIR)/crecoder.jar -all: classfiles jni +all: classfiles javafiles jni classfiles: $(CLASSFILES) +javafiles: $(JAVAFILES) %.class: %.java - javac $< + javac -classpath .. $< # javah renames these files. the jnibuilder doesn't anticipate this # and generates #includes with the original names. @@ -86,6 +115,13 @@ Type_or_entity.h: Type_or_entity.class ln -sf Type_0005for_0005fentity.h Type_or_entity.h javah -classpath $(topdir) -o $@ $(PACKAGENAME).$(<:.class=) + +Dbginfo.java: + cp $(top_srcdir)/firmjni/aux/Dbginfo.java $(top_srcdir)/firmjni/aux/Dbginfo.c . + +Heapanal.java: + cp $(top_srcdir)/firmjni/aux/Heapanal.java $(top_srcdir)/firmjni/aux/Heapanal.c . + %.h: %.class javah -classpath $(topdir) -o $@ $(PACKAGENAME).$(<:.class=) @@ -95,15 +131,27 @@ Type_or_entity.h: Type_or_entity.class $(OFILES): gcc $(CPPFLAGS) -c $(@:.o=.c) -o $@ -jni: $(HFILES) $(OFILES) # ../libfirm.a - gcc -shared -fPIC -o $(LIBNAME) *.o -lfirm -L.. +ifeq ($(enable_heapanal),yes) +HEAPANALLIB = -lheapanal +else +HEAPANALLIB = +endif + +# We need firmlower and abor for heap analysis stuff, wich is called from aux/Heapanal.java +# BY the way, what is sw/lib/ can this be removed??? +jni: $(HFILES) $(OFILES) # ../libfirm.a + gcc -shared -fPIC -o $(LIBNAME) *.o -lfirm -lxml2 -L.. $(HEAPANALLIB) $(LDFLAGS) -liberty -L../../sw/lib install: cp libfirmjni.so $(libdir) # mkdir $(javadir) # cp *.java @javadir@ # cp *.class @javadir@ + +test: jni + $(MAKE) -C testprograms test + clean: rm -rf sources *.c *.h *.o @@ -126,10 +174,19 @@ $(SOURCE_DIR)/firm_typedefs.h: $(FIRM_SOURCE_HEADERS) FIRM_SRC_HEADER=$(top_srcdir)/ir/$(filter %/$(notdir $@),$(FIRM_PATH_HEADERS)) + +# recode: remove "a from C code... $(FIRM_SOURCE_DIR_HEADERS): $(SOURCE_DIR) - troff -a -C -z $(FIRM_SRC_HEADER) >$(SOURCE_DIR)/$(notdir $@) + recode ISO-8859-1..ascii < $(FIRM_SRC_HEADER) > $(SOURCE_DIR)/$(notdir $@) perl $(REMOVE_CPP_COMMANDS) $@ +# cp $(FIRM_SRC_HEADER) $(SOURCE_DIR)/$(notdir $@) +# recode ISO-8859-1..ascii < $@ > $@.x +# cp $@.x $@ + +# generiert leere dateien ;-( +# troff -a -C -z $(FIRM_SRC_HEADER) > $(SOURCE_DIR)/$(notdir $@) + $(FIRM_HEADERS):$(FIRM_SOURCE_DIR_HEADERS) $(SOURCE_DIR)/firm_typedefs.h gcc $(CPPFLAGS) -E -C -P $(SOURCE_DIR)/$@ -o $@ @@ -142,5 +199,8 @@ $(FIRM_HEADERS):$(FIRM_SOURCE_DIR_HEADERS) $(SOURCE_DIR)/firm_typedefs.h H_FROM_JAVA=$(subst .java,.h,$(shell echo $@|$(SHELL_TOLOWER))) -%.java: $(FIRM_HEADERS) +%.java: $(FIRM_SOURCE_DIR_HEADERS) $(SOURCE_DIR)/firm_typedefs.h + gcc $(CPPFLAGS) -E -C -P $(SOURCE_DIR)/$(H_FROM_JAVA) -o $(H_FROM_JAVA) env CLASSPATH=$(FIRM_JNI_TOOLS_DIR)/crecoder.jar:$$CLASSPATH java crecoder/tools/jniBuilder/BuildJNI $(H_FROM_JAVA);\ + rm $(H_FROM_JAVA); +# remove the patched header so that further compilation finds the proper firm headers