# ----------
# GNUmakefile.in
#
#      Autoconf input file for main GNUmakefile for Veil
#
#      Copyright (c) 2005, 2006 Marc Munro
#      Author:  Marc Munro
#      License: BSD
#
# $Id: GNUmakefile.in,v 1.3 2007/07/31 22:18:27 bloodnok Exp $
# ----------
#

top_builddir = /home/marc/proj/veil
garbage := \\\#*  .\\\#*  *~  *.orig  *.rej  core 

DEFAULT: all
.PHONEY: DEFAULT all install installdirs clean distdir maintainer-clean \
         distdir dist list help

include $(top_builddir)/Makefile.global
SUBDIRS = src regress docs demo
BUILD_DOCS  = no
INSTALL_DOCS  = no
include $(SUBDIRS:%=%/GNUmakefile)


# Build per-source dependency files for inclusion
%.d: %.c
	@echo include $(top_builddir)/Makefile.global

# Build per-source dependency files for inclusion
%.d: %.c
	@echo Recreating $@
	@$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $< | $(SED) 's!$*.o!& $@!g'" > $@

all: $(SUBDIRS:%=%_all)
	@echo
	@echo "All of Veil is successfully made. Ready to install"
	@echo

install	installdirs: $(SUBDIRS:%=%_install) all
	@echo "Veil is successfully installed"
	@if [ 8 -ge 8 -a 3 -ge 2 ]; then \
	    echo "You must now update your postgresql.conf file to specify "; \
	    echo "shared_preload_libraries = /usr/lib/postgresql/8.3/lib/veil.so"; fi

clean: $(SUBDIRS:%=%_clean) topclean

topclean:
	@echo Cleaining top...
	@rm -f $(garbage)

distclean: $(SUBDIRS:%=%_distclean) topclean
	@rm -f Makefile.global Makefile.port
	@rm -f GNUmakefile
	@rm -f config.log config.status config.h
	@rm -f Veil-0.9.6.tar.gz
	@rm -f postgres.imp
	@rm -rf autom4te.cache

maintainer-clean: distclean
	rm -rf configure autom4te.cache

distdir = ./Veil-0.9.6

distdir:
	-rm -rf $(distdir)* 
	for x in `cd $(top_builddir) && find . -name CVS -prune -o -print`; do \
	  file=`expr X$$x : 'X\./\(.*\)'`; \
	  if test -d "$(top_builddir)/$$file" ; then \
	    mkdir "$(distdir)/$$file" && chmod 777 "$(distdir)/$$file"; \
	  else \
	    ln "$(top_builddir)/$$file" "$(distdir)/$$file" >/dev/null 2>&1 \
	      || cp "$(top_builddir)/$$file" "$(distdir)/$$file"; \
	  fi || exit; \
	done

dist:	distdir
	$(TAR) cf Veil-0.9.6.tar $(distdir)
	$(GZIP) Veil-0.9.6.tar
	-rm -rf $(distdir)


# Provide a list of the targets buildable by this makefile.
list help:
	@echo -e "\n\
 Major targets for this makefile are:\n\n\
 all       - Build all of veil (the default target)\n\
 install   - Install all of veil\n\
 veil      - Build the veil shared library, and veil_interface.sql\n\
 docs      - Build veil html docs\n\
 regress   - Build veil and run regression tests\n\
 demo      - Build the veil demo database\n\
 dropdemo  - Drop the veil demo database\n\
 list      - show this list of major targets\n\
 help      - show this list of major targets\n\
 dist      - build a tar file of the current veil distribution\n\
 clean     - remove target and object files\n\
 distclean - remove target, object and generated config files\n\
\n\
"
