#   Makefile.in -- Makefile for API library
#
#   Copyright 2009 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 API library
#

prefix		=	@prefix@
exec_prefix	=	@exec_prefix@
SHELL		=	/bin/sh
PARENT		=	..
BASE		=	../..
AR		=	ar
CC		=	libtool --mode=compile @CC@
RM		=	rm -f
HDRS		=	$(PARENT)/hdrs
CCFLAGS		=	-O @gcc_useful_options@ @funny_compiler_options@
CFLAGS		=	$(CCFLAGS) -I$(HDRS)
LIBDIR		=	$(DESTDIR)@libdir@
RPATH		=	@libdir@
INCLUDEDIR	=	$(DESTDIR)@includedir@
APILIB		=	libgnubatch.la
INSTALL		=	@INSTALL@
INSTALL_DATA	=	@INSTALL_DATA@

OBJECTS=gbatch_ciadd.o\
	gbatch_cidel.o\
	gbatch_ciread.o\
	gbatch_ciupd.o\
	gbatch_getbtd.o\
	gbatch_getbtu.o\
	gbatch_gethenv.o\
	gbatch_holread.o\
	gbatch_holupd.o\
	gbatch_jobadd.o\
	gbatch_jobchgrp.o\
	gbatch_jobchmod.o\
	gbatch_jobchown.o\
	gbatch_jobdata.o\
	gbatch_jobdel.o\
	gbatch_joblist.o\
	gbatch_jobop.o\
	gbatch_jobread.o\
	gbatch_jobupd.o\
	gbatch_jobswap.o\
	gbatch_putbtd.o\
	gbatch_putbtu.o\
	gbatch_setqueue.o\
	gbatch_strings.o\
	gbatch_varadd.o\
	gbatch_varchcomm.o\
	gbatch_varchgrp.o\
	gbatch_varchmod.o\
	gbatch_varchown.o\
	gbatch_vardel.o\
	gbatch_varlist.o\
	gbatch_varread.o\
	gbatch_modepack.o\
	gbatch_varrename.o\
	gbatch_varupd.o\
	gbatch_open.o

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

all:	gbatch.h $(OBJECTS)
	libtool --mode=link @CC@ $(CCFLAGS) -o $(APILIB) $(LIBOBJECTS) -rpath $(RPATH) -version-info 1:0:0

# Build header out of the bits

gbatch.h:	gbatch.pre\
		gbatch.post\
		$(BASE)/config.h\
		$(HDRS)/defaults.h\
		$(HDRS)/bjparam.h\
		$(HDRS)/btconst.h\
		$(HDRS)/btmode.h\
		$(HDRS)/timecon.h
	sh ./Hdrmake.sh $(BASE)/config.h $(HDRS)

install: all
	libtool --mode=install $(INSTALL) $(APILIB) $(LIBDIR)
	$(INSTALL_DATA) gbatch.h $(INCLUDEDIR)
	$(INSTALL_DATA) $(APILIB) $(LIBDIR)

install_strip: all
	libtool --mode=install $(INSTALL) -s $(APILIB) $(LIBDIR)
	$(INSTALL_DATA) gbatch.h $(INCLUDEDIR)
	$(INSTALL_DATA) $(APILIB) $(LIBDIR)

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

distclean:	clean
	$(RM) Makefile
