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


next up previous contents index
Next: Coding conventions Up: Code development Previous: Code development

Subsections



Overview of code development

This section runs through the basic operational aspects of developing code in AIPS++.

Setup

Basic AIPS++ programmer setup was described in §3.1.2. To recapitulate the main points

The AIPS++ makefiles normally deposit binary files in the same directory as programmer source files unless you create separate directories for them. If you intend to compile sources for more than one architecture or compiler then you should create these directories. A good strategy is to maintain sources within your home directory (which presumably is backed up) and relegate the binaries to some other filesystem with more space but not backed up. Hence typically

   mkdir /bigdisk/myarea/sun4sol_gnu/{aux,bin,bindbg,lib,libdbg}
   ln -s /bigdisk/myarea/sun4sol_gnu $HOME/aips++/sun4sol_gnu

Do this for each AIPS++ architecture that you are likely to use. The AIPS++ makefiles will discover and use these directories automatically. You can use aipsinit (p[*]) to switch between architectures at any time.

Modifying existing sources

Once your workspace is set up the AIPS++ makefiles allow you to compile system sources without having to check them out into your workspace. Programmer-oriented makefile targets are described in §11.4. Typically it is enough to invoke gmake (p[*]) without any targets. Use

   gmake help

to get a context-sensitive summary of the AIPS++ targets for each directory. Programmer-oriented targets are discussed in section §11.4.

If you wish to modify a source file then

Once you've modified the file you can compile it in your workspace without affecting the system binaries. When you're satisfied with your changes

If you want to update the system binaries you will need to issue a

   gmake allsys

This can be done from a programmer workspace (although some installations explicitly prevent this by removing write permission for aips2prg from the AIPS++ system directories).

The gmake command line - flags and variable definitions

gmake (p[*]) has several command line options which are frequently useful for AIPS++ programmers.

Note that the default makedefs (p[*]) sets the -no-print-directory internally (via MAKEFLAGS) and also sets -i for system invokation but not for programmer invokation. Consult the unix manual page for gmake for further options or use

   gmake --help

Do not confuse this with

   gmake help

which is an AIPS++ target which lists AIPS++ targets. Note also that you should eschew usage of the -e option (environment variables override makefile variables) unless you fully understand its implications.

The other important aspect of gmake invokation is that makefile variables may be defined on the command line and these (usually) override their definition within the makefile. The makefiles use separate sets of variables for system and programmer compilations, so for example, system C++ compilations use C++DBG and C++OPT for debug and optimized compilations whereas C++FLAGS is used for programmer compilations. The default makedefs (p[*]) sets

   ifdef OPT
      C++FLAGS  = $(C++OPT) $(EXTRA_C++FLAGS)
   else
      C++FLAGS  = $(C++DBG) $(EXTRA_C++FLAGS)
   endif

although as described in section §11.3 the site-specific makedefs may redefine this, for example as

   ifdef OPT
      C++FLAGS := -O$(OPT) -pipe
   else
      C++FLAGS := $(C++DBG)
   endif

   C++FLAGS += $(EXTRA_C++FLAGS)

Either way, this example shows three basic types of command-line variable substitutions

As discussed in section §12.2, a list of variables of specific interest to programmers may be obtained via

   gmake show_prg

This may be used to show the value of the variables which would be used in a particular situation, for example

   gmake OPT=2 EXTRA_C++FLAGS="-fast" show_prg

The variables of interest to programmers are described in more detail in section §11.4.

As suggested above, the site-specific makedefs (p[*]) may be used to alter the construction of programmer variable definitions. Several conventional constructions are discussed in section §11.3. Programmers may also implement their own definitions or constructions in a personal makedefs file as discussed in the same section.

Creating new files and directories

If you want to develop a new directory in the AIPS++ hierarchy, usually to contain a class implementation module or a new application, then simply create that directory in your workspace. Likewise, new files may simply be created - the AIPS++ makefiles do not contain lists of files but use the file suffix to determine how to process a file. Recognized file suffixes are listed in section §10.6.

All AIPS++ directories (except for .dir and tmplinst directories) must contain a makefile which must be called makefile. Typically this need only include one of the generic AIPS++ makefiles (see §10.6). For example, when creating a new application the minimum requirement would be

# $Id$

   # Use the generic AIPS++ application makefile.
   #---------------------------------------------
   include $(word 1, $(AIPSPATH))/code/install/makefile.app

Once you have finished development the new directory may be checked in to the master via ai (p[*]). However, you may receive a message to the effect that permission for the operation is denied - creation of new files and directories in many parts of the master is restricted to particular individuals since all new code must be vetted by the ``Code-Cop''.

makefiles

The makefiles which exist in the AIPS++ source directories mostly just include a generic makefile but some need to supply additional information.

For an application you often need to register any required external libraries and may also want to define some preprocessor directives as described in section §10.7:

# $Id$

   # Use the generic AIPS++ application makefile.
   #---------------------------------------------
   XLIBLIST := GLISH WCSLIB F77
   CPPMODU  := -DFOO -DBAR
   include $(word 1, $(AIPSPATH))/code/install/makefile.app

The XLIBLIST and CPPMODU variables are relevant to the app, imp, and tst makefiles.

The documentation makefile requires arguments to be specified for conversion of LATEX documents to HTML via latex2html. Typically

# $Id$

   # Declare latex2html flags.
   System := -split 2
   Coding := -split 3

   # Use the generic AIPS++ documentation makefile
   #----------------------------------------------
   include $(word 1, $(AIPSPATH))/code/install/makefile.doc

This example declares that latex2html should be run on System.latex and Coding.latex. No other files in the directory with a .latex suffix will be converted to HTML although they will be converted to POSTSCRIPT. At the minimum the variable of the same basename as the .latex file should specify a -split argument to latex2html, but it can also specify any other arguments recognized by it.

This example also illustrates that LATEX documents must have a .latex suffix to distinguish them from plain TEX documents.

Adjunct makedefs files may contain definitions (or, in principle, rules) which apply to a particular source code directory. The adjunct files are architecture-specific and are primarily intended to control compiler options on a per-sourcefile basis. This is an advanced topic discussed in section §10.5.

See also

Section §1.4, AIPS++ accounts and groups.


next up previous contents index
Next: Coding conventions Up: Code development Previous: Code development   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
2006-10-15