# vim:ft=automake
# Gearman server and library
# Copyright (C) 2008 Brian Aker, Eric Day
# Copyright (C) 2009 Brian Aker, Eric Day, Monty Taylor
# All rights reserved.
#
# Use and distribution licensed under the BSD license.  See
# the COPYING file in the parent directory for full text.
#
# Included from Top Level Makefile.am
# All paths should be given relative to the root

sbin_PROGRAMS+= gearmand/gearmand

gearmand_gearmand_LDADD= \
			 $(BOOST_PROGRAM_OPTIONS_LIBS) \
			 $(PTHREAD_LIBS) \
			 ${BETTER_MALLOC_LIBS} \
			 libgearman-server/libgearman-server.la

gearmand_gearmand_LDFLAGS= $(BOOST_PROGRAM_OPTIONS_LDFLAGS)

gearmand_gearmand_CXXFLAGS= $(BOOST_CXXFLAGS)

gearmand_gearmand_SOURCES= \
			   gearmand/gearmand.cc \
			   util/daemon.cc \
			   util/pidfile.cc

if TARGET_LINUX
gearmand_hostile_gearmand_LDADD= $(gearmand_gearmand_LDADD)
gearmand_hostile_gearmand_LDFLAGS= $(gearmand_gearmand_LDFLAGS)
gearmand_hostile_gearmand_CXXFLAGS= $(gearmand_gearmand_CXXFLAGS)
gearmand_hostile_gearmand_SOURCES= $(gearmand_gearmand_SOURCES)

gearmand_hostile_gearmand_LDADD+= libhostile/libhostile.la
gearmand_hostile_gearmand_LDADD+= -ldl
gearmand_hostile_gearmand_DEPENDENCIES= libhostile/libhostile.la

noinst_PROGRAMS+=gearmand/hostile_gearmand
endif

gearmand-valgrind: gearmand/gearmand
	$(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes  gearmand/gearmand

gearmand-debug: gearmand/gearmand
	$(LIBTOOL) --mode=execute gdb gearmand/gearmand
