# Makefile for golem
SUBDIRS=	src @BUILD_PLUGINS@ doc util

@SET_MAKE@

prefix=		@prefix@
exec_prefix=	@exec_prefix@

bindir=		@bindir@
datadir=	@datadir@
mandir=		@mandir@
libdir=		@libdir@

.PHONY:		all clean distclean full deinstall uninstall
.PHONY:		install install-bin install-data install-plugins install-man

# subdir recursion macro
RECUR=	@for dir in $(SUBDIRS) ; do \
		echo "===> $$dir"; \
		(cd $$dir ; $(MAKE) $@) \
	done

all:
	$(RECUR)

clean:
	-rm -rf build-plugin build-bin sample.golem/plugins
	$(RECUR)

distclean: clean
	-rm -f config.cache config.status config.log src/config.h
	-rm -f Makefile src/Makefile plugins/Makefile plugins/Makefile.plugin
	-rm -f doc/Makefile util/Makefile

full: clean all

install-bin: @INSTALL_PLUGINS@
	@INSTALL@ -d $(bindir)
	@INSTALL@ build-bin/golem $(bindir)
	@INSTALL@ build-bin/golem.install $(bindir)

install-plugins:
	@INSTALL@ -d $(libdir)/golem/plugins
	for i in build-plugin/* ; do \
		@INSTALL@ $$i $(libdir)/golem/plugins/ ; \
	done

install-data:
	cd sample.golem ; \
	for i in `find . -type d | grep -v CVS` ; do \
		@INSTALL@ -d $(datadir)/golem/$$i ; \
	done ; \
	for i in `find . -type f | grep -v CVS` ; do \
		@INSTALL@ -m 444 $$i $(datadir)/golem/$$i ; \
	done

install-man:
	@INSTALL@ -d $(mandir)/man1
	@INSTALL@ -m 444 doc/golem.1.gz $(mandir)/man1/

install: all install-bin install-data install-man

# this will kill anything they put into those dirs also
deinstall:
	rm -f $(bindir)/golem
	rm -f $(bindir)/golem.install
	rm -f $(mandir)/man1/golem.1.gz
	rm -rf $(libdir)/golem
	rm -rf $(datadir)/golem

uninstall: deinstall


syntax highlighted by Code2HTML, v. 0.9.1