Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 874
News FAQ
Search Home


next up previous contents index
Next: Environment Up: Repository Conventions Previous: Using Scripts

Makefiles

In general, there is a one-to-one mapping between directories in the data source tree and directories in the data repository tree. The one slight deviation from this general rule is with tables. For tables, there is a replication of the table directory. So for example if we have a table called demo/3C273XC1 in the repository tree, this table would actually correspond to demo/3C273XC1/3C273XC1 in the source tree. The makefile, scripts (which need not be beneath a config/libexec directory), text files, etc. which install and perhaps create this table are found in the first 3C273XC1 directory while the 3C273XC1 subdirectory only contains the table which is installed in the repository.

When writing makefiles, there are some basic tools which should be used. $(RUN) must be used to execute the scripts used to generate a data component from scratch. This collects the exit status of the script and then uses the status to produce the update and error logs. Another tool which is often useful is $(MKHIER). When a fully qualified path is passed in, this will create the entire path if it doesn't exist, e.g. a makefile rule like:

   doit:
           $(MKHIER) /tmp/just/trying/it/out

would cause all of the directories in /tmp/just/trying/it/out to be created.

In addition to these tools, there are some variables which are useful:

When writing makefiles in the data system, there are two targets which are recursively built these are build and install. build is the target which builds data elements from scratch. install is the target which moves the data element from the source tree to the mirror point for the repository. Obviously all makefiles will specify an install target, but not all makefiles will specify an build target.

Much of the standard work done by the makefiles is found in makedef components which are included in the makefiles for individual data elements. All makefiles include a standard preample which does the minimum setup required to find the makedef include files:

   DATA_THISDIR  := $(shell pwd | sed -e 's=^/tmp_mnt/=/=')
   DATA_ROOT := $(shell echo $(DATA_THISDIR)/ | sed -e '{s@/data/.*$$@/data@;}')
   include $(DATA_ROOT)/config/makedefs/basic

All makefiles should simply include this at the beginning. The basic makedef sets up all of the standard variables and rules for recursively building the build and install targets. Including the install.table makedef defines the rule which will copy a table from the current directory to the repository. It is assumed that the table is beneath the current directory and has the same name as the current directory. Including the install.fits makedef defines the rule which will copy all FITS files in the current directory to the corresponding directory in the repository. By convention, all FITS files have the .fits suffix.

So for example, the makefile to just copy a table which is not updated as part of the build process to the repository would look like:

   DATA_THISDIR  := $(shell pwd | sed -e 's=^/tmp_mnt/=/=')
   DATA_ROOT := $(shell echo $(DATA_THISDIR)/ | sed -e '{s@/data/.*$$@/data@;}')
   include $(DATA_ROOT)/config/makedefs/basic
   include $(DATA_ROOT)/config/makedefs/install.table

The makefile to install FITS files would look like:

   DATA_THISDIR  := $(shell pwd | sed -e 's=^/tmp_mnt/=/=')
   DATA_ROOT := $(shell echo $(DATA_THISDIR)/ | sed -e '{s@/data/.*$$@/data@;}')
   include $(DATA_ROOT)/config/makedefs/basic
   include $(DATA_ROOT)/config/makedefs/install.fits

and the makefile to build and install a table might look like:

   DATA_THISDIR  := $(shell pwd | sed -e 's=^/tmp_mnt/=/=')
   DATA_ROOT := $(shell echo $(DATA_THISDIR)/ | sed -e '{s@/data/.*$$@/data@;}')
   include $(DATA_ROOT)/config/makedefs/basic

   build:
           @$(RUN) glish IERSeop97.g

   include $(DATA_ROOT)/config/makedefs/install.table

A good example of how to create and update tables can be found in the scripts and makefiles beneath data/geodetic/IERSeop97. In this case, Glish is used to create and maintain the IERSeop97 table.


next up previous contents index
Next: Environment Up: Repository Conventions Previous: Using Scripts   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2004-11-13