Suppose one wishes to build a task called sample for
the swift mission from the files sample1.c and
sample2.c. This task has a help file called sample.html,
and a parameter file called sample.par. Furthermore,
this task has a unit test in the form of a perl script
named ut-sample, which produces a FITS file ut-sample.fits.
The following Makefile would supply all
the necessary targets and macros to make the task behave
(build, install, clean, test, etc.) like all other HEAdas
tasks:

Note that, as in all UNIX Makefiles, macro definitions
must start at the beginning of a line, with no whitespace
of any kind before the macro name.

This Makefile will in effect provide the following targets,
which will have the stated behaviors:

default: Build each source file to produce an object file,
then link the object files to create the compiled task. This
is also the target which will be "maked" if one invokes make
with no explicit target.

all: Perform the same actions as the default target, and in
addition, "publish" the compiled task into the local "build" area.

clean: Remove all object files and other build by-products,
as well as the FITS file created by the unit test script.

distclean: Remove the compiled task as well as the items
removed by the clean target.

install: Install the compiled task into the proper destination
in the "installed" location.

install-test: Install the test script into the proper destination
in the "installed" location.

In general the best way to create a new Makefile for a directory
is to copy a Makefile from the most similar example possible.
This way, if there are component-specific features which are
present in one component's Makefiles and not others, the new
Makefile will remain as similar as possible to others in its
same component group. In other words, when
starting a new task for the SWIFT mission, start with another
SWIFT task Makefile. For a new library for ASTRO-E2, start with
an existing ASTRO-E2 library Makefile, etc.