# makefile
#
#  Usage:
#
#    make		make files, based only on time stamps
#    make clean		remove all generated files
#    make ffu		make, forcing file updates
#    make force		make everything (force some actions)
#
#  Notes:
#
#    This makefile is mostly a wrapper for e_ddf/makevile, which is created
#    by bin/ddf_y2d.  Both make[fv]iles look at the scripts, as well as the
#    input files.  This is a BIG win in the test cycle...
#
#    Some targets are always created (see FORCE, below), because they depend
#    on the results of actions (e.g., querying LATDocs, walking an AFS tree),
#    rather than files.
#
#
#    The file_update() function (in lib/fsw_docs.pl) doesn't write an output
#    file if an existing file already has the current content.  This keeps
#    make from doing extra work, at the cost of occasional erratic behavior.
#
#    To keep this under control, file_update treats the "force" value of
#    file_update specially, updating files even if the content won't change.
#    The variable gets set as follows:
#
#      "make force" and "make "ffu" set it to (a default value of) "force".
#      "make"                      sets it to (a default value of) "check".
#
#      bin/run sets it to "force", if any of the target files
#      (sent as args 2-N) are older than the command being run.
#
#    The make_type variable is set in a similar manner.  It is not
#    overridden by bin/run.
#
# Written by Rich Morin, rdm@slac.stanford.edu

#DDF    - path:     './makefile'
#DDF      desc:     'master make(1) file'
#DDF      label:    'makefile'
#DDF      shape:    'box'
#DDF      include:  'a_ddf/makevile'

forall = bin/run lib/fsw_docs.pl makefile

auto:			$(forall) bin/ddf_y2d
	file_update=check; export file_update;			\
	make_type=check;   export make_type;			\
	bin/run ddf_get;   bin/run ddf_y2m;			\
	make -f a_ddf/makevile

ffu:			$(forall) bin/ddf_y2d
	file_update=force; export file_update;			\
	make_type=check;   export make_type;			\
	bin/run ddf_get;   bin/run ddf_y2m;			\
	make -f a_ddf/makevile

force:			$(forall) bin/ddf_y2d
	file_update=force; export file_update;			\
	make_type=force;   export make_type;			\
	bin/run ddf_get;   bin/run ddf_y2m;			\
	make -f a_ddf/makevile first;				\
	make -f a_ddf/makevile

FORCE:

clean:			FORCE
	rm -rf a_*/*
