# file: src/common/etc/Makefile
#
#  2001 OpenCA Group

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

SUBDIRS	= \
	database	\
	openssl		\
	rbac

ETC_DIRS = \
	openssl			\
	openssl/openssl		\
	openssl/extfiles	\
	rbac			\
	rbac/modules		\
	rbac/operations		\
	rbac/rights		\
	rbac/roles		\
	rbac/scripts		\
	servers

DEST_CONFDIR  = ${etc_prefix}
DEST_ETC_DIRS =	$(ETC_DIRS:%=$(etc_prefix)/%)

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

.PHONY:	default test install install-conf clean distclean

default::

test::


install::	$(etc_prefix)

install-conf::	$(DEST_ETC_DIRS) $(DEST_FILES)

install-conf clean distclean::
		$(MAKE) $(SUBDIRS) SUBTARGET=$@

$(etc_prefix)::
	@if [ -d $@ ]; then \
		echo "$@ already exists, skipping configuration"; \
	else \
		set -x; \
		$(INSTALL) -d -o ${httpd_user} -g ${httpd_group} $@; \
		$(MAKE) install-conf; \
	fi


$(DEST_ETC_DIRS)::
	$(INSTALL) -d -o ${httpd_user} -g ${httpd_group} $@

$(SUBDIRS)::
		cd $@ && $(MAKE) $(SUBTARGET)

distclean::
		#$(RM)
