Go to previous page
Go to next page


Make files are used for compiling code and building the driver program. They make compilation easier in many ways. When composing a GNUmakefile, it is best to copy a functioning GNUmakefile into the directory of the Java files and then customize it. An example GNUmakefile is given below and explained.

Layout:

The file header is commented out with the '#' character. Comments are written in the same fashion as Java comments just with a different delimiter.
   1: 	 # file: GNUmakefile
   2:	 #
   3:	 # this make file builds the driver program using GNU make and
   4:	 # the isip make template
   5:	 # 
   6:	
The compilers are defined here. Note that the code is compiled for byte code and for Javadoc html files.
   7:	 # define the default compiler
   8:	 #
   9:	 ISIP_JAVA_COMPILER = javac
   10:	 ISIP_JAVADOC = javadoc 
   11:	
The source files needed for compilation are specified here. In this case, "*.java" includes all the java files in that directory.

   12:	 # source files
   13:	 #
   14:	 ISIP_REQUIRE = JAVA JAVAC JAR SH 
   15:	 ISIP_FILES = *.java 
   16:	
A scripting file is created when the GNUmakefile is run, and the name of the scripting file is defined here. The scripting file actually runs the "java" command and assigns class paths. Also, duplicate scripting files are created. One is created in the current directory. The other copy is placed in the "/tools/bin/scripts" directory.
   17:	 # driver program
   18:	 #
   19:	 ISIP_DRIVER_SCRIPT = isip_transform_builder.sh
   20:	
The flags and dependencies needed for compiling files are defined in this section. In this example, no flags or dependencies are needed.
   21:	 # define compilation flags for the Java compiler
   22:	 #
   23:	 ISIP_JFLAGS = 
   24:	
   25:	 # depenedencies
   26:	 #
   27:	 ISIP_DEPS = 
   28:	
When files need to be included into a program a resource list must be created. Upon running a "make install" the compiler looks at line 31 to see what files to include. In this example, "copy-resources" is defined below, so basically it points to the definition for what to occur on a "make install". Line 32 defines what to occur on a "make clean" or "make distclean". Again, it is told to look at the "delete-resources" sections for the commands to be run on a cleaning command. Note that "make distclean" is the preferred command.
   29:	 # define a resource install directive
   30:	 #
   31:	 ISIP_RESOURCE_INSTALL = copy-resources
   32:	 ISIP_RESOURCE_CLEAN = delete-resources
   33:	
Other files needed are specified here. The particular jar file name is assigned. If any images or text will be included, it would be specified in this section where to put certain files.
   34:	 # define the jarfile name
   35:	 #
   36:	 ISIP_JARFILE_NAME = transformBuilder.jar
   37:
   38:	 IMAGES_ICONS_DIR = $(ISIP_DEVEL)/lib/research/isip/images/isip_transform_builder/icons
   39:	 IMAGES_SPECIAL_DIR = $(ISIP_DEVEL)/lib/research/isip/images/isip_transform_builder/special
   40:	 TEXT_DIR = $(ISIP_DEVEL)/lib/text/isip_transform_builder
   41:	
The java template directory is included with the include directive.
   42:	 # make template
   43:	 #
   44:	 include $(ISIP_DEVEL)/lib/scripts/make/compile_class_java.make 
   45:	
Resources:

The two remaining sections are definitions of "copy-resources" and "delete-resources" that are referred to above. Notice that in order for this GNUmakefile to be used as a template, the directory structure must match the directory structure below. The text files should be kept in a directory entitled "text". The images should be included in an "images" directory with subdirectories called "special" and "icons".
   46:	 # install the images and text files to the lib directory
   47:	 #
   48:	 copy-resources:
   49:		echo "> installing the resource files"
   50:		mkdir -p $(TEXT_DIR)
   51:		cp -fr text/*.txt $(TEXT_DIR)
   52:	
   53:		echo "> installing the images"
   54:		mkdir -p $(IMAGES_ICONS_DIR)
   55:		cp -fr images/icons/*.gif $(IMAGES_ICONS_DIR)
   56:		mkdir -p $(IMAGES_SPECIAL_DIR)
   57:		cp -fr images/special/*.gif $(IMAGES_SPECIAL_DIR)
   58:	
The "delete-resources" commands basically undo what the "copy-resources" commands have done.

   59:	 # delete the images and text files from the lib directory
   60:	 #
   61:	 delete-resources:
   62:		echo "> deleting the resource files"
   63:		-rm -fr $(TEXT_DIR)
   64:	
   65:		echo "> deleting the images"
   66:		-rm -fr $(IMAGES_ICONS_DIR)
   67:		-rm -fr $(IMAGES_SPECIAL_DIR)
   68:
   69:	 #
   70:	 # end of file

	

Go to previous page
Go to next page

Footer
ERC

Home | Projects | Publications | What's New | Contact | About Us | Search | Up

Please direct questions or comments to ies_help@cavs.msstate.edu

Mississippi State University
Footer