#
# $Id: Makefile.in,v 2.0 1998/10/14 23:14:43 hender Exp $
#
#
#       Makefile for the PBS scheduler
#
# This program is confidential and proprietary to MRJ Technology Solutions
# and may not be reproduced, published or disclosed to others without
# written authorization from MRJ.
# 
# Copyright (c) 1998 MRJ Technology Solutions, Inc. All Rights Reserved.
# 
# This program is derived from prior work some of which was originally
# written as a joint project between the Numerical Aerospace Simulation
# (NAS) Systems Division of NASA Ames Research Center and the National
# Energy Research Supercomputer Center (NERSC) of Lawrence Livermore
# National Laboratory.
#
# the first non-comment line must be .POSIX to assure POSIX make behavior
#
@MAKE_POSIX_TARGET@


srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
MK_VPATH = @srcdir@
INSTALL = @INSTALL@

@mk_head@
@mk_dirs@

INCS = -I@top_builddir@/src/include -I$(top_srcdir)/src/include
CFLAGS = @CFLAGS@ $(INCS) @DEFS@

OBJS	= pbs_sched.o get_4byte.o
SRCS	= pbs_sched.c get_4byte.c

# The scheduler code build directories. If the user had
# specified a directory external to the PBS distribution then the
# build will be done in the source directory.
SCHD_BUILD = @SCHD_BUILD@

SCHEDLIB= $(SCHD_BUILD)/pbs_sched.a

TARGET	= pbs_sched

PBSLIBS = ../lib/Libnet/libnet.a \
          ../lib/Liblog/liblog.a \
          ../lib/Libpbs/libpbs.a

all: autodepend
	@MAKE_POSIX_PLUS@@$(MAKE) build

build:
	@MAKE_POSIX_PLUS@@cd $(SCHD_BUILD) && $(MAKE)
	$(MAKE) $(TARGET)

install: build
	@MAKE_POSIX_PLUS@@cd $(SCHD_BUILD) && $(MAKE) install
	@$(INSTALL) -d -m 755 $(sbindir) && \
	$(INSTALL) -m 700 $(TARGET) $(sbindir)

$(TARGET): $(OBJS) $(SCHEDLIB)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(SCHEDLIB) $(PBSLIBS) $(LIBS)

distclean::
	-(cd $(SCHD_BUILD) && $(MAKE) $@; exit 0) > /dev/null 2>&1
	-($(RM) samples/*/Makefile samples/do_not_delete; exit 0) > /dev/null 2>&1

clean::
	-(cd $(SCHD_BUILD) && $(MAKE) $@; exit 0) > /dev/null 2>&1

@mk_tail@
@mk_cleanup@
