#
#   Copyright 2008 Free Software Foundation, Inc.
#
#  This program 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 3 of the License, or
#  (at your option) any later version.
#
#  This program 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 program.  If not, see <http://www.gnu.org/licenses/>.
#
# ----------------------------------------------------------------------
#		Makefile for main library
#-----------------------------------------------------------------------
#

SHELL		=	/bin/sh
@SET_MAKE@
prefix		=	@prefix@
exec_prefix	=	@exec_prefix@
AR		=	ar
CC		=	@CC@
PARENT		=	..
BASE		=	../..
HDRS		=	$(PARENT)/hdrs
CCFLAGS		=	-O @gcc_useful_options@ @funny_compiler_options@ @lib_pic@
CFLAGS		=	$(CCFLAGS) -I$(HDRS) -I$(BASE)
LIBDIR		=	@libdir@
LDSHARED	=	ld -shared -o
LIB		=	libgnuspool_int.a
SHLIB		=	libgnuspool_int.so
SHLIBCURS	=	libgnuspool_curs.so
RM		=	rm -f
INSTALL		=	@INSTALL@
INSTALL_DATA	=	@INSTALL_DATA@

OBJECTS=xfershm.o 	spath.o 	shutilmsg.o	saveopts.o \
 	runpwd.o	rptrlist.o	rjoblist.o	rdpgfile.o \
	qmatch.o	ptrshm.o	produser.o 	prin_size.o \
	optprocess.o	open_cfile.o	op_icf.o	net_feed.o \
	mkspid.o	makeovec.o	make_km.o	jobshm.o \
	issubset.o	hextoi.o	hex_disp.o	helpnstate.o \
	helphdr.o	helpargs.o	gprompt.o	getspuser.o \
	extdefs.o	doenv.o		cgiuser.o	cgifndjb.o \
	calccharge.o	sortp.o		readu.o		rdoptfile.o \
	matchrouts.o	makevec.o	look_host.o	insertu.o \
	htmllib.o	helpprmpt.o	doopts.o	disperror.o \
	ncstrncmp.o	helpvec.o	helprdn.o	help_readl.o \
	mmangle.o	prin_uname.o	prin_gname.o	envprocess.o \
	strread.o	stringvec.o	stracpy.o	versionprint.o
CURSOBJS=wnum.o\
	 whexnum.o\
	 whdrstr.o\
	 wgets.o\
	 setkey.o\
	 getkey.o

all:	@main_target@

nonshared:	$(LIB)
	@RANLIB@ $(LIB)

shared: $(SHLIB) $(SHLIBCURS)
	$(AR) crv $(LIB) $(CURSOBJS) $(OBJECTS)
	@RANLIB@ $(LIB)
	$(RM) $(OBJECTS) $(CURSOBJS)

$(LIB):	$(LIB)(xfershm.o)\
	$(LIB)(wnum.o)\
	$(LIB)(whexnum.o)\
	$(LIB)(whdrstr.o)\
	$(LIB)(wgets.o)\
	$(LIB)(spath.o)\
	$(LIB)(shutilmsg.o)\
	$(LIB)(setkey.o)\
	$(LIB)(saveopts.o)\
	$(LIB)(runpwd.o)\
	$(LIB)(rptrlist.o)\
	$(LIB)(rjoblist.o)\
	$(LIB)(rdpgfile.o)\
	$(LIB)(qmatch.o)\
	$(LIB)(ptrshm.o)\
	$(LIB)(produser.o)\
	$(LIB)(prin_size.o)\
	$(LIB)(optprocess.o)\
	$(LIB)(open_cfile.o)\
	$(LIB)(op_icf.o)\
	$(LIB)(net_feed.o)\
	$(LIB)(mkspid.o)\
	$(LIB)(makeovec.o)\
	$(LIB)(make_km.o)\
	$(LIB)(jobshm.o)\
	$(LIB)(issubset.o)\
	$(LIB)(hextoi.o)\
	$(LIB)(hex_disp.o)\
	$(LIB)(helpnstate.o)\
	$(LIB)(helphdr.o)\
	$(LIB)(helpargs.o)\
	$(LIB)(gprompt.o)\
	$(LIB)(getspuser.o)\
	$(LIB)(getkey.o)\
	$(LIB)(extdefs.o)\
	$(LIB)(doenv.o)\
	$(LIB)(cgiuser.o)\
	$(LIB)(cgifndjb.o)\
	$(LIB)(calccharge.o)\
	$(LIB)(sortp.o)\
	$(LIB)(readu.o)\
	$(LIB)(rdoptfile.o)\
	$(LIB)(matchrouts.o)\
	$(LIB)(makevec.o)\
	$(LIB)(look_host.o)\
	$(LIB)(insertu.o)\
	$(LIB)(htmllib.o)\
	$(LIB)(helpprmpt.o)\
	$(LIB)(doopts.o)\
	$(LIB)(disperror.o)\
	$(LIB)(ncstrncmp.o)\
	$(LIB)(helpvec.o)\
	$(LIB)(helprdn.o)\
	$(LIB)(help_readl.o)\
	$(LIB)(mmangle.o)\
	$(LIB)(prin_uname.o)\
	$(LIB)(prin_gname.o)\
	$(LIB)(envprocess.o)\
	$(LIB)(strread.o)\
	$(LIB)(stringvec.o)\
	$(LIB)(stracpy.o)\
	$(LIB)(versionprint.o)

$(SHLIB):	$(OBJECTS)
	$(LDSHARED) $(SHLIB) -h $(SHLIB) $(OBJECTS)

$(SHLIBCURS):	$(CURSOBJS)
	$(LDSHARED) $(SHLIBCURS) -h $(SHLIBCURS) $(CURSOBJS)

install:
	$(INSTALL) -d $(LIBDIR)
	$(INSTALL_DATA) $(LIB) $(LIBDIR)
	if test -f $(SHLIB); then $(INSTALL) $(SHLIB) $(SHLIBCURS) $(LIBDIR); fi

install_strip:
	$(INSTALL) -d $(LIBDIR)
	$(INSTALL_DATA) $(LIB) $(LIBDIR)
	if test -f $(SHLIB); then $(INSTALL) $(SHLIB) $(SHLIBCURS) $(LIBDIR); fi

clean:
	$(RM) *.[oa] *.so

distclean:	clean
	$(RM) Makefile
