#############################################################################
#   $Source: /afs/cs.cmu.edu/project/TCA/Master/tcaV8/etc/GNUmakefile.std,v $
# $Revision: 1.24 $
#     $Date: 96/02/13 21:28:05 $
#   $Author: rich $
#    $State: Exp $
#   $Locker:  $
#
# PROJECT:	Task Control Architecture.
#
# FILE:		GNUmakefile.std
#		Based on Erebus prototypical Makefile
#		Modified for FRC as FRC pre-release version
#		Makefile.std.proto,v 1.10 1992/11/15 02:29:20 jwest Exp 
#
# DESCRIPTION:
#	This file should be included at the tail of the prototypical
#	Makefile.  It provides a set of "standard" and useful targets.
#
# EXPORTS:
#	The following targets are available:
#		all bins libs privs objs
#		clean install
#		lint depend
#		update add commit
#
# HISTORY:
#
# $Log:	GNUmakefile.std,v $
# Revision 1.24  96/02/13  21:28:05  rich
# Changes so old gmake on pmax machines will work.
# 
# Revision 1.23  1996/02/11  21:34:35  rich
# Updated GNUmakefiles for faster complilation.  Use FAST_COMPILE=1 for
# routine recompiles.
#
# Revision 1.22  1996/02/01  04:02:47  rich
# Generalized updateVersion and added recursion.
#
# Revision 1.21  1996/01/31  22:57:05  reids
# Added automatic updating of (micro) version control numbers
#
# Revision 1.20  1996/01/12  00:52:35  rich
# Simplified GNUmakefiles and removed some redundent complilation.
#
# Revision 1.19  1995/10/25  22:43:10  rich
# Fixed problem with using a non-afs directory on a machine with afs.
# This was caused by a new release of the afs program "fs".
#
# Revision 1.18  1995/08/06  01:51:24  rich
# Omit library targets if there are no libraries.
#
# Revision 1.17  1995/07/26  20:40:38  rich
# Fixed ranlib of .so. files and flags for .cc files.
#
# Revision 1.16  1995/07/08  18:23:54  rich
# Change all /afs/cs to /afs/cs.cmu.edu to get ride of conflict problems.
#
# Revision 1.15  1995/07/08  17:50:28  rich
# Linux Changes.  Also added GNUmakefile.defs.
#
# Revision 1.14  1995/06/05  23:56:59  rich
# Force export of CPATH and LPATH.
#
# Revision 1.13  1995/05/24  18:40:11  rich
# Fixed problem with the export of the shell variables.
#
# Revision 1.12  1995/04/04  19:40:59  rich
# Added sgi support.
# Fixed rule to compile module libs.
# Added some support for C++ programs.
#
# Revision 1.11  1995/03/18  15:10:39  rich
# Fixed updateVersion script so it can be run from any directory.
#
# Revision 1.10  1995/03/16  18:04:52  rich
# Merged in changes to the 7.9 branch.
# Changed the VERSION_ to TCA_VERSION_
#
# Revision 1.9  1995/01/18  22:56:11  rich
# Now look for cvs in /usr/local before /usr/misc.
#
# Revision 1.8  1994/11/02  22:51:25  rich
# Removed extre rm from building of ftp files.
#
# Revision 1.7  1994/11/02  21:24:55  rich
# Now works for linux machines (i486).
# Got afs to work on alpha (and hopefully other vendor OS's)
#
# Revision 1.6  1994/05/25  04:50:12  rich
# Added support for sun4m_411.
# Tags now includes the tutorial and tutorial/simuator files.
#
# Revision 1.5  1994/05/20  23:33:57  rich
# Now correctly creates dependencies for object files in obj, lispObj and
# sharedObj.
#
# Revision 1.4  1994/05/17  23:11:42  rich
# Made the target "clean" handler some default junk  files.
#
# Revision 1.3  1994/05/06  07:10:25  rich
# Add don't care to cvs commands.
#
# Revision 1.2  1994/05/06  05:15:07  rich
# Removed duplicate log entries.
# Fixed TAGS file generation.
#
# Revision 1.1  1994/05/06  04:45:08  rich
# Added a GNUmakefile and other utilities to this directory.
#
#############################################################################

# All source files
SRCS_ALL	:= $(INCS) $(PRIVATE_INCS) $(SRCS) $(MANS) $(DOCS) $(MISC)

# Files never to be removed, even if Make encounters an error
.PRECIOUS: $(SRCS_ALL) $(SUBDIRS)

# make sure everyone is using the same default paths.
LPATH=:/usr/cs/lib:/usr/lib:/usr/misc/lib
CPATH=:/usr/misc/include

# C++ support
.SUFFIXES: suffixes .cc .cxx .gz

.cc:
	$(LINK.cc) -o $@ $< $(LDLIBS)
.cc.o:
	$(COMPILE.cc) -o $@ $< $(CPP_LIBRARIES)
.cxx:
	$(LINK.c) -o $@ $< $(LDLIBS)
.cxx.o:
	$(COMPILE.c) -o $@ $<
.c.o:
	$(COMPILE.c) -o $@ $<
.c:
	$(LINK.c) -o $@ $< $(LIBRARIES)
.o:
	$(LINK.c) -o $@ $< $(LIBRARIES)

# Automatic defs to aid install target
INS_PUBLIC_BINS	:= $(patsubst %,$(PUBLIC_BIN_DIR)/%,$(PUBLIC_BINS))
#INS_PUBLIC_LIBS	:= $(patsubst %,$(PUBLIC_LIB_DIR)/%,$(filter libtca.so.%,$(PUBLIC_LIBS)))
#INS_PUBLIC_LIBSA:= $(patsubst %,$(PUBLIC_LIB_DIR)/%,$(filter-out libtca.so.%,$(PUBLIC_LIBS)))
INS_PUBLIC_LIBS	:= $(patsubst %,$(PUBLIC_LIB_DIR)/%,$(PUBLIC_LIBS))
INS_PUBLIC_LINTS:= $(patsubst %,$(PUBLIC_LINT_DIR)/%,$(PUBLIC_LINTS))
INS_PUBLIC_INCS	:= $(patsubst %,$(PUBLIC_INC_DIR)/%,$(PUBLIC_INCS))
INS_PUBLIC_MANS1:= $(patsubst %.1,$(PUBLIC_MAN_DIR)1/%.1,$(filter %.1,$(PUBLIC_MANS)))
INS_PUBLIC_MANS3:= $(patsubst %.3,$(PUBLIC_MAN_DIR)3/%.3,$(filter %.3,$(PUBLIC_MANS)))
INS_PUBLIC_DOCS	:= $(patsubst %,$(PUBLIC_DOC_DIR)/%,$(PUBLIC_DOCS))

INS_MODULE_LIBS	:= $(patsubst %,$(MODULE_LIB_DIR)/%,$(MODULE_LIBS))
INS_MODULE_LINTS:= $(patsubst %,$(MODULE_LINT_DIR)/%,$(MODULE_LINTS))
INS_MODULE_DOCS:= $(patsubst %,$(MODULE_DOC_DIR)/%,$(MODULE_DOCS))
INS_MODULE_INCS	:= $(patsubst %,$(MODULE_INC_DIR)/%,$(MODULE_INCS))

##########
# Standard Targets
##########

srcs: $(SRCS_ALL)
bins:: $(patsubst %,$(BDIR)/%,$(PUBLIC_BINS))
libs:: $(patsubst %,$(LDIR)/%,$(PUBLIC_LIBS))\
	 $(patsubst %,$(LDIR)/%,$(MODULE_LIBS))\
	 $(PUBLIC_LINTS) $(MODULE_LINTS)
privs: $(PRIVS)
objs: $(OBJS)

clean::
	-$(RM) $(DELETES);
	-$(RM) $(wildcard .nse_dep*)
	-$(RM) $(wildcard *.CKP)
	-$(RM) $(wildcard \#*\#)
	-$(RM) $(wildcard *~)
	-$(RM) $(wildcard .*~)
	-$(RM) $(wildcard *.CKP)
	-$(RM) $(wildcard *.BAK)
	-$(RM) $(wildcard .*.BAK)

ifdef SUBDIRS
clean:: 
	-(for sub in $(SUBDIRS); do \
	  (if [ -d $$sub ]; then \
	    cd $$sub; $(MAKE) clean; fi;) \
	done;)
endif

##########
# Source file dependencies
##########

MAKEDEPEND	= makedepend

MDFLAGS = $(CPPFLAGS) $(DEPEND_FLAGS)

ifdef DEPEND_FILE
  ifdef DEPEND_PREFIX
# Should really be 
# $(DEPEND_FILE): $(SRCS) $(INCS) $(PRIVATE_INCS)
# But that causes the depend file to be rebuilt every time.
depend:: 
	-$(RM) $(DEPEND_FILE)
	echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > $(DEPEND_FILE)
	-for pre in $(DEPEND_PREFIX); do \
	  $(MAKEDEPEND) -a -p$$pre -f$(DEPEND_FILE) -- $(MDFLAGS) -- $(SRCS); \
	done;
  else
depend::
	-$(RM) $(DEPEND_FILE)
	echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > $(DEPEND_FILE)
	-$(MAKEDEPEND) -f$(DEPEND_FILE) -- $(MDFLAGS) -- $(SRCS)
  endif
endif

ifdef SUBDIRS
depend:: 
	-(for sub in $(SUBDIRS); do \
	  (if [ -d $$sub ]; then \
	    echo "Making depend for: $$sub";\
	    cd $$sub; $(MAKE) depend; fi;) \
	done;)
endif

# Method of removing dependancies that vary from machine to machine.

ifdef SUBDIRS
clean_depend:: 
	for sub in $(SUBDIRS); do \
	( if [ -d $$sub ]; then \
	  echo "Cleaning depend for: $$sub";\
	  cd $$sub; $(MAKE) clean_depend; fi;) \
	done;
endif

ifdef DEPEND_FILE
clean_depend:: 
	-$(RM) $(DEPEND_FILE)
endif

lint: $(SRCS) $(PUBLIC_INCS) $(MODULE_INCS) $(PRIVATE_INCS)
	$(LINT.c) $(SRCS)

##########
#install rules
##########

install:: $(INSTALL_DIR)/$(BDIR)/.force $(INSTALL_DIR)/$(LDIR)/.force

install:: install_incs install_libs install_bins install_mans install_docs

install:: srcs

#ifdef SUBDIRS
#install:: 
#	for sub in $(SUBDIRS); do \
#	(if [ -d $$sub ]; then \
#	    echo "Making install for: $$sub";\
#	    cd $$sub; $(MAKE) install; fi;) \
#	done;
#endif

install_incs:: $(INS_PUBLIC_INCS) $(INS_MODULE_INCS)
ifdef SUBDIRS
install_incs:: 
	for sub in $(SUBDIRS); do \
	(if [ -d $$sub ]; then \
	    echo "Making install_incs for: $$sub";\
	    cd $$sub; $(MAKE) install_incs; fi;) \
	done;
endif

install_libs:: $(INSTALL_DIR)/$(LDIR)/.force
ifneq ($(PUBLIC_LIBS),)
libs:: $(LDIR)/.force
install_libs:: $(LDIR)/.force
  ifdef DEPEND_PREFIX
  libs:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  install_libs:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  endif
endif
ifneq ($(MODULE_LIBS),)
libs:: $(LDIR)/.force
install_libs:: $(LDIR)/.force
  ifdef DEPEND_PREFIX
  libs:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  install_libs:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  endif
endif
install_libs:: $(INS_PUBLIC_LIBS) $(INS_PUBLIC_LINTS)\
	      $(INS_MODULE_LIBS) $(INS_MODULE_LINTS)
ifdef SUBDIRS
install_libs:: 
	for sub in $(SUBDIRS); do \
	(if [ -d $$sub ]; then \
	    echo "Making install_libs for: $$sub";\
	    cd $$sub; $(MAKE) install_libs; fi;) \
	done;
endif

ifneq ($(PUBLIC_BINS),)
bins:: $(BDIR)/.force
install_bins:: $(BDIR)/.force
  ifdef DEPEND_PREFIX
  bins:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  install_bins:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  endif
endif
ifneq ($(PRIVS),)
bins:: $(BDIR)/.force
install_bins:: $(BDIR)/.force
  ifdef DEPEND_PREFIX
  bins:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  install_bins:: $(patsubst %,%.force,$(DEPEND_PREFIX))
  endif
endif
install_bins:: $(INSTALL_DIR)/$(BDIR)/.force
install_bins:: $(INS_PUBLIC_BINS) install_mans install_docs
ifdef SUBDIRS
install_bins:: 
	for sub in $(SUBDIRS); do \
	(if [ -d $$sub ]; then \
	    echo "Making install_bins for: $$sub";\
	    cd $$sub; $(MAKE) install_bins; fi;) \
	done;
endif

install_mans: $(INS_PUBLIC_MANS)

install_docs: $(INS_PUBLIC_DOCS) $(INS_MODULE_DOCS)

.PHONY: srcs bins libs privs objs clean depend clean_depend lint tags \
	install install_bins install_libs install_incs install_mans \
	install_docs msg link_tar ftp tar commit do_commit do_version_update

#install rules for public and module files.

ifdef INS_PUBLIC_BINS
$(INS_PUBLIC_BINS): $(PUBLIC_BIN_DIR)/%: $(BDIR)/%
	-mkdir $(PUBLIC_BIN_DIR)
	$(INSTALL) $(INS_BIN_FLAGS) $(BDIR)/$(@F).exe $(PUBLIC_BIN_DIR)
	$(RM) $(BDIR)/$(@F).exe
endif

ifdef INS_PUBLIC_LIBS

ifneq ($(filter $(PUBLIC_LIB_DIR)/libtca.so.%,$(INS_PUBLIC_LIBS)),)
$(filter $(PUBLIC_LIB_DIR)/libtca.so.%,$(INS_PUBLIC_LIBS)): $(PUBLIC_LIB_DIR)/%: $(LDIR)/%
	-mkdir $(PUBLIC_LIB_DIR)
	$(INSTALL) $(INS_LIB_FLAGS) $(LDIR)/$(@F) $(PUBLIC_LIB_DIR)
	$(RM) $(LDIR)/$(@F)
	chmod 444 $@
endif

ifneq ($(filter-out $(PUBLIC_LIB_DIR)/libtca.so.%,$(INS_PUBLIC_LIBS)),)
$(filter-out $(PUBLIC_LIB_DIR)/libtca.so.%,$(INS_PUBLIC_LIBS)): $(PUBLIC_LIB_DIR)/%: $(LDIR)/%
	-mkdir $(PUBLIC_LIB_DIR)
	$(INSTALL) $(INS_LIB_FLAGS) $(LDIR)/$(@F) $(PUBLIC_LIB_DIR)
	$(RM) $(LDIR)/$(@F)
	$(RANLIB) $@
	chmod 444 $@
endif
endif

ifdef INS_PUBLIC_LINTS
$(INS_PUBLIC_LINTS): $(PUBLIC_LINT_DIR)/%: %
	-mkdir $(PUBLIC_LINT_DIR)
	$(INSTALL) $(INS_LINT_FLAGS) $(@F) $(PUBLIC_LINT_DIR)
endif

ifdef INS_PUBLIC_INCS
$(INS_PUBLIC_INCS): $(PUBLIC_INC_DIR)/%: %
	-mkdir $(PUBLIC_INC_DIR)
	$(INSTALL) $(INS_INC_FLAGS) $(@F) $(PUBLIC_INC_DIR)
endif

ifdef INS_PUBLIC_MANS
$(INS_PUBLIC_MANS): $(PUBLIC_MAN_DIR)1/%: %
	-mkdir -p $(PUBLIC_MAN_DIR)1
	$(INSTALL) $(INS_MAN_FLAGS) $(@F) $(PUBLIC_MAN_DIR)1

$(INS_PUBLIC_MANS): $(PUBLIC_MAN_DIR)3/%: %
	-mkdir -p $(PUBLIC_MAN_DIR)3
	$(INSTALL) $(INS_MAN_FLAGS) $(@F) $(PUBLIC_MAN_DIR)3
endif

ifdef INS_PUBLIC_DOCS
$(INS_PUBLIC_DOCS): $(PUBLIC_DOC_DIR)/%: %
	-mkdir $(PUBLIC_DOC_DIR)
	$(INSTALL) $(INS_DOC_FLAGS) $(@F) $(PUBLIC_DOC_DIR)
endif

ifdef INS_MODULE_DOCS
$(INS_MODULE_DOCS): $(MODULE_DOC_DIR)/%: %
	-mkdir -p $(MODULE_DOC_DIR)
	$(INSTALL) $(INS_DOC_FLAGS) $(@F) $(MODULE_DOC_DIR)
endif

ifdef INS_MODULE_LIBS
$(INS_MODULE_LIBS): $(MODULE_LIB_DIR)/%: $(LDIR)/%
	-mkdir $(MODULE_LIB_DIR)
	$(INSTALL) $(INS_LIB_FLAGS) $(LDIR)/$(@F) $(MODULE_LIB_DIR)
	$(RM) $(LDIR)/$(@F)
	$(RANLIB) -t $@
	chmod 444 $@
endif

ifdef INS_MODULE_LINTS
$(INS_MODULE_LINTS): $(MODULE_LINT_DIR)/%: %
	-mkdir $(MODULE_LINT_DIR)
	$(INSTALL) $(INS_LINT_FLAGS) $(@F) $(MODULE_LINT_DIR)
endif

ifdef INS_MODULE_INCS
$(INS_MODULE_INCS): $(MODULE_INC_DIR)/%: %
	-mkdir $(MODULE_INC_DIR)
	$(INSTALL) $(INS_INC_FLAGS) $(@F) $(MODULE_INC_DIR)
endif

##########
# Simple Recursion
##########

ifdef SUBDIRS
all:: 
	for sub in $(SUBDIRS); do \
	  (if [ -d $$sub ]; then \
	    echo "Making all for: $$sub";\
	    cd $$sub; $(MAKE) all; fi;) \
	done;
endif

##########
# Tags files
##########

tags::
	-etags $(SRCS_ALL) $(wildcard */*.[hc]) $(wildcard */*/*.[hc]) $(wildcard */GNUmakefile) $(wildcard */*/GNUmakefile)
	-etags -a $(wildcard *akefile) $(wildcard */GNUmakefile) $(wildcard */*/GNUmakefile)

ifdef SUBDIRS
tags::
	for sub in $(SUBDIRS); do \
	  (if [ -d $$sub ]; then \
	    echo "Making tags for: $$sub";\
	    cd $$sub; $(MAKE) tags; fi;) \
	done;
endif

##########
# CVS related stuff
##########

update: $(CVS_COMMIT_LOG)
	-$(CVS_BIN)/cvs update

ifdef SUBDIRS
add:: 
	echo "Ignore warnings if there are no subdirectories."
	-(for sub in $(SUBDIRS); do \
		if [ -d $$sub/CVS ] ; then echo $$sys already added; \
		else (echo "y" | $(CVS_BIN)/cvs add $$sub); fi;\
	done;)
	-(for sub in $(SUBDIRS); do \
	  (if [ -d $$sub ]; then \
	    echo "Making add for: $$sub";\
	    cd $$sub; $(MAKE) add; fi;) \
	done;)
endif

add:: $(SRCS_ALL)
	echo "Ignore warnings about files already present in the archive."
	-($(CVS_BIN)/cvs add $(SRCS_ALL))

diff: $(SRCS) $(INCS) $(PRIVATE_INCS) $(CVS_COMMIT_LOG)
	echo "*********************" > /dev/null
	echo "Changes you have made" > /dev/null
	echo "*********************" > /dev/null
	-$(CVS_BIN)/cvs diff
	echo "********************************" > /dev/null
	echo "Changes you and others have made" > /dev/null
	echo "********************************" > /dev/null
	-$(CVS_BIN)/cvs diff -D now

status: $(SRCS) $(INCS) $(PRIVATE_INCS) $(CVS_COMMIT_LOG)
	echo "*********************" > /dev/null
	echo "Status of your files." > /dev/null
	echo "*********************" > /dev/null
	-$(CVS_BIN)/cvs status

UPDATE_VERSION := $(shell ls $(INSTALL_DIR)/etc/updateVersion $(PROJECT_DIR)/etc/updateVersion 2>/dev/null | grep -v "not found" | head -1)

ifdef VERSION_FILE
do_version_update::
	-(if $(CVS_BIN)/cvs diff -q>/dev/null; then\
	  echo $(MODULE_DIR) "Version number up to date.";\
	else\
	  $(UPDATE_VERSION) $(INSTALL_DIR) $(MODULE_DIR) $(VERSION_FILE) $(VERSION_PREFIX);\
	  fi)
else
do_version_update::
	echo $(MODULE_DIR) "No version to update."
endif

ifdef SUBDIRS
do_version_update::
	-(for sub in $(SUBDIRS); do \
	  (if [ -d $$sub ]; then \
	    echo "Making version_update for: $$sub";\
	    cd $$sub; $(MAKE) do_version_update; fi;) \
	done;)
endif

do_commit: $(SRCS) $(INCS) $(PRIVATE_INCS) do_version_update
	-$(CVS_BIN)/cvs commit

commit: do_commit release depend

##########
# Release
##########

release:
	-cd $(PROJECT_RELEASE_DIR); \
	$(CVS_BIN)/cvs checkout -d $(VERSION_DIR) tca; \
	cd $(VERSION_DIR); \
	$(MAKE) -f GNUmakefile depend install

##############
# Create the obj, bin and lib and code directories.
##############

$(ODIR)/.force $(SODIR)/.force $(LODIR)/.force $(VODIR)/.force $(LDIR)/.force $(BDIR)/.force:
	-(if $(IS_AFS); then \
	  (sys=$(AFS_TYPE);\
	  if (cd .$(patsubst %/.force,%,$@).$$sys); then echo .$(patsubst %/.force,%,$@).$$sys exists;\
	   else mkdir .$(patsubst %/.force,%,$@).$$sys;\
	   fi;\
	  if (cd $(patsubst %/.force,%,$@)); then echo $(patsubst %/.force,%,$@) already linked;\
	   else echo making link; ln -s .$(patsubst %/.force,%,$@).@sys $(patsubst %/.force,%,$@); \
	  fi;)\
	else \
		mkdir $(patsubst %/.force,%,$@); fi)
	echo `date` > $@

ifneq ($(INSTALL_DIR),.)
$(INSTALL_DIR)/$(BDIR)/.force:
	-if $(IS_AFS); then \
	 (sys=$(AFS_TYPE);\
	  cd $(INSTALL_DIR);\
	  if (cd .$(BDIR).$$sys); then echo .$(BDIR).$$sys exists;\
	   else mkdir .$(BDIR).$$sys;\
	   fi;\
	  if (cd $(BDIR)); then echo $(BDIR) already linked;\
	   else echo making link; ln -s .$(BDIR).@sys $(BDIR); \
	   fi;)\
	else \
		mkdir $(INSTALL_DIR)/$(BDIR); fi;\
	echo `date` > $(INSTALL_DIR)/$(BDIR)/.force
endif

ifneq ($(INSTALL_DIR),.)
$(INSTALL_DIR)/$(LDIR)/.force:
	-if $(IS_AFS); then \
	 (sys=$(AFS_TYPE);\
	  cd $(INSTALL_DIR);\
	  if (cd .$(LDIR).$$sys); then echo .$(LDIR).$$sys exists;\
	   else mkdir .$(LDIR).$$sys;\
	   fi;\
	  if (cd $(LDIR)); then echo $(LDIR) already linked;\
	   else echo making link; ln -s .$(LDIR).@sys $(LDIR); \
	   fi;)\
	else \
		mkdir $(INSTALL_DIR)/$(LDIR); fi;\
	echo `date` > $(INSTALL_DIR)/$(LDIR)/.force
endif

#
# want to have code is a separate directory so we can keep multiple versions.
#

$(ODIR)/%.o: %.c
	$(COMPILE.c) -o $@ $<

$(ODIR)/%.o: %.cc
	$(COMPILE.cc) -o $@ $<

$(BDIR)/%: $(ODIR)/%.o $(LIBDEP)
	$(LINK.c) -o $@ $< $(LIBRARIES)

##########
# Exports
##########

export LPATH=:/usr/cs/lib:/usr/lib:/usr/misc/lib
export CPATH=:/usr/misc/include
.EXPORT: LPATH
.EXPORT: CPATH

# other exports, that need to be force evaluated.
export MODULE_DIR := $(MODULE_DIR)
.EXPORT: MODULE_DIR
export SRCS_ALL := $(SRCS_ALL)
.EXPORT: SRCS_ALL
export AFS_TYPE := $(AFS_TYPE)
.EXPORT: AFS_TYPE

#other exports.
#export   XMACHINE XBASE_DIR PROJECT_DIR STD_FILE DEFS_FILE BASE_DIR THIS_OS
#.EXPORT: XMACHINE XBASE_DIR PROJECT_DIR STD_FILE DEFS_FILE BASE_DIR THIS_OS

#export   THIS_MACHINE THIS_HOST CVS_BIN CVSROOT IS_AFS
#.EXPORT: THIS_MACHINE THIS_HOST CVS_BIN CVSROOT IS_AFS

# This should export everything.
.EXPORT_ALL_VARIABLES:

##########
# Include a dependency file, if there is one.
##########

ifneq '$(DEPEND_FILE)' ""
  ifneq '$(wildcard $(DEPEND_FILE))' ""
    include $(DEPEND_FILE)
  else
     MSG_sun4c = "*** Do 'gmake depend' to create a dependency file ***"
  endif
endif
