view makefile @ 0:5242703e91d3 tip

Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author tomwalters
date Fri, 20 May 2011 15:19:45 +0100
parents
children
line wrap: on
line source
###########################################################################
#
# ROOT MAKEFILE FOR AIM         M. Allerhand,  (MRC-APU) 7/7/93
#                               C. Giguere,             24/3/94
#                               A. J. Datta,   (MRC-APU)31/8/95
#				R. Patterson   (MRC-APU)09/4/97
#
###########################################################################
###########################################################################
#
# INTRODUCTION AND TABLE OF CONTENTS
#
# This is the Root makefile for the AIM software package which
# consists of the AIM program itself, signal processing tools,
# documentation, demonstrations and a Matlab interface.  Part I
# describes the file system, Part II the makefile itself and
# Part III the make help option.
#
#
# PART I: THE AIM FILE SYSTEM 
#
# The file system for AIM itself is organised into five directories,
# $(DIRS): filter, glib, model, stitch, and wdf. The root makefile
# calls a nested makefile in each of the five directories to build
# libraries, $(LIBS).  These are then linked to form main programs,
# $(MAIN).  The signal processing tools are divided into basetools (in
# directory tools) and auxtools (in directories xaim and saitools).
# There are two directories for documentation (man and docs), one for
# demonstrations scripts (scripts) and one for digitised sounds
# (waves).
#      
# I.A. Directories and Directory Links
#      
# I.B. AIM_FILES: For AIM Executables, Basetools and Auxtools.
#      I.B.1. Makefiles  
#      I.B.2. AIM Sources:            SRC_AIM 
#      I.B.3. Basic Tools:            basetools
#      I.B.4. Auxillary Tools:        auxtools
#      I.B.5. Libraries:
#      I.B.6. Executables:
#      I.B.7. Links to Executables:      
#
# I.C. DOC_FILES: For Documentation, Man, Demonstrations and Matlab.
#      I.C.1. Manual Entries:         man/man1
#      I.C.2. Demonstration Scripts:  scripts
#      I.C.3. Documentation	      docs
#      I.C.4. Waves		      waves
#      I.C.5. Matlab Interface	      matlab
#      
#      
# PART II:   THE ROOT MAKEFILE ITSELF
# 
# II.A. Arguements and Flags
# 
# II.B. Targets
#      II.B.1. General Targets
#      II.B.2. Link and Build Libraries and Targets 
#      II.B.3. Create Directories and Pull Sources 
#      II.B.4. Create AIM Links (genXXX) 
#      II.B.5. Make tar files
#      II.B.6. Maintenance Targets
# 
# II.C. Machines
# 
# 
# PART III:  MAKE HELP
# 
# III.A. ARGS
# III.B. TARGETS
# III.C. MACHINES
# 

###########################################################################
###########################################################################
# 
# PART I: THE AIM FILE SYSTEM 
#
# The signal processing tools are divided into basetools (in
# directory tools) and auxtools (in directories xaim and saitools).
# There are two directories for documentation (man and docs), one for
# demonstrations scripts (scripts) and one for digitised sounds
# (waves).
#      
###########################################################################
#
# I.A. Directories and SCCS Links
#

DIRS      = model         glib            stitch            filter          \
	    wdf           tools           xaim              bin             \
	    waves         man             man/man1          scripts         \
	    docs          saitools        matlab

SCCSLINKS = model/SCCS      glib/SCCS       stitch/SCCS     filter/SCCS     \
	    wdf/SCCS        tools/SCCS      xaim/SCCS                       \
	    man/SCCS        scripts/SCCS    docs/SCCS       saitools/SCCS   \
	    matlab/SCCS


###########################################################################
#
# I.B. AIM_FILES: For AIM Executables, Basetools and Auxtools.
#
#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.B.1. Makefiles  
#
# The root makefile calls a nested makefile in each of the five AIM
# directories to build libraries, $(LIBS).  These are then linked to
# form main programs, $(MAIN). 

MAKEFILES = model/makefile  glib/makefile  stitch/makefile  filter/makefile  \
	    wdf/makefile    tools/makefile xaim/makefile    saitools/makefile

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.B.2. AIM Sources:  SRC_AIM 
#
# The file system for AIM itself is organised into five directories,
# $(DIRS): filter, glib, model, stitch, and wdf. 

SRC_AIM   = glib/null.c    glib/ps.c      glib/grey.c      glib/options.c    \
	    glib/windows.h glib/axes.h    glib/grey.h      glib/options.h    \
	    glib/X.c                                                         \
	    model/model.c  model/bank.c   model/corti.c    model/image.c     \
	    model/model.h  model/bank.h   model/corti.h    model/image.h     \
	    model/units.c  model/defaults.c model/integrate.c model/spiral.c \
	    model/units.h  model/defaults.h model/integrate.h model/spiral.h \
	    model/calc.h   model/atan.c   model/interp.c   model/faster.c    \
	    model/new.c    model/table.c  model/gen.c      model/review.c    \
	    model/version.c                                                  \
	    filter/formulae.c filter/phase.c filter/gamma_tone.c             \
	    filter/formulae.h filter/phase.h filter/gamma_tone.h             \
	    filter/scales.c   filter/all.c   filter/generic.c   filter/imb.c \
	    filter/scales.h   filter/recurse.c filter/recurse.h              \
            wdf/upsample.c    wdf/fir.c       wdf/ear.c      wdf/wdf_ear.c   \
            wdf/upsample.h    wdf/fir.h       wdf/ear.h      wdf/wdf_ear.h   \
            wdf/formulae_tl.c wdf/scales_tl.c wdf/bank_tl.c  wdf/wdf_tl.c    \
            wdf/formulae_tl.h wdf/scales_tl.h wdf/bank_tl.h  wdf/wdf_tl.h    \
            wdf/meddis.c      wdf/calc_tl.h   wdf/meddis.h                   \
	    stitch/buffer.c   stitch/io.c     stitch/draw.c stitch/funcs.c   \
	    stitch/buffer.h   stitch/io.h     stitch/draw.h stitch/funcs.h   \
	    stitch/pullable.c stitch/stitch.c stitch/fill.c stitch/srcio.c   \
	    stitch/pullable.h stitch/stitch.h stitch/fill.h stitch/srcio.h   \
	    stitch/fillable.c stitch/source.c stitch/wrap.c stitch/stypes.c  \
	    stitch/fillable.h stitch/source.h stitch/wrap.h stitch/stypes.h  \
	    stitch/ops.c      stitch/ops.h

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.B.3. Basic Tools:    basetools
#

SRC_TOOLS = tools/options.h tools/units.h   tools/strmatch.h  tools/header.h  \
	    tools/sigproc.h tools/x11coord.h                                  \
	    tools/acf.c     tools/acgram.c  tools/header.c    tools/atob.c    \
	    tools/audim.c   tools/btoa.c    tools/bufwave.c  tools/bufframe.c \
	    tools/chi.c     tools/conv.c    tools/convert.c   tools/cosine.c  \
	    tools/edframe.c                                                   \
	    tools/edwave.c  tools/fbank.c   tools/fft.c       tools/filt1.c   \
	    tools/freqs.c   tools/ftgram.c  tools/ftoa.c      tools/ftos.c    \
	    tools/gate.c    tools/gauss.c   tools/hdr.c    tools/integframe.c \
	    tools/loudness.c tools/merge.c  tools/naptosai.c  tools/noise.c   \
	    tools/op.c  tools/options.c tools/pitch_strength.c tools/ptrain.c \
	    tools/racf.c    tools/ramp.c    tools/saitonap.c  tools/scale.c   \
	    tools/sigproc.c tools/smooth.c  tools/sp_weights.c tools/stats.c  \
	    tools/step.c    tools/stof.c    tools/strmatch.c  tools/swab.c    \
	    tools/tone.c    tools/units.c   tools/x11coord.c tools/x11fonts.c \
	    tools/x11gram.c tools/x11play.c tools/x11plot.c

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.B.4. Auxillary Tools:        auxtools
#

SRC_XAIM  = xaim/synthirn.c       xaim/synthdramp.c   xaim/buttons.c          \
	    xaim/cartoon.c        xaim/graphics.c     xaim/initialise.c       \
	    xaim/stipple_a        xaim/switch_axes.c  xaim/switch_buttons.c   \
	    xaim/switch_control.c xaim/xreview.bitmap xaim/xreview.c          \
	    xaim/xreview.h      xaim/disclaimer.text  xaim/releasenotes.text

SRC_SAITOOLS = saitools/changeheader.c  saitools/findintervals_nap.c         \
	     saitools/findpeaks.c  saitools/header.c  saitools/inout.c       \
	     saitools/napgraph.c saitools/napheader.c saitools/removepeaks.c \
	     saitools/saicut.c   saitools/saigraph.c  saitools/saiinfo.c     \
	     saitools/sairotate.c  saitools/saisummary.c  saitools/tip.h     \
	     saitools/trigger.c saitools/findintervals_sai.c                 \
	     saitools/matrix.c 

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.B.5. Libraries:
#

MLIB      = model/libmodel.a
GLIB      = glib/libglib.a
SLIB      = stitch/libstitch.a
FLIB      = filter/libfilter.a
WLIB      = wdf/libwdf.a
OLIB      = glib/libopts.a
LIBS      = $(MLIB) $(GLIB)  $(SLIB) $(FLIB) $(WLIB) $(OLIB)

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.B.6. Executables: 
#

MAIN      = model/gen         model/review
XAIM      = bin/synthirn      bin/synthdramp      bin/xreview
SAITOOLS  = bin/saisummary    bin/sairotate   bin/saiinfo     bin/saigraph   \
	    bin/saicut        bin/napgraph

WTOOLS    = bin/hdr       bin/atob      bin/btoa        bin/bufwave          \
	    bin/bufframe                                                     \
	    bin/chi       bin/convert   bin/edframe     bin/edwave           \
	    bin/fbank     bin/filt1     bin/ftoa        bin/ftos             \
	    bin/gate                                                         \
	    bin/integframe    bin/loudness  bin/merge       bin/naptosai     \
	    bin/noise     bin/op        bin/pitch_strength  bin/ptrain       \
	    bin/ramp      bin/saitonap  bin/scale       bin/sp_weights       \
	    bin/stats     bin/step      bin/stof        bin/swab             \
	    bin/tone

SPTOOLS   = bin/acf       bin/acgram    bin/audim       bin/conv             \
	    bin/cosine    bin/fft       bin/ftgram      bin/gauss            \
	    bin/racf      bin/smooth

XTOOLS    = bin/x11fonts  bin/x11gram   bin/x11play     bin/x11plot

TOOLS     = $(WTOOLS)  $(SPTOOLS)  $(XTOOLS)


#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.B.7. Links to Executables:
#

LINK_GEN1 = bin/genwav    bin/genstp                                        \
            bin/genbmm    bin/gennap    bin/gensgm                          \
	    bin/genasa    bin/genepn    bin/gensep      bin/gensai          \
	    bin/gencgm    bin/genspl    bin/gensas      bin/gen

LINK_GEN2 = bin/gentst    bin/genfcr    bin/genfcp      bin/genfbm          \
	    bin/genfbc    bin/genfbu    bin/genfbs      bin/genfbl          \
	    bin/genfba    bin/genfbh    bin/genfbi      bin/genfbd          \
	    bin/genfeu    bin/genfes    bin/genfel      bin/genfet          \
	    bin/genfeh    bin/genfei    bin/genfed      bin/gensie          \
	    bin/genfbr    bin/genfbt    bin/genfec      bin/genfea          \
	    bin/gensse

LINK_SCRIPTS = bin/manaim   bin/aimdemo_gtf_all  bin/aimdemo_gtf_2dat         \
	     bin/aimdemo_gtf_spectra bin/aimdemo_gtf_sai bin/aimdemo_tlf_all  \
	     bin/aimdemo_tlf_lowhigh bin/aimdemo_tlf_med bin/aimdemo_tlf_std  \
	     bin/aimdemo_tlf_spectra bin/aimdemo_hat     bin/aimdemo_hat_br   \
             bin/scale_wav  bin/equate_energies  bin/StrobeCriterionDisplay   \
	     bin/aimStrobeCriterion  bin/dp_ms bin/dp_pc  bin/aimR8demo

LINK_AIM1    = $(LINK_GEN1)   $(LINK_SCRIPTS)   bin/review
LINK_AIM2    = $(LINK_GEN1)   $(LINK_GEN2)      bin/review


#
#######################################################################
#
# I.C. DOC_FILES: For Documentation, Man, Demonstrations and Matlab.
#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.C.1. Manual Entries:         man/man1
#

MANWHATIS = man/whatis
MANPAGES  = man/man1/manaim.1                                                 \
	  man/man1/genbmm.1  man/man1/gennap.1  man/man1/gensai.1             \
	  man/man1/genwav.1  man/man1/gensgm.1  man/man1/genepn.1             \
	  man/man1/genasa.1  man/man1/xreview.1 man/man1/genspl.1             \
	  man/man1/acf.1 man/man1/acgram.1 man/man1/atob.1 man/man1/gencgm.1  \
	  man/man1/audim.1   man/man1/btoa.1    man/man1/bufwave.1            \
	  man/man1/chi.1     man/man1/conv.1    man/man1/convert.1            \
	  man/man1/edframe.1 man/man1/bufframe.1 man/man1/cosine.1            \
	  man/man1/edwave.1  man/man1/fbank.1 man/man1/fft.1 man/man1/filt1.1 \
	  man/man1/ftgram.1  man/man1/ftoa.1   man/man1/ftos.1  man/man1/op.1 \
	  man/man1/gate.1    man/man1/gauss.1 man/man1/hdr.1 man/man1/racf.1  \
	  man/man1/integframe.1 man/man1/loudness.1                           \
	  man/man1/merge.1   man/man1/naptosai.1 man/man1/noise.1             \
	  man/man1/options.1 man/man1/pitch_strength.1  man/man1/ptrain.1     \
	  man/man1/ramp.1    man/man1/saitonap.1 man/man1/scale.1             \
	  man/man1/smooth.1  man/man1/sp_weights.1  man/man1/stats.1          \
	  man/man1/step.1    man/man1/stof.1   man/man1/swab.1                \
	  man/man1/tone.1    man/man1/x11fonts.1                              \
	  man/man1/x11gram.1 man/man1/x11play.1   man/man1/x11plot.1
MAN       = $(MANPAGES) $(MANWHATIS)

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.C.2. Demonstration Scripts:  scripts

SCRIPTS   = scripts/manaim                scripts/unpack                    \
	    scripts/aimdemo_gtf_all       scripts/aimdemo_gtf_2dat          \
	    scripts/aimdemo_gtf_spectra   scripts/aimdemo_gtf_sai           \
	    scripts/aimdemo_tlf_all       scripts/aimdemo_tlf_std           \
	    scripts/aimdemo_tlf_lowhigh   scripts/aimdemo_tlf_med           \
	    scripts/aimdemo_tlf_spectra   scripts/aimdemo_hat               \
	    scripts/aimdemo_hat_br        scripts/StrobeCriterionDisplay    \
	    scripts/scale_wav             scripts/equate_energies           \
	    scripts/aimStrobeCriterion    scripts/make-demo-waves           \
	    scripts/dp_ms  scripts/dp_pc  scripts/aimR8demo

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.C.3. Documentation files:	      docs

DOCS      = docs/ReadMe.First      docs/ReadMe   docs/aimBibliography        \
	    docs/aimDocList        docs/aimDocumentation docs/aimFileFormats \
	    docs/aimInstructions   docs/aimMailList      docs/aimPaths       \
	    docs/aimSilentOptions  docs/ftp.doc          docs/PAG95.doc      \
	    docs/aimStrobeCriterion docs/makefile  docs/aimDemonstrations    \
	    docs/aimMeddisHewitt

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.C.4. Demonstration Waves      waves

WAVES     = waves/leo         waves/cegc     waves/hat       bin/hat        \
	    waves/leo_br      waves/cegc_br  waves/hat_br    bin/hat_br     \
	    waves/dr_f8_t16_d waves/dr_f8_t4_d  waves/dr_f8_t1_d            \
	    waves/dr_f8_t16_r waves/dr_f8_t4_r  waves/dr_f8_t1_r            \
	    waves/irns_16_1_1 waves/irns_16_1_4 waves/irns_16_1_16

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# I.C.5. Matlab Interface	      matlab

MATLAB    = matlab/mktstr.m matlab/dB.m matlab/showSummarySAI.m matlab/amd_sumsai.m                  \
	    matlab/amd_sai.m matlab/amd_bmm_nap.m matlab/amd_waves.m matlab/envelope.m               \
	    matlab/squaretone.m matlab/damp_env.m matlab/damp_sin.m matlab/taper.m matlab/showBMM.m  \
	    matlab/ssave.m matlab/sload.m matlab/showNAP.m matlab/showSAI.m matlab/repeat_cycle.m    \
	    matlab/redrawAIM.m matlab/set_input_wave_GUI.m matlab/setFrameChooser.m                  \
	    matlab/searchAimHeaderInfo.m matlab/save_genrc.m matlab/save_as_genrc.m matlab/sappend.m \
	    matlab/revert_genrc.m matlab/readAIMHeader.m matlab/showAverageSAI.m matlab/puretone.m   \
	    matlab/hilitChan.m matlab/getAimHeaderInfo.m matlab/outputChanData.m matlab/erb.m        \
	    matlab/getAimResInfo.m matlab/openOptionGUI.m matlab/get_erb_param.m matlab/illuminate.m \
	    matlab/popupShowFig.m matlab/openOptionGUI_page.m matlab/fchan_info.m                    \
	    matlab/exec_save_genrc.m matlab/XTickShowSAINAP.m matlab/add_sound.m                     \
	    matlab/FofErbScale.m matlab/ErbScale.m 

#
# all files for archiving

FILES_IN_SCCS     = $(MAKEFILES)  $(SRC_AIM)  $(SRC_TOOLS)  $(SRC_XAIM) $(SRC_SAITOOLS)
FILES_NOT_IN_SCCS = makefile

AIM_FILES         = $(FILES_IN_SCCS)  $(FILES_NOT_IN_SCCS)
DOC_FILES         = $(DOCS) $(MAN) $(SCRIPTS) $(MATLAB) $(WAVES)

 

###########################################################################
###########################################################################
#      
# PART II:   THE ROOT MAKEFILE ITSELF
# 
#

###########################################################################
#
# II.A. Arguments and Flags
#
# The form of c compiler is passed by the flag CC.
# Locations of X11 libraries and includes on various machines are
# passed via the CFLAGS and LDFLAGS.
#

CC        = cc
CFLAGS    = -O  -DX11 -I/usr/openwin/include
LDFLAGS   = -L/usr/openwin/lib  -lXmu -lX11 -lm

TARFILE1   = aimR8.tar.Z
TARFILE2   = aimR8docs.tar.Z

# Defaults for APU system.
MOUNT     = /net/sound1
MASTER    = $(MOUNT)/aim/master
RELEASE   = $(MASTER)/release
MAIL_SCRIPT = scripts/unpack


#################################################################################
#
# II.B. Targets
# 
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# II.B.1. General Targets.
#

MAKE = make CC=$(CC)             CFLAGS="$(CFLAGS)"   LDFLAGS="$(LDFLAGS)"    \
	    LIBS="$(LIBS)"       MAIN="$(MAIN)" LINK_AIM1="$(LINK_AIM1)"      \
	    TARGET="$(TARGET)"

install   : 
	  $(MAKE) $(MAIN) $(LINK_AIM1) basetools

main      :  FORCE
	@ $(MAKE) $(MAIN)

basetools  : tools bin tools/makefile
	@ $(MAKE) $(TOOLS)

# release operates from sccs so it won't work elsewhere.

release   : install $(WAVES) $(MAN) $(SCRIPTS) $(LINK_SCRIPTS) $(DOCS) $(MATLAB)

auxtools  : saitools bin saitools/makefile xaim xaim/makefile waves
	@ $(MAKE) $(SAITOOLS) $(XAIM) NWAVES

sources   : $(DIRS) $(MAKEFILES) $(SRC_AIM) $(SRC_TOOLS) $(WAVES) $(MAN) $(SCRIPTS) $(DOCS) $(MATLAB)

demo      : $(WAVES)

links     : $(LINK_AIM1)
alllinks  : $(LINK_AIM2)

FORCE:


#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# II.B.2. Link and Build Libraries and Targets 
#
# 	Link libraries into main programs.

INCLUDES  = -Istitch  -Iglib  -Ifilter  -Imodel -Iwdf

$(MAIN)   :  $(LIBS)  $$@.c
	$(CC) $(CFLAGS) $(INCLUDES) -o $@  $@.c $(LIBS) $(LDFLAGS)


#
# Build libraries.

$(LIBS) : $(DIRS) $(MAKEFILES) $(SRC_AIM) FORCE
	@ cd $(@D) ; $(MAKE) $(@F)

#
# Build basetools.

W_UTILS  = tools/strmatch.o tools/options.o tools/units.o tools/header.o
SP_UTILS = tools/sigproc.o
X_UTILS  = tools/x11coord.o

$(WTOOLS) : $(SRC_TOOLS) tools/$$(@F).c
	@ cd tools ; $(MAKE) $(@F)
	$(CC) $(CFLAGS) -o $@ $(W_UTILS) tools/$(@F).o  $(LDFLAGS)

$(SPTOOLS) : $(SRC_TOOLS)
	@ cd tools ; $(MAKE) $(@F)
	$(CC) $(CFLAGS) -o $@ $(W_UTILS) $(SP_UTILS) tools/$(@F).o  $(LDFLAGS)

$(XTOOLS) :
	@ cd tools ; $(MAKE) $(@F)
	$(CC) $(CFLAGS) -o $@ $(X_UTILS) tools/$(@F).o  $(LDFLAGS)


#
# Build auxillary tools.
#
# Build xaim.

$(XAIM) : $(SRC_XAIM)
	@ cd xaim ; make $(@F) ; mv $(@F) ../bin


# Build saisummary.

$(SAITOOLS) : $(SRC_SAITOOLS)
	    @ cd saitools ; make $(@F) ; mv $(@F) ../bin


# Build waves

NWAVES : 
	 @ cd scripts ; make-demo-waves ; mv irns* ../waves ; mv dr_f8_* ../waves


#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# II.B.3. Create Directories and Pull Sources 
#
# Create directories

$(DIRS)   :
	@ mkdir $@

# Pull files from sccs: makefiles, sources, docs, etc..

$(MAKEFILES) $(SRC_AIM) $(SRC_TOOLS) $(SRC_XAIM) $(SRC_SAITOOLS) $(DOCS) $(MATLAB) $(MANWHATIS) :
	@ echo "$@"
	@ cd $(@D) ; sccs -p$(RELEASE)/$(@D) get -c$(DATE) $(@F); chmod u+rw $(@F)

# Scripts are a special case to be chmod'd.

$(SCRIPTS) :
	@ echo "$@"
	@ cd $(@D) ; sccs -p$(RELEASE)/scripts get -c$(DATE) $(@F) ; chmod 755 $(@F)

# Man pages are a special case needing a name change (for location in man1)

$(MANPAGES) :
	@ cd $(@D) ; sccs -p$(RELEASE)/man get -p -c$(DATE) `echo $(@F) | sed -e 's/\.1/.amp/g'`  > $(@F)

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# II.B.4. Create AIM Links (genXXX) 
#
# Create symbolic links to model entry points (eg. genXXX).

$(LINK_GEN1) $(LINK_GEN2) :
	ln -s  ../model/gen  $@
bin/review :
	ln -s  ../model/review  $@

$(LINK_SCRIPTS) :
	ln -s  ../scripts/$(@F)  $@

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# II.B.5. Make tar files for AIM_FILES and/or DOC_FILES
#

tar :
	@ make $(TARFILE1)
$(TARFILE1) : $(AIM_FILES)
	@ tar cvf - $(AIM_FILES) | compress > $(TARFILE1)

doc :
	@ make $(TARFILE2)
$(TARFILE2) : $(DOC_FILES)
	@ tar cvf - $(DOC_FILES) | compress > $(TARFILE2)

#
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# II.B.6. Maintenance Targets
#

# Remove object files, libraries, main programs, and links, leaving the source code.

clean :
	rm -f */*.o */*.a  $(MAIN)  $(TOOLS)  bin/gen*  bin/review


# Create symbolic links in each sub-directory to SCCS directories in $(RELEASE).

sccslinks   : $(DIRS) $(SCCSLINKS)
$(SCCSLINKS):
	@ cd $(@D) ; ln -s $(RELEASE)/$(@D) SCCS
cleansccs:
	rm -f $(SCCSLINKS)


# Copy demonstration stimuli.

$(WAVES) :
	@ cp  $(RELEASE)/$@  $(@D)


# Mail model to given address.

mail : $(TARFILE1)
	@ uuencode $(TARFILE1) $(TARFILE1)  | split -700 - AIM.
	@ echo ; echo "mail  $(ADDRESS)"
	@ cat $(MAIL_README) | mail -s "AIM software: ReadMe"  $(ADDRESS) ; echo "    $(MAIL_README)"
	@ cat $(MAIL_SCRIPT) | mail -s "AIM software: UnPack"  $(ADDRESS) ; echo "    $(MAIL_SCRIPT)"
	@ for i in AIM.* ; do     \
	    echo "start----" > tmp ; cat $$i >> tmp ; echo "----end" >> tmp ;  \
	    mail -s "AIM software: $$i"  $(ADDRESS) < tmp ;   echo "    $$i" ; \
	  done
	@ rm  tmp AIM.*

#
###########################################################################
# 
# II.C. Machines  
#
#  These targets are machine-specific defaults that set CFLAGS and
#  LDFLAGS appropriately for various machines.  The default machine is
#  sun (see CFLAGS and LDFLAGS at top of makefile).  The include
#  directory (-I in CFLAGS) must contain X11/X.h and X11/Xlib.h.  The
#  lib directory (-L in LDFLAGS) must contain libX11.a.
#
#  Eg:
#      make sun     makes the default target `install' with flags for sun.
#      make TARGET=install sgi   makes the target 'install' for an SGI machine.

TARGET    = install

sun :
	@ make CC=cc   CFLAGS="-O  -DX11 -I/usr/openwin/include" LDFLAGS="-L/usr/openwin/lib  -lX11 $(STUB) -lm" RANLIB=ranlib  $(TARGET)

sungcc :
	@ make CC=gcc  CFLAGS="-O2 -fwritable-strings -DX11 -I/usr/openwin/include" LDFLAGS="-L/usr/openwin/lib  -lXmu -lX11 $(STUB) -lm" RANLIB=ranlib   $(TARGET)

sgi :
	@ make CC=cc   CFLAGS="-O  -DX11 -I/usr/include"         LDFLAGS="-L/usr/lib          -lX11 $(STUB) -lm" RANLIB=echo    $(TARGET)

dec vax :
	@ make CC=cc   CFLAGS="-O  -DX11 -I/usr/include"         LDFLAGS="-L/usr/lib          -lX11 $(STUB) -lm" RANLIB=ranlib  $(TARGET)

hp :
	@ make CC=cc   CFLAGS="-O  -DX11 -I/usr/include/X11R4"   LDFLAGS="-L/usr/lib/X11R4    -lX11 $(STUB) -lm"  RANLIB=ranlib  $(TARGET)

linux :
	@ make CC=gcc  CFLAGS="-O  -fwritable-strings -ansi -DLINUX -DX11 -I/usr/include"   LDFLAGS="-L/usr/lib   -lXmu -lX11 $(STUB) -lm" RANLIB=ranlib  $(TARGET)


apucc  :
	@ make CC=cc   CFLAGS="-O  -DX11 -I/usr/local2/include"  LDFLAGS="-L/usr/local2/lib   -lX11 $(STUB) -lm"  RANLIB=ranlib  $(TARGET)

apugcc :
	@ make CC=gcc  CFLAGS="-O2 -fwritable-strings -DX11 -I/usr/local2/include"  LDFLAGS="-L/usr/local2/lib   -lXmu -lX11 $(STUB) -lm"      RANLIB=ranlib  $(TARGET)

make :
	@ apugdb CC=gcc  CFLAGS="-fwritable-strings -g  -DX11 -I/usr/local2/include"  LDFLAGS="-L/usr/local2/lib   -lXmu -lX11 $(STUB) -lm -lg"  RANLIB=ranlib  $(TARGET)


#  AIM without X11 displays.
#  A noplot version for compilation on a machine without X11 windows.
#  The defaults: CC=cc  CFLAGS=-O  LDFLAGS=-lm exclude Xlibs and -DX11,
#  i.e. X11 is undefined so that ifdef's in gen.c omit the X11 code.
#  The LIBS list excludes libglib.a, the MAIN list excludes model/review,
#  the LINKS list excludes the link /bin/review, and the TOOLS list excludes
#  the XTOOLS.
#  Eg:
#      make noplot                      gets default target `install'.
#      make TARGET=basetools noplot     gets target `basetools'.

noplot :
	@ make CC=cc CFLAGS=-O LDFLAGS=-lm  LIBS="$(MLIB) $(SLIB) $(FLIB) $(WLIB) $(OLIB)"  MAIN=model/gen LINK_AIM1="$(LINK_GEN1)"  TOOLS="$(WTOOLS) $(SPTOOLS)"  $(TARGET)


###########################################################################
########################################################################### 
# 
# PART III:  MAKE HELP
# 
# Help target

help : FORCE
	@ echo "Root makefile for AIM."
	@ echo "Usage:  1. make  [Args]  [Targets] "
	@ echo "        2. make  [Args]  [TARGET=Targets]  [Machine] "
	@ echo "        3. make  [Args]  [TARGET=Targets]  noplot"
	@ echo
	@ echo "ARGS:      Current value:"
	@ echo "CC         $(CC)                                  C compiler."
	@ echo "CFLAGS     $(CFLAGS)    Compiler flags."
	@ echo "LDFLAGS    $(LDFLAGS) Loader flags."
	@ echo "STUB       $(STUB)                                    Additional libs to resolve names."
	@ echo "MOUNT      $(MOUNT)                         Mount for AIM sccs."
	@ echo "RELEASE    $(RELEASE)      Source dir for AIM sources in sccs."
	@ echo "DATE       $(DATE)                                    Sccs get by date [year/month/day]."
	@ echo "TARFILE    $(TARFILE1) $(TARFILE2)         Filenames for tar files."
	@ echo "ADDRESS    $(ADDRESS)                                    Address(es) for email."
	@ echo "TARGET     $(TARGET)
	@ echo
	@ echo "TARGETS:   GENERAL (Default target is \`install'). "
	@ echo "main       Make main AIM executable, gen."
	@ echo "install    Make 'main' plus common links and basetools."
	@ echo "basetools  Make the basetool executables and put them in bin."
	@ echo "auxtools   Make the auxillary tools executables and put them in bin."
	@ echo "links      Install the most useful model links."
	@ echo "alllinks   Install all model links."
	@ echo "tar        Create compressed tar file of AIM file system."
	@ echo "doc        Create compressed tar file of AIM documentation. "
	@ echo "noplot     Install in X11-free environment: no graphics."
	@ echo
	@ echo "TARGETS:   APU     (For system maintenance at APU)"
	@ echo "release    Make 'install' with docs and demos from scratch (sccs)."
	@ echo "sources    Get sources from local sccs."
	@ echo "clean      Remove all objects, libraries, main programs, and links."
	@ echo "sccslinks  Create SCCS symbolic links to local sccs directories."
	@ echo "cleansccs  Remove SCCS symbolic links."
	@ echo "demo       Install demo stimuli files."
#	@ echo "mail       Email AIM file system to given address(es)."
	@ echo
	@ echo "MACHINE    (Default machine is \`sun'). "
	@ echo "sun	   SparcStation with cc and X11 in -I/usr/openwin/include"
	@ echo "sungcc     SparcStation with optimised gcc and X11 in -I/usr/openwin/include"
	@ echo "sgi        sgi Indy with cc and X11 in -I/usr/include/"
	@ echo "hp	   hp with cc and X11 in -I/usr/include/X11R4"
	@ echo "dec vax    Dec/Vax Station with cc and X11 in -I/usr/include/"
	@ echo "apucc	   SparcStation at APU with cc and X11 in -I/usr/local2/include/"
	@ echo "apugcc 	   SparcStation at APU with optimised gcc and X11 in -I/usr/local2/include/"
	@ echo "linux	   PC with gcc and X11 in -I/usr/include/"
	@ echo
###########################################################################