
#
# $Id: Makefile,v 1.5 93/11/27 15:42:10 panos Exp $
#

#
# Makefile targets:
#		install:			install the libraries
#		uninstall:		uninstall the libraries
#		clean:			clean up
#

#
# LIBNAMES is the list of library names that will be compiled.
# It may include any of the following:
#		sio, str, xlog, misc, pset, fsma, dict, pq, timer
#
# Note that the order is important, so if you choose not to compile some
# of the libraries, the relative order of the ones you do compile should
# not change.
#
LIBNAMES		= sio str xlog misc pset fsma dict pq timer

#
# LIBDIR			: directory where the ".a" libraries will be installed
# INCLUDEDIR	: directory where the library include files will be installed
# MANDIR			: directory where the library man pages will be installed
#
LIBDIR		= ../../lib
INCLUDEDIR	= ../../include
MANDIR		= ../../man

DEBUG			= -g -O		# either -g or -O

#
# On System V systems, you should set RANLIB to "true" since "ar" does
# its job.
# On SVR4 systems (like Solaris 2.x), you should set INSTALL to
# "/usr/ucb/install -c"
# If your system does not have an 'install' command, set INSTALL to "cp"
#
RANLIB		= ranlib
INSTALL		= install -c
FMODE			= -m 644

#
# SYSINC specified the absolute pathname for a directory that has shadow system 
# include files (for example, -I/homes/user/clone).
# Check the INSTALL file for more info about this.
#
SYSINC		=

#######################################################################
#
# This section of the Makefile has instructions on what preprocessor
# flags need to be set for compiling the libraries. Specifically,
# there are instructions on how to set the following variables:
#
#		SIO_DEFS			: preprocessor flags for the SIO library
#		TIMER_DEFS		: preprocessor flags for the TIMER library
#		XLOG_DEFS		: preprocessor flags for the XLOG library
#		MISC_DEFS		: preprocessor flags for the MISC library
#
# The proper flag settings are provided for the following operating systems:
#
#		SunOS 4.x, SunOS 5.x (aka Solaris 2.x), Ultrix 4.x 
#
#######################################################################

#
# The SIO library is the most OS-dependent part of the distribution, so
# unless your system is not among those listed below, you should read the 
# README file in the SIO source directory before proceeding.
# For SunOS 4.x, use:
#		-DHAS_MMAP -DHAS_ONEXIT -DHAS_MEMOPS -DHAS_ISATTY
# For SunOS 5.x (aka, Solaris 2.x), use
#		-DHAS_MMAP -DHAS_ATEXIT -DHAS_MEMOPS -DHAS_ISATTY
# For Ultrix 4.x, use:
#		-DHAS_MEMOPS -DHAS_ATEXIT -DHAS_ISATTY
# If your system is POSIX-compatible, use
#		-DHAS_MEMOPS -DHAS_ATEXIT -DHAS_ISATTY
#
SIO_DEFS		= -DHAS_MMAP -DHAS_ONEXIT -DHAS_MEMOPS -DHAS_ISATTY

#
# Possible flags for the TIMER library:
#
#	NO_POSIX_SIGS		: 	the system does not support POSIX signals (but it does
#								support the sigvec(2) interface).
#	NO_ITIMER_REAL		:	do not use the ITIMER_REAL timer
#	NO_ITIMER_VIRTUAL	:	do not use the ITIMER_VIRTUAL timer
#	NO_ITIMER_PROF		:	do not use the ITIMER_PROF timer
#
# The last two flags are useful for systems that do not support the getrusage
# system call.
# For SunOS 4.x, use
#		-DNO_POSIX_SIGS
# For SunOS 5.x (aka, Solaris 2.x), use
#		-DNO_ITIMER_VIRTUAL -DNO_ITIMER_PROF
# For Ultrix 4.x, use
#		-DNO_POSIX_SIGS
#
TIMER_DEFS	= -DNO_POSIX_SIGS

#
# Possible flags for the MISC library:
#
#	OLD_DIR				:	system supports the old BSD 4.2 directory(3)
#								interface (i.e. <sys/dir.h> must be included 
#								instead of <dirent.h>)
#	__FTWX_NO_FTW		:	<ftw.h> is not available
#
# For SunOS 4.x, SunOS 5.x, Ultrix 4.x do not set any of these flags.
# For POSIX-compatible systems, you don't need to set the OLD_DIR flag.
#	
MISC_DEFS	= -D__FTWX_NO_FTW

#
# Possible flags for the XLOG library:
#
#	NO_SYSLOG			:	do not use syslog(3)
#	SYSLOG_IN_SYS		:	the proper syslog.h file is in /usr/include/sys
#
# For SunOS 4.x, SunOS 5.x do not set any of these flags.
# For Ultrix 4.x, use
#		-DSYSLOG_IN_SYS
#
XLOG_DEFS	=


#
# SRCDIR is where the source code for the libraries can be found (for
# example the source for STR should be in $SRCDIR/str).
# You shouldn't need to change this variable.
#
SRCDIR		= libs/src

CC = gcc

#----------------------------------------------------------------------
#
# Do not change anything in this section of the makefile
#
#----------------------------------------------------------------------

LIB_DEFS		= $(SIO_DEFS) $(XLOG_DEFS) $(MISC_DEFS) $(TIMER_DEFS) $(SYSINC)

install:
	@cd $(SRCDIR) ;\
	for i in $(LIBNAMES) ; do ( cd $$i ; make "DEBUG=$(DEBUG)" "DEFS=$(LIB_DEFS)" LIBDIR=$(LIBDIR) INCLUDEDIR=$(INCLUDEDIR) MANDIR=$(MANDIR) RANLIB=$(RANLIB) "INSTALL=$(INSTALL)" "FMODE=$(FMODE)" CC=$(CC) install ; ) done


clean:
	@for i in $(LIBNAMES) ; do ( cd $(SRCDIR)/$$i ; make clean ; ) done


uninstall:
	@cd $(SRCDIR) ;\
	for i in $(LIBNAMES) ; do ( cd $$i ; make LIBDIR=$(LIBDIR) INCLUDEDIR=$(INCLUDEDIR) MANDIR=$(MANDIR) uninstall ) ; done

