#******************************************************************************
#FILE:				$(MAKEDIR)/program
#LANGUAGE:			make
#SYSTEM:			UNIX
#USER-INTERFACE:	None
#DESCRIPTION
#	This Makefile tells how to compile a library.
#
#	A library subdirectory must contain the following directories:
#
#       ./documentation     the documentation directory,
#		./interfaces		the interfaces directory,
#		./sources			the sources directory.
#
#	Input variables are:
#
#       $(MAKEDIR)      where the makefiles are located.
#
#       $(PREFIX)   where the libraries are installed.
#                       It will be created a subdirectory in this
#                       $(PREFIX) for each library compiled by
#                       this makefile.
#
#       $(TARGET)       the name of the platform on which we're compiling.
#                       This is just used to include platform specific
#                       makefile rules.
#
#		$(MODULE)		the name of this library.
#
#       $(INTERFACES)   the list of interfaces in ../interfaces/ that must be
#                       installed.
#
#       $(DOCUMENTATION) the list of documentation files in ../documentation/
#                       that must be installed.
#
#		$(CSOURCES)		the list of C sources in ../sources/.
#
#		$(CPLUSSOURCES)	the list of C++ sources in ../sources/.
#
#		$(OBJECTS)		the list of .o files to be inserted into the library.
#
#		$(INCLUDES)		the list of includes -I options to compile the module.
#
#		$(LIBRARIES)	the list of libraries to link with.
#
#	Output:
#
#		$(PREFIX)/bin/$(PROGRAM)	the executable.
#
#AUTHORS
#	<PJB> Pascal J. Bourguignon
#MODIFICATIONS
#	1992/09/28 <PJB> Nouvelle version simplifiee.
#	1993/05/02 <PJB> Moved -Wall to ~/src/common/makedir/target
#	1993/09/26 <PJB> Made library and program Makefile includes from
#					 previous module Makefile.
#   2001-06-19 <PJB> Reorganized and simplified.
#LEGAL
#	Copyright Pascal J. Bourguignon 1992 - 2001
#
#   This script is free software; you can redistribute it and/or
#   modify it under the terms of the GNU  General Public
#   License as published by the Free Software Foundation; either
#   version 2 of the License, or (at your option) any later version.
#
#   This script is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   General Public License for more details.
#
1#   You should have received a copy of the GNU General Public
#   License along with this library; see the file COPYING.LIB.
#   If not, write to the Free Software Foundation,
#   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#******************************************************************************
include $(MAKEDIR)/common-targets
.PHONY :: program

PROGRAM=$(MODULE)
all:: $(PROGRAM)
	@echo "makedir/program is deprecated. Use makedir/common instead." ; exit 1

-include $(MAKEDIR)/target$(TARGET)
include $(MAKEDIR)/common

$(COMMON_TARGETS) program ::
	@$(CHECK_MODULE)
	@if [ -z "$(TARGET)" ] ; then \
		TARGET=`$(MAKEDIR)/distribution|awk '{print $$1}'` \
		MAKEDIR=$(MAKEDIR) \
		PREFIX=$(PREFIX) \
		MODULE=$(MODULE) \
		$(MAKE) $(MFLAGS) $@ ;\
	fi

clean::
	-@rm -f *.o *~

cleanall::
	-@[ -n "$(PROGRAM)" ] && rm -f $(PROGRAM)

help::

BINIDIR=$(PREFIX)/bin
install:: makedirs
	[ -n "$(PROGRAM)" ] && install -m 755 $(PROGRAM) $(BINIDIR)/ || true
#	@cd ../documentation ; for file in $(DOCUMENTATION) CVS ; do \
#		[ $$file = CVS ] || cp -p $$file $(DOCIDIR)/ ; done


makedirs::
	@if [ -z "$(PREFIX)" ] ; then \
		echo "ERROR: Please define the PREFIX environment variable." ;\
		exit 1 ;\
	fi
	umask 022 ; mkdir -p $(PREFIX)/bin 2>/dev/null || true

showvars::
	@echo "   PROGRAM = $(PROGRAM)"
	@echo "   BINIDIR = $(BINIDIR)"


program $(PROGRAM): $(OBJECTS)  $(LIBRARIES)
	[ -n "$(PROGRAM)" ] && $(CC) $(LDFLAGS) $(TARGET_LDFLAGS) -o $(PROGRAM) $(OBJECTS) $(LIBRARIES) || true


# This is for Emacs.
# Local Variables:
# indent-tabs-mode: t
# mode: makefile
# End:

#### program                          -- 2004-01-20 01:15:39 -- pascal   ####
ViewGit