#==============================================================================
# Night Light IRC Proxy (ircproxy) Makefile
# Copyright (C) 2001-2007 Jonas Kvinge <jonas@night-light.net>
# All rights reserved.
#==============================================================================

RM="@RM@"
AWK="@AWK@"
TOUCH="@TOUCH@"
@SET_MAKE@

all: build

.PHONY: build depend install uninstall deinstall config clean distclean maintainer-clean
.SUFFIXES: .dumb

build: config.h
	@for i in src; do \
		echo "Building $$i..."; \
		cd $$i; ${MAKE} build; cd ..; \
	done

root-clean:
	@for i in '*.orig' '.*.orig' '\#*' '*~' '.*~' '*.bak' '.*.bak' core; do \
		echo "Removing $$i"; \
		REMOVE_FILES="`find . -name "$$i" -print`"; \
		test -n "$$REMOVE_FILES" && ${RM} -f $$REMOVE_FILES; \
	done || true

clean: root-clean
	@for i in src; do \
		echo "Cleaning $$i..."; \
		cd $$i; ${MAKE} clean; cd ..; \
	done

maintainer-clean: distclean root-distclean
	${RM} -f autom4te.cache config.h.in stamp-h.in configure
	@echo Generating aclocal.m4...
	aclocal
	@echo Generating config.h.in...
	autoheader
	@echo timestamp > stamp-h.in
	@echo Generating configure...
	autoconf
	@for i in src; do \
		echo "Maintainer-cleaning $$i..."; \
		cd $$i; ${MAKE} maintainer-clean; cd ..;\
	done

root-distclean: root-clean
	@for i in '*.rej'; do \
		echo "Removing $$i"; \
		REMOVE_FILES="`find . -name "$$i" -print`"; \
		test -n "$$REMOVE_FILES" && ${RM} -f $$REMOVE_FILES; \
	done || true
	${RM} -f Makefile

distclean: root-distclean clean
	${RM} -f config.h stamp-h config.cache config.log config.status Makefile
	@for i in src; do \
		echo "Dist-cleaning $$i..."; \
		cd $$i; ${MAKE} distclean; cd ..;\
	done


depend:
	@for i in src; do \
		echo "Making dependencies in $$i..."; \
		cd $$i; ${MAKE} depend; cd ..; \
	done

install: build
	test -d ${prefix} || mkdir ${prefix}
	@for i in src; do \
		echo "Installing in $$i..."; \
		cd $$i; ${MAKE} install; cd ..; \
	done

install-strip: install

uninstall: build
	@for i in ${SUBDIRS}; do \
		echo "Uninstalling in $$i..."; \
		cd $$i; ${MAKE} uninstall; cd ..; \
	done

deinstall:
	@chmod u+x pkg-deinstall
	@./pkg-deinstall

config:	FORCE
	@echo
	@echo "The setup script is removed from this package and has been replaced by a configuration file called ircproxyd.conf."
	@echo


FORCE:

#==============================================================================
# Rules to automatically remake configuration.
# You need GNU make for this to work.

Makefile: config.status Makefile.in
	@echo "Recreating Makefile"
	@CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status > /dev/null

#aclocal.m4:
	#@echo Generating aclocal.m4...
	#@echo aclocal
	#@aclocal || ( echo "NOT recreating 'aclocal.m4', you don't have 'aclocal'"; ${TOUCH} aclocal.m4 )

configure: configure.in
	@echo Generating configure...
	@echo autoconf
	@autoconf || ( echo "NOT recreating 'configure', you don't have 'autoconf'"; ${TOUCH} configure )

config.h.in: stamp-h.in
stamp-h.in: configure.in
	@echo Generating config.h.in...
	@echo autoheader
	@autoheader || ( echo "NOT recreating 'config.h.in', you don't have 'autoheader'"; ${TOUCH} config.h.in ; timestamp > stamp-h.in )
	@echo timestamp > stamp-h.in

config.h: stamp-h
stamp-h: stamp-h.in config.status
	@echo Generating config.h...
	@CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status

config.status: configure
	@echo Generating config.status...
	@CONFIG_FILES= CONFIG_HEADERS= ./config.status --recheck || \
		(./configure && ${TOUCH} stamp-m)



syntax highlighted by Code2HTML, v. 0.9.1