#if WANT_QUILL
#define QuillProgs condor_convert_history condor_dump_history condor_load_history
#else
#define QuillProgs 
#endif

PROGRAMS =  	condor_config_val condor_preen condor_stats \
		condor_userprio condor_history condor test_calc condor_transfer_data \
		view_collection condor_qedit condor_advertise condor_version \
		condor_fetchlog condor_findhost condor_cod condor_wait \
		condor_store_cred QuillProgs  \
		condor_ckpt_probe condor_test_auth

all_target( $(PROGRAMS) )

CFLAGS = $(STD_C_FLAGS)
C_PLUS_FLAGS = $(STD_C_PLUS_FLAGS) $(QUILL_INC) $(TT_INC) $(CONFIGURE_POSTGRESQL_CFLAGS) -I../condor_tt
LIB = $(STD_LIBS) $(TT_LIB) $(CONFIGURE_POSTGRESQL_LDFLAGS)

LH_OBJ = load_history.o ../condor_tt/condor_ttdb.o \
	../condor_tt/jobqueuecollection.o

PROBE_OBJ = probe_process.o ../condor_ckpt/maps.o

/* Don't link this with gcb since it'll NEVER talk to anyone */
public_c_plus_nowrap_target(condor_ckpt_probe,libexec,$(PROBE_OBJ),$(LIB))

public_c_plus_target(condor_cod,bin,cod_tool.o,$(LIB))

public_c_plus_target(condor_preen,sbin,preen.o,$(LIB))

public_c_plus_target(condor_advertise,sbin,advertise.o,$(LIB))

public_c_plus_target(condor_fetchlog,sbin,fetch_log.o,$(LIB))

public_c_plus_target(condor_config_val,bin,config_val.o,$(LIB))

public_c_plus_target(condor_userprio,bin,user_prio.o,$(LIB))

public_c_plus_target(condor_findhost,bin,give_interactive.o,$(LIB))

/* Notice that this tool has a different link line for QUILL */
c_plus_target_complex(condor_history,history.o,$(C_PLUS_FLAGS),$(ALL_LDFLAGS),$(LIB) $(QUILL_LIB))
release_target(condor_history,bin,EXECUTABLE_MODE)
strip_target(condor_history,bin,EXECUTABLE_MODE)
static_target(condor_history,history.o,$(LIB) $(QUILL_LIB),bin)

public_c_plus_target(condor_qedit,bin,qedit.o,$(LIB))

public_c_plus_target(condor_transfer_data,bin,transfer_data.o,$(LIB))

public_c_plus_target(condor_version,bin,version.o,$(LIB))

public_c_plus_target(condor_wait,bin,wait.o,$(LIB))


#ifdef WANT_QUILL
/* Notice that this tool has a different link line for QUILL */
c_plus_target_complex(condor_load_history,$(LH_OBJ),$(C_PLUS_FLAGS),$(ALL_LDFLAGS),$(LIB) $(QUILL_LIB))
release_target(condor_load_history,bin,EXECUTABLE_MODE)
strip_target(condor_load_history,bin,EXECUTABLE_MODE)
static_target(condor_load_history,$(LH_OBJ),$(LIB) $(QUILL_LIB),bin)

c_plus_target_complex(condor_dump_history,dump_history.o,$(C_PLUS_FLAGS),$(ALL_LDFLAGS),$(LIB) $(QUILL_LIB))
release_target(condor_dump_history,bin,EXECUTABLE_MODE)
strip_target(condor_dump_history,bin,EXECUTABLE_MODE)
static_target(condor_dump_history,dump_history.o,$(LIB) $(QUILL_LIB),bin)

public_c_plus_target(condor_convert_history,sbin,convert_history.o,$(LIB))
#endif

public_c_plus_target(condor,sbin,tool.o,$(LIB))
 
/* NOTE: we want a real copy, and we need to grab the corresponding
   file from the right directory */ 
release_copy_target($(RELEASE_DIR)/sbin/condor,bin,condor,EXECUTABLE_MODE)
strip_copy_target($(STRIP_DIR)/sbin/condor,bin,condor,EXECUTABLE_MODE)
static_copy_target($(STATIC_DIR)/sbin/condor,bin,condor,EXECUTABLE_MODE)
/* TODO: this is broken for strip vs. unstrip static. :(  */

public_c_plus_target(condor_store_cred,sbin,store_cred_main.o,$(LIB))

public_link_target(sbin,condor,condor_on)
public_link_target(sbin,condor,condor_off)
public_link_target(sbin,condor,condor_checkpoint)
public_link_target(sbin,condor,condor_vacate)
public_link_target(sbin,condor,condor_restart)
public_link_target(sbin,condor,condor_reconfig)
public_link_target(sbin,condor,condor_reconfig_schedd)
public_link_target(sbin,condor,condor_reschedule)
public_link_target(sbin,condor,condor_master_off)
public_link_target(sbin,condor,condor_set_shutdown)

public_link_target(bin,condor,condor_checkpoint)
public_link_target(bin,condor,condor_vacate)
public_link_target(bin,condor,condor_reschedule)

public_c_plus_target(condor_stats,bin,stats.o,$(LIB))

c_plus_target(test_calc,test_calc.o,$(LIB))

c_plus_target(condor_test_auth,test_auth.o,../condor_daemon_core.V6/condor_ipverify.o $(LIB))

testbin_target(condor_test_auth,755)

c_plus_target(view_collection,view_collection.o,$(LIB))

c_plus_target(condor_invalidate_host,invalidate_host.o,$(LIB))


condor_master_on: master_on.c
	gcc -I/usr/afsws/include -o condor_master_on master_on.c

condor_kill: kill.cpp
	g++ -o condor_kill kill.cpp -I../condor_c++_util -I../condor_includes

clean::
	rm -f condor_kill condor_master_on *.o

html:

# The following bit runs condor_compile to make sure that it works
# It is easy to have class file dependencies sneak into the standard
# universe code in such a way that everything builds, but condor_compile
# will not work.  The below code makes such problems into build-time problems.

#if IS_LINUX && ! IS_CLIPPED 
all::
	_condor_LIB=../condor_syscall_lib CONDOR_CONFIG=/dev/null PATH=.:../condor_scripts:$$PATH condor_compile gcc -Wl,--trace-symbol=fstat -Wl,--trace-symbol=__fstat ckpttest.c 

#endif
