The L1 level1 library

The problem

The ASC ACEware level 1 library does a great job of providing a interface to the level 1.1 data. However, I feel it places a burden on the applications programmer regarding the number of header files and libraries that must be kept track of. This results in more complex C code and especially makefiles. The problem is increased by the fact that the libraries are stored in non-standard locations (given in the $ACE_WARE environment variable).

For example, a typical C program might require the following:

#include "hdfi.h" 
#include "cris.h" 
#include "crisGetData.h"
#include "utilities.h"
#include "getEvents_c.h"
and the corresponding makefile would look like this:
INCLUDE_DIR = $(ACE_WARE)/include
LIBRARY_DIR = $(ACE_WARE)/lib

INCLUDE_HEADER_DIRS = -I$(INCLUDE_DIR)/hdf                \
		-I$(INCLUDE_DIR)/structures               \
		-I$(INCLUDE_DIR)/level1/prototype         \
		-I$(INCLUDE_DIR)/level1                   \
		-I$(INCLUDE_DIR)/level1_1/prototype/cris  \
		-I$(INCLUDE_DIR)/level1_1/prototype/ace

INCLUDE_LIB_DIRS = -L$(LIBRARY_DIR)

INCLUDE_LIBRARIES = -llevel1_1 -lCrisGetData -lUtilities

The solution

I found this hard to keep track of. I wanted only one header file and one library, both kept in the standard locations (/usr/local/lib and /usr/local/include), so it would be possible to say:
#include <L1.h>
and to link with a simple -lL1.

It turned out not to be difficult to accomplish this. It requires no changes to any of the files in the ASC ACEware distribution. To make the header file, all the separate ASC header files are concatenated (a little care has to be taken to make sure this is done in the correct order) and all the object (.o) files are archived into one big library. All this is taken care of by the makefile in one of the steps below.

How to do it

The step-by-step process is as follows:

  1. Install the ACEware libraries as usual, following Bruce's directions
  2. Compile the ACEware libraries. You can either use Bruce's directions or use an easier method.

  3. Download the L1 Makefile to your computer. Let's say you put it in your home directory and name it ``Makefile.L1''.
  4. cd $ACE_WARE/pkgs
  5. Become superuser, if necessary. (In which case, you may have to use ~user instead of ~ in the next step.)
  6. make -f ~/Makefile.L1 links

Now you should have the files $ACE_WARE/lib/libL1.a and $ACE_WARE/include/L1.h with symlinks to them in /usr/local/lib and /usr/local/include.

A couple notes: I only provide this solution for the level1 and level1_1 libraries, not for asc, hdf, or level0. Furthermore, when Robert or Bruce make changes to these libraries, then this Makefile may also have to change. I hope to be able to keep up with any changes they make.

The latest version of the Makefile is 1.2. It works with

Version 1.1 is also available. It works with

Marty Olevitch

Laboratory for Experimental Astrophysics
Physics Dept, Washington University in St. Louis
St. Louis, MO 63130 USA
marty@cosray2.wustl.edu