#
#   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@
CC		=	libtool --mode=compile @CC@
PARENT		=	..
BASE		=	../..
HDRS		=	$(PARENT)/hdrs
CCFLAGS		=	-O @gcc_useful_options@ @funny_compiler_options@
CFLAGS		=	$(CCFLAGS) -I$(HDRS) -I$(BASE)
RPATH		=	@libdir@
LIBDIR		=	$(DESTDIR)$(RPATH)
LIB		=	libgnuspool_int.la
LIBCURS		=	libgnuspool_curs.la
LIBCURSES	=	@LIBCURSES@
RM		=	rm -f
INSTALL		=	@INSTALL@
INSTALL_DATA	=	@INSTALL_DATA@

# These are lorder|tsort-ified which some systems need

OBJECTS=xfershm.o 	spath.o 	shutilmsg.o	saveopts.o \
 	runpwd.o	rptrlist.o	rjoblist.o	rdpgfile.o \
	qmatch.o	ptrshm.o	prin_size.o	optprocess.o \
	open_cfile.o	op_icf.o	net_feed.o	mkspid.o \
	makeovec.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	sortp.o		rdoptfile.o \
	matchrouts.o	makevec.o	look_host.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=dohe.o\
	 wnum.o\
	 whexnum.o\
	 whdrstr.o\
	 wgets.o\
	 setkey.o\
	 getkey.o \
	 make_km.o

LIBOBJECTS=$(OBJECTS:.o=.lo)
LIBCURSOBJS=$(CURSOBJS:.o=.lo)

all:	$(OBJECTS) $(CURSOBJS)
	libtool --mode=link @CC@ $(CCFLAGS) -o $(LIB) $(LIBOBJECTS) -rpath $(RPATH) -version-info 0:0:0
	libtool --mode=link @CC@ $(CCFLAGS) -o $(LIBCURS) $(LIBCURSOBJS) $(LIB) $(LIBCURSES) -rpath $(RPATH) -version-info 0:0:0

install: all
	libtool --mode=install $(INSTALL) $(LIB) $(LIBDIR)
	libtool --mode=install $(INSTALL) $(LIBCURS) $(LIBDIR)
	$(RM) $(LIBDIR)/libgnuspool_int.a $(LIBDIR)/libgnuspool_curs.a 
	$(INSTALL_DATA) $(LIB) $(LIBCURS) $(LIBDIR)

install-strip: all
	libtool --mode=install $(INSTALL) -s $(LIB) $(LIBDIR)
	libtool --mode=install $(INSTALL) -s $(LIBCURS) $(LIBDIR)
	$(RM) $(LIBDIR)/libgnuspool_int.a $(LIBDIR)/libgnuspool_curs.a 
	$(INSTALL_DATA) $(LIB) $(LIBCURS) $(LIBDIR)

clean:
	$(RM) *.[oa] *.so *.la *.lo
	$(RM) -r .libs

distclean:	clean
	$(RM) Makefile
