# file: src/scripts/Makefile
#
#  2001 OpenCA Group

TOP	= ../..
include $(TOP)/Makefile.global-vars

# scripts derived from .in files:
AC_SCRIPTS	= \
	openca-addcert		\
	openca-dblist		\
	openca-importcerts	\
	openca-browserexp	\
	openca-dbview		\
	openca-importreqs	\
	openca-dbbuild		\
	openca-getcert		\
	openca-newcert		\
	openca-dbcreate		\
	openca-getitem		\
	openca-unrevoke

SCRIPTS		= $(AC_SCRIPTS)
DEST_SCRIPTS	= $(SCRIPTS:%=$(DEST_BINDIR)/%)

#---- variable settings above, rules below ----

.PHONY:	default test install install-ca install-common install-ldap install-node install-pub install-ra clean distclean

default::

test::

# common for both CA and external server:
install-ca install-ra:	install

# here is nothing to do
install-common:
install-ldap:
install-node:
install-pub:
install-scep:

$(DEST_BINDIR):
		$(INSTALL) -d -o ${openca_user} -g ${openca_group} -m 755 $@

install::	$(DEST_SCRIPTS)

$(DEST_SCRIPTS)::	$(DEST_BINDIR)
$(DEST_SCRIPTS)::
		$(INSTALL) -o ${openca_user} -g ${openca_group} -m 755 $(@:$(DEST_BINDIR)/%=%) $@

clean::

distclean::
	$(RM) $(AC_SCRIPTS)
