###########################################################################
#                                                                         #
# Makefile                                                                #
#                                                                         #
# This file is part of the sshsentry software package.                    #
#                                                                         #
# Copyright (C) 2006 - 2012 Andreas Stempfhuber <andi@afulinux.de>        #
#                                                                         #
# This program is free software: you can redistribute it and/or modify    #
# it under the terms of the GNU General Public License as published by    #
# the Free Software Foundation, either version 3 of the License, or       #
# (at your option) any later version.                                     #
#                                                                         #
# This program is distributed in the hope that it will be useful,         #
# but WITHOUT ANY WARRANTY; without even the implied warranty of          #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
# GNU General Public License for more details.                            #
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program.  If not, see <http://www.gnu.org/licenses/>.   #
#                                                                         #
###########################################################################

PROGRAM = sshsentry

# destination directories
DESTDIR	=
LOCALDIR = /local
SBINDIR = $(DESTDIR)/usr$(LOCALDIR)/sbin
CFGDIR	= $(DESTDIR)/etc
INITDIR = $(DESTDIR)/etc/init.d

# source directory
SRCDIR	= src

NAME	= $(shell basename `pwd`)

all:
clean:

dist:	
	tar -C .. -czf ../$(NAME).tar.gz $(NAME)

install:
	install $(SRCDIR)/$(PROGRAM) $(SBINDIR)
	install $(SRCDIR)/init.d/$(PROGRAM) $(INITDIR)
	sed -i -e "s,\(^DAEMON=\)(DESTDIR),\1$(SBINDIR),1" $(INITDIR)/$(PROGRAM)

install_config:
	install -m 644 $(SRCDIR)/etc/$(PROGRAM).conf $(CFGDIR)

uninstall:
	rm -f $(SBINDIR)/$(PROGRAM)
	rm -f $(INITDIR)/$(PROGRAM)

uninstall_config:
	rm -f $(CFGDIR)/$(PROGRAM).conf
