# Makefile for Ptolemy II shallow codegeneration # # @Author: # @Version: $Id: makefile.in 55687 2009-09-11 22:13:29Z cxh $ # # This file is based on a template # at $PTII/ptolemy/copernicus/shallow/makefile.in # Root of the Java directory ROOT = @ptII@ CLASSPATH = $(ROOT)$(CLASSPATHSEPARATOR). # Get configuration info CONFIG = $(ROOT)/mk/ptII.mk include $(CONFIG) # Used to build jar files PTPACKAGE = @modelName@ PTCLASSJAR = $(PTPACKAGE).jar JSRCS = OTHER_FILES_TO_BE_JARED = \ $(JSRCS) EXTRA_SRCS = \ $(OTHER_FILES_TO_BE_JARED) # Sources that may or may not be present, but if they are present, we don't # want make checkjunk to barf on them. MISC_FILES = $(DIRS) # make checkjunk will not report OPTIONAL_FILES as trash # make realclean removes OPTIONAL_FILES OPTIONAL_FILES = \ doc JCLASS = $(JSRCS:%.java=%.class) MODEL = @modelName@ MODELPATH = @modelPath@ # Location where we create code that we are generating TARGETPACKAGE = @targetPackage@ TARGETPATH = @outputDirectory@ TARGETCLASS = $(TARGETPACKAGE).$(MODEL) # Package that the decompiler creates classes in DECOMPILERTARGETPACKAGE = $(TARGETPACKAGE) # Directory that the decompiler creates classes in DECOMPILERTARGETPATH = $(TARGETPATH) # Don't include all or install rules here, we want the user # to run 'make demos' to run the tests. all: jclass @echo "To run all the demos, run 'make demo'" install: all $(PTCLASSJAR) # Testsuite uses longTest by default. # Note that the tests use longTest in ptII/util/testsuite/codegen.tcl longTest: demo smokeTest: demo demo: "$(JAVA)" -Xfuture -classpath "@ptIIUserDirectory@$(CLASSPATHSEPARATOR)$(CLASSPATH)" "-Dptolemy.ptII.dir=@ptII@" ptolemy.actor.gui.CompositeActorApplication -class $(TARGETPACKAGE).CG$(MODEL) ############################################################################ # Rules to run the jode as a decompiler # Jode is a java decompiler. It is useful for looking at the contents of # class files. It can be downloaded from # http://jode.sourceforge.net/download.php # # Jode is full GPL, so we can't distribute it without making Ptolemy GPL'd # # Jode can be downloaded from # http://jode.sourceforge.net/download.php JODE=$(ROOT)/bin/jode # Class to disassemble DECOMPILERTARGETCLASS = CG$(MODEL) # Generate a .java file from a class file and recompile it. # Jode jodeDecompile: jodeDecompileDemo jodeRecompileDemo jodeRunRecompiledDemo jodeDecompileDemo: @echo "Convert .class file back to .java file, compile it, run it" classes=`(cd $(DECOMPILERTARGETPATH)$(MODEL); ls *.class | sed 's/.class//g')`; \ for class in $$classes; \ do \ echo "--- Decompiling $(DECOMPILERTARGETPACKAGE).$$class"; \ "$(JODE)" -c . -d $(DECOMPILERTARGETPATH) $(DECOMPILERTARGETPACKAGE).$$class; \ relativetargetpath=`echo $(TARGETPACKAGE) | sed 's@\.@/@g'`; \ sh "$(ROOT)/ptolemy/copernicus/shallow/test/jode2java" \ $$relativetargetpath/$$class.java \ > jodeDecompile.java; \ mv jodeDecompile.java $$relativetargetpath/$$class.java; \ done jodeRecompileDemo: relativetargetpath=`echo $(TARGETPACKAGE) | sed 's@\.@/@g'`; \ $(JAVAC) -classpath \ "$(DECOMPILERTARGETPATH)$(CLASSPATHSEPARATOR)$(ROOT)" \ -d $(DECOMPILERTARGETPATH)$$relativetargetpath \ $(DECOMPILERTARGETPATH)$$relativetargetpath/$(DECOMPILERTARGETCLASS).java jodeRunRecompiledDemo: $(JAVA) -Xfuture -classpath "$(DECOMPILERTARGETPATH)$(CLASSPATHSEPARATOR)$(ROOT)" \ ptolemy.actor.gui.CompositeActorApplication \ -class $(TARGETPACKAGE).CG$(MODEL) # Get the rest of the rules include $(ROOT)/mk/ptcommon.mk