#******************************************************************************
#FILE:				$(MAKEDIR)/library
#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.
#
#	Output:
#
#		$(PREFIX)/$(MODULE)/interfaces/    the interface of the module,
#		$(PREFIX)/$(MODULE)/documentation/ the documentation of the module,
#		$(PREFIX)/$(MODULE)/libraries/     the libraries of the module.
#       $(PREFIX)/$(MODULE)/libraries/lib$(MODULE).a
#                                   where The module library will be installed.
#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 - 2003
#
#   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.
#
#   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 :: makedirs

LIBRARY=lib$(MODULE).a
all:: $(LIBRARY)
	@echo "makedir/library is deprecated. Use makedir/common instead." ; exit 1

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


$(COMMON_TARGETS) makedirs ::
	@ $(CHECK_MODULE) ; $(CHECK_TARGET)

$(LIBRARY): $(OBJECTS)
	-@rm -f                  $(LIBRARY)
	$(AR)     $(ARFLAGS)     $(LIBRARY) $(OBJECTS)
	$(RANLIB) $(RANLIBFLAGS) $(LIBRARY)


DOCIDIR=$(PREFIX)/lib/$(MODULE)/documentation
INTIDIR=$(PREFIX)/lib/$(MODULE)/interfaces
LIBIDIR=$(PREFIX)/lib/$(MODULE)/libraries

install:: makedirs
	cd ../documentation ; for file in $(DOCUMENTATION) CVS ; do \
		[ $$file = CVS ] || install -m 644 $$file $(DOCIDIR)/ ; done
	cd ../interfaces ; for file in $(INTERFACES) CVS ; do \
		[ $$file = CVS ] || install -m 644 $$file $(INTIDIR)/ ; done
	install -m 644 $(LIBRARY) $(LIBIDIR)/


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


clean::
	-@rm -f *.o

cleanall::
	-@rm -f $(LIBRARY)


showvars::
	@echo "   LIBRARY = $(LIBRARY)"
	@echo "   DOCIDIR = $(DOCIDIR)"
	@echo "   INTIDIR = $(INTIDIR)"
	@echo "   LIBIDIR = $(LIBIDIR)"




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

#### library                          -- 2004-01-20 01:15:36 -- pascal   ####
ViewGit