# CORE
# (c)2011-2013 the Boeing Company.
# See the LICENSE file included in this distribution.
#
# author: Jeff Ahrenholz  <jeffrey.m.ahrenholz@boeing.com>
#
# Makefile for installing scripts.
#

CLEANFILES	= core-daemon

DISTCLEANFILES	= Makefile.in core-daemon.service

EXTRA_DIST	= core-daemon-init.d \
		  core-daemon.service.in \
		  core-daemon-rc.d \
		  core-daemon-init.d-SUSE

SUBDIRS		= perf

# install startup scripts based on --with-startup=option configure option
# init.d (default), systemd, SUSE
if WANT_INITD
startupdir	= /etc/init.d
startup_SCRIPTS	= core-daemon

core-daemon: core-daemon-init.d
	cp $< $@
endif
if WANT_SYSTEMD
startupdir	= /etc/systemd/system
startup_SCRIPTS	= core-daemon.service
endif
if WANT_SUSE
startupdir	= /etc/init.d
startup_SCRIPTS	= core-daemon

core-daemon: core-daemon-init.d-SUSE
	cp $< $@
endif

# remove extra scripts and their directories if they are empty
uninstall-hook:
	rmdir -p $(startupdir) || true