###############################################################################
# Variable definitions for targets to build
###############################################################################
#___INFO__MARK_BEGIN__
##########################################################################
#
#  The Contents of this file are made available subject to the terms of
#  the Sun Industry Standards Source License Version 1.2
#
#  Sun Microsystems Inc., March, 2001
#
#
#  Sun Industry Standards Source License Version 1.2
#  =================================================
#  The contents of this file are subject to the Sun Industry Standards
#  Source License Version 1.2 (the "License"); You may not use this file
#  except in compliance with the License. You may obtain a copy of the
#  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
#  Software provided under this License is provided on an "AS IS" basis,
#  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
#  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
#  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
#  See the License for the specific provisions governing your rights and
#  obligations concerning the Software.
#
#  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
#  Copyright: 2001 by Sun Microsystems, Inc.
#
#  All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
EXECD_DIR   = $(SDIR)/daemons/execd

EXECD_TARGETS = sge_execd

EXECD_SRC   =  execd.c \
              sge_load_sensor.c \
              dispatcher.c \
              exec_job.c \
              execd_ck_to_do.c \
              execd_get_new_conf.c \
              execd_job_exec.c \
              execd_kill_execd.c \
              execd_signal_queue.c \
              execd_ticket.c \
              get_path.c \
              job_report_execd.c \
              load_avg.c \
              pdc.c \
              procfs.c \
              ptf.c \
              reaper_execd.c \
              sge_report_execd.c \
              setup_execd.c \
              tmpdir.c

EXECD_ADD_SRC =  usage.c \
                 sge_options.c \
              admin_mail.c \
              config_file.c \
              mail.c \
              read_write_job.c \
              sge_dirent.c \
              execution_states.c \
              sig_handlers.c \
              startprog.c \
              shutdown.c  \
              sge_mt_init.c

EXECD_OBJS    = $(EXECD_SRC:.c=.o)

EXECD_ADD_OBJS = $(EXECD_ADD_SRC:.c=.o)

EXECD_ADD_LIBS = -lgdi -lsgeobj -lsgeobjd $(SECLIB) $(KRBLIB) -lcull -lcomm -lcommlists -luti $(WINGRIDLIB) -llck -lrmon $(DLLIB)

EXECD_LIB_DEPENDS = $(SCHEDLIB) $(GDILIB) $(SGEOBJLIB) $(SGEOBJDLIB) \
                    $(KRBLIBS)  $(CULLLIB) $(COMMLIB) $(COMMLISTSLIB) \
                    $(WINGRIDLIB_DEP) $(UTILIB) $(LCKLIB) $(RMONLIB) \
                    $(TPLIB)

###############################################################################
# global rules: all, clean, depend, messages
###############################################################################
execd: $(EXECD_TARGETS)
	
execd_clean:
	$(RM) $(EXECD_TARGETS) $(EXECD_OBJS)

execd_depend:
	$(DEPEND) -f$(EXECD_DIR)/execd_dependencies $(EXECD_DIR)/*.c

execd_messages:
	@echo Creating $@
	@for i in `ls $(EXECD_DIR)/*.c`; do \
	   $(CC) $(CFLAGS) -DEXTRACT_MESSAGES -E $$i | $(XGETTEXT) - ; \
	done


###############################################################################
# rules to build binaries
###############################################################################
sge_execd:  $(EXECD_OBJS) $(EXECD_ADD_OBJS) $(EXECD_LIB_DEPENDS)
		$(LD_WRAPPER) $(CC) -o $@ $(LFLAGS) $(EXECD_OBJS) $(EXECD_ADD_OBJS) $(EXECD_ADD_LIBS) $(SLIBS) $(LIBS) $(LOADAVGLIBS) $(CORELIB)

###############################################################################
# include dependencies for object files generated by sge_depend
###############################################################################
include $(EXECD_DIR)/execd_dependencies

###############################################################################
# rules to build object codes
###############################################################################
sge_load_sensor.o: $(EXECD_DIR)/sge_load_sensor.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/sge_load_sensor.c

dispatcher.o:	$(EXECD_DIR)/dispatcher.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/dispatcher.c

exec_job.o:	$(EXECD_DIR)/exec_job.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/exec_job.c

execd.o:	$(EXECD_DIR)/execd.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/execd.c

execd_ck_to_do.o:	$(EXECD_DIR)/execd_ck_to_do.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/execd_ck_to_do.c

execd_get_new_conf.o:	$(EXECD_DIR)/execd_get_new_conf.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/execd_get_new_conf.c

execd_job_exec.o:	$(EXECD_DIR)/execd_job_exec.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/execd_job_exec.c

execd_kill_execd.o:	$(EXECD_DIR)/execd_kill_execd.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/execd_kill_execd.c

execd_signal_queue.o:	$(EXECD_DIR)/execd_signal_queue.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/execd_signal_queue.c

execd_ticket.o:	$(EXECD_DIR)/execd_ticket.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/execd_ticket.c

get_path.o   : $(EXECD_DIR)/get_path.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/get_path.c

job_report_execd.o   : $(EXECD_DIR)/job_report_execd.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/job_report_execd.c

load_avg.o: 	$(EXECD_DIR)/load_avg.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/load_avg.c

ptf.o: 		$(EXECD_DIR)/ptf.c 
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/ptf.c

reaper_execd.o:	$(EXECD_DIR)/reaper_execd.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/reaper_execd.c

sge_report_execd.o   : $(EXECD_DIR)/sge_report_execd.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/sge_report_execd.c

setup_execd.o   : $(EXECD_DIR)/setup_execd.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/setup_execd.c

tmpdir.o   : $(EXECD_DIR)/tmpdir.c
		$(CC) $(CFLAGS) -c $(EXECD_DIR)/tmpdir.c


