###############################################################################
# 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__
COMMLISTSLIB_DIR = $(SDIR)/libs/comm/lists

COMMLISTSLIB = libcommlists$(LIBEXT)

COMMLISTSLIB_SRC =           \
         cl_util.c          \
         cl_errors.c        \
         cl_raw_list.c      \
         cl_parameter_list.c   \
         cl_log_list.c      \
         cl_string_list.c   \
         cl_thread.c        \
         cl_thread_list.c   
         
         
COMMLISTSLIB_TEST_SRC = \
         test_cl_raw_list.c    \
         test_cl_parameter_list.c    \
         test_cl_util.c        \
         test_cl_errors.c      \
         test_cl_log_list.c    \
         test_cl_thread.c      \
         test_cl_thread_list.c 


COMMLISTSLIB_OBJS = $(COMMLISTSLIB_SRC:.c=.o)

COMMLISTSBIN_DEPEND = $(UTILIB) 

COMMLISTSLIB_TEST_OBJS = $(COMMLISTSLIB_TEST_SRC:.c=.o)
###############################################################################
# global rules: all, clean, depend, messages
###############################################################################
commlists_all: commlistslib test_cl_raw_list test_cl_parameter_list test_cl_util test_cl_errors test_cl_log_list test_cl_thread test_cl_thread_list

commlistslib: $(COMMLISTSLIB)

commlistslib_clean:
		$(RM) $(COMMLISTSLIB_OBJS) $(COMMLISTSLIB_TEST_OBJS) libcommlists.a libcommlists$(SHAREDEXT) test_cl_raw_list test_cl_parameter_list test_cl_util test_cl_errors test_cl_log_list test_cl_thread test_cl_thread_list

commlistslib_depend:
		$(DEPEND) -f $(COMMLISTSLIB_DIR)/commlistslib_dependencies $(COMMLISTSLIB_DIR)/*.c

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

###############################################################################
# rules to build library
###############################################################################
libcommlists.a:	$(COMMLISTSLIB_OBJS) 
	$(AR) $(ARFLAGS) libcommlists.a $(COMMLISTSLIB_OBJS)
	$(RANLIB) libcommlistslib.a

libcommlists$(SHAREDEXT): $(COMMLISTSLIB_OBJS) $(COMMLISTSBIN_DEPEND)
	$(SHAREDLD) $(SHARED_LFLAGS) -o libcommlists$(SHAREDEXT) $(COMMLISTSLIB_OBJS) -luti $(LIBS) -lc

###############################################################################
# include dependencies for object files generated by sge_depend
###############################################################################
include $(COMMLISTSLIB_DIR)/commlistslib_dependencies

###############################################################################
# rules to build object codes
###############################################################################
cl_raw_list.o: $(COMMLISTSLIB_DIR)/cl_raw_list.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_raw_list.c
cl_util.o: $(COMMLISTSLIB_DIR)/cl_util.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_util.c 
cl_errors.o: $(COMMLISTSLIB_DIR)/cl_errors.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_errors.c
cl_log_list.o: $(COMMLISTSLIB_DIR)/cl_log_list.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_log_list.c
cl_string_list.o: $(COMMLISTSLIB_DIR)/cl_string_list.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_string_list.c
cl_parameter_list.o: $(COMMLISTSLIB_DIR)/cl_parameter_list.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_parameter_list.c
cl_thread.o: $(COMMLISTSLIB_DIR)/cl_thread.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_thread.c
cl_thread_list.o: $(COMMLISTSLIB_DIR)/cl_thread_list.c 
		$(CC) $(CFLAGS) $(SHARED_CFLAGS) -c $(COMMLISTSLIB_DIR)/cl_thread_list.c


                      


test_cl_raw_list: test_cl_raw_list.o $(COMMLISTSLIB) $(COMMLISTSBIN_DEPEND)
	$(CC) -o test_cl_raw_list $(LFLAGS) test_cl_raw_list.o $(COMMLISTSLIB) $(LIBS)
test_cl_parameter_list: test_cl_parameter_list.o $(COMMLISTSLIB) $(COMMLISTSBIN_DEPEND)
	$(CC) -o test_cl_parameter_list $(LFLAGS) test_cl_parameter_list.o $(COMMLISTSLIB) $(LIBS)
test_cl_util: test_cl_util.o $(COMMLISTSLIB) $(COMMLISTSBIN_DEPEND)
	$(CC) -o test_cl_util $(LFLAGS) test_cl_util.o $(COMMLISTSLIB) $(LIBS)
test_cl_errors: test_cl_errors.o $(COMMLISTSLIB) $(COMMLISTSBIN_DEPEND)
	$(CC) -o test_cl_errors $(LFLAGS) test_cl_errors.o $(COMMLISTSLIB) $(UTILIB) $(COMMLISTSLIB) $(LIBS)
test_cl_log_list: test_cl_log_list.o $(COMMLISTSLIB) $(COMMLISTSBIN_DEPEND)
	$(CC) -o test_cl_log_list $(LFLAGS) test_cl_log_list.o $(COMMLISTSLIB) $(UTILIB) $(LIBS)
test_cl_thread: test_cl_thread.o $(COMMLISTSLIB) $(COMMLISTSBIN_DEPEND)
	$(CC) -o test_cl_thread $(LFLAGS) test_cl_thread.o $(COMMLISTSLIB) $(LIBS)
test_cl_thread_list: test_cl_thread_list.o $(COMMLISTSLIB) $(COMMLISTSBIN_DEPEND)
	$(CC) -o test_cl_thread_list $(LFLAGS) test_cl_thread_list.o $(COMMLISTSLIB) $(LIBS)

test_cl_raw_list.o: $(COMMLISTSLIB_DIR)/test_cl_raw_list.c
	$(CC) $(CFLAGS) -c $(COMMLISTSLIB_DIR)/test_cl_raw_list.c
test_cl_parameter_list.o: $(COMMLISTSLIB_DIR)/test_cl_parameter_list.c
	$(CC) $(CFLAGS) -c $(COMMLISTSLIB_DIR)/test_cl_parameter_list.c
test_cl_util.o: $(COMMLISTSLIB_DIR)/test_cl_util.c
	$(CC) $(CFLAGS) -c $(COMMLISTSLIB_DIR)/test_cl_util.c
test_cl_errors.o: $(COMMLISTSLIB_DIR)/test_cl_errors.c
	$(CC) $(CFLAGS) -c $(COMMLISTSLIB_DIR)/test_cl_errors.c
test_cl_log_list.o: $(COMMLISTSLIB_DIR)/test_cl_log_list.c
	$(CC) $(CFLAGS) -c $(COMMLISTSLIB_DIR)/test_cl_log_list.c
test_cl_thread.o: $(COMMLISTSLIB_DIR)/test_cl_thread.c
	$(CC) $(CFLAGS) -c $(COMMLISTSLIB_DIR)/test_cl_thread.c
test_cl_thread_list.o: $(COMMLISTSLIB_DIR)/test_cl_thread_list.c
	$(CC) $(CFLAGS) -c $(COMMLISTSLIB_DIR)/test_cl_thread_list.c
