# Makefile for src/mod/
# $Id: Makefile.in,v 1.10 2000/04/25 20:49:48 fabian Exp $

SHELL = /bin/sh
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

@SET_MAKE@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

CC = @CC@
LD = @CC@
STRIP = @STRIP@
CFLAGS = @CFLAGS@ -I../.. -I$(top_srcdir) @DEFS@ $(CFLGS)
CPPFLAGS = @CPPFLAGS@
MOD_CFLAGS = @CFLAGS@ -I. -I../../.. -I../$(top_srcdir) \
  -I../$(top_srcdir)/src/mod @DEFS@ $(CFLGS)
MOD_CPPFLAGS = @CPPFLAGS@


# Note: The following three lines are automatically adjusted by
#       misc/modconfig. They have to be present here.
mods =
mod_objs =
mod_libs =

modconfig = $(top_srcdir)/misc/modconfig --bindir=../.. \
  --top_srcdir=$(top_srcdir)
egg_ac_parameters = @egg_ac_parameters@

MAKE_MOD = $(MAKE) 'MAKE=$(MAKE)' 'CC=$(CC)' 'LD=$(LD)' \
'STRIP=$(STRIP)' 'CFLAGS=$(MOD_CFLAGS)' 'CPPFLAGS=$(MOD_CPPFLAGS)'


doofus:
	@echo ""
	@echo "Let's try this from the right directory..."
	@echo ""
	@cd ../.. && $(MAKE)

modules: $(mod_libs)
	@echo "All modules compiled."
	@echo ""

static: $(mod_objs)
	@$(modconfig) static.h

.SUFFIXES:
.SUFFIXES: .mod .mod_so .mod_o

.mod.mod_so:
	@if test ! -d $*.mod; then mkdir $*.mod; fi; \
	if test ! -r $*.mod/Makefile; then \
		cp $(srcdir)/$*.mod/Makefile $*.mod/Makefile; \
	fi; \
	cd $*.mod && $(MAKE_MOD) 'VPATH=../$(srcdir)/$*.mod' 'srcdir=../$(srcdir)/$*.mod' 'MAKE=$(MAKE)' modules;

.mod.mod_o:
	@if test ! -d $*.mod; then mkdir $*.mod; fi; \
	if test ! -r $*.mod/Makefile; then \
		cp $(srcdir)/$*.mod/Makefile $*.mod/Makefile; \
	fi; \
	cd $*.mod && $(MAKE_MOD) 'VPATH=../$(srcdir)/$*.mod' 'srcdir=../$(srcdir)/$*.mod' 'MAKE=$(MAKE)' static;

depend:
	@for i in $(mods); do \
		if test ! -d $$i; then mkdir $$i; fi; \
		if test ! -r $$i/Makefile; then \
			cp $(srcdir)/$$i/Makefile $$i/Makefile; \
		fi; \
		(cd $$i && $(MAKE_MOD) "VPATH=../$(srcdir)/$$i" "srcdir=../$(srcdir)/$$i" depend); \
	done

config:
	@for i in $(mods); do \
		if test -f $(srcdir)/$$i/configure; then \
			modname=`echo $$i | sed -e 's/.mod//'`; \
			echo ""; \
			echo "Configuring module $${modname} ..."; \
			echo ""; \
			if test ! -d $$i; then mkdir $$i; fi; \
			(cd $$i && ../$(srcdir)/$$i/configure $(egg_ac_parameters) --cache-file=../../../config.cache --srcdir=../$(top_srcdir)/src/mod/$$i); \
		fi; \
	done; \
	echo ""

clean:
	@rm -f *.o *.so *~ static.h mod.xlibs
	@for i in *.mod; do \
		if test ! -d $$i; then mkdir $$i; fi; \
		if (test ! -r $$i/Makefile) && \
		   (test -r $(srcdir)/$$i/Makefile); then \
			cp $(srcdir)/$$i/Makefile $$i/Makefile; \
		fi; \
		if (test -r $$i/Makefile); then \
			(cd $$i; $(MAKE) "VPATH=../$(srcdir)/$$i" "srcdir=../$(srcdir)/$$i" 'MAKE=$(MAKE)' clean); \
		fi; \
	done

distclean:
	@rm -f *.o *.so *~ static.h mod.xlibs
	@for i in *.mod; do \
		if test ! -d $$i; then mkdir $$i; fi; \
		if (test ! -r $$i/Makefile) && \
		   (test -r $(srcdir)/$$i/Makefile); then \
			cp $(srcdir)/$$i/Makefile $$i/Makefile; \
		fi; \
		if (test -r $$i/Makefile); then \
			(cd $$i; $(MAKE) "VPATH=../$(srcdir)/$$i" "srcdir=../$(srcdir)/$$i" 'MAKE=$(MAKE)' distclean); \
		fi; \
	done

install: install-help install-language

install-help:
	@echo "Copying module help files."
	@if test ! -d $(DEST)/help; then \
		echo "Creating 'help' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/help; \
	fi; \
	for i in $(mods); do \
		if test ! "x`echo $(srcdir)/$$i/help/*.help`" = "x$(srcdir)/$$i/help/*.help"; then \
			for h in $(srcdir)/$$i/help/*.help; do \
				$(INSTALL_DATA) $$h $(DEST)/help/; \
			done; \
		fi; \
	done;
	@if test ! -d $(DEST)/help/msg; then \
		echo "Creating 'help/msg' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/help/msg; \
	fi; \
	for i in $(mods); do \
		if test ! "x`echo $(srcdir)/$$i/help/msg/*.help`" = "x$(srcdir)/$$i/help/msg/*.help"; then \
			for h in $(srcdir)/$$i/help/msg/*.help; do \
				$(INSTALL_DATA) $$h $(DEST)/help/msg/; \
			done; \
		fi; \
	done;
	@if test ! -d $(DEST)/help/set; then \
		echo "Creating 'help/set' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/help/set; \
	fi; \
	for i in $(mods); do \
		if test ! "x`echo $(srcdir)/$$i/help/set/*.help`" = "x$(srcdir)/$$i/help/set/*.help"; then \
			for h in $(srcdir)/$$i/help/set/*.help; do \
				$(INSTALL_DATA) $$h $(DEST)/help/set/; \
			done; \
		fi; \
	done;

install-language:
	@echo "Copying module language files."
	@if test ! -d $(DEST)/language; then \
		echo "Creating 'language' subdirectory."; \
		$(top_srcdir)/misc/mkinstalldirs $(DEST)/language; \
	fi; \
	for i in $(mods); do \
		if test ! "x`echo $(srcdir)/$$i/language/*.lang`" = "x$(srcdir)/$$i/language/*.lang"; then \
			for h in $(srcdir)/$$i/language/*.lang; do \
				$(INSTALL_DATA) $$h $(DEST)/language/; \
			done; \
		fi; \
	done;

#safety hash
