
#
#	Makefile at the top of the discuss source hierarchy
#
# TODO -- distclean.
#	  install
#	  dist

# configuration info needed for installation
SHELL= /bin/sh

world:
	$(MAKE) $(MFLAGS) all

# for rebuilding changed sources
all:
	cd et		; $(MAKE) $(MFLAGS) all
	cd ss		; $(MAKE) $(MFLAGS) all
	cd usp		; $(MAKE) $(MFLAGS) all
	cd include	; $(MAKE) $(MFLAGS) all
	cd libds	; $(MAKE) $(MFLAGS) all
	cd server	; $(MAKE) $(MFLAGS) all
	cd client	; $(MAKE) $(MFLAGS) all
	cd regex	; $(MAKE) $(MFLAGS) all
	cd mclient	; $(MAKE) $(MFLAGS) all
	cd edsc		; $(MAKE) $(MFLAGS) all
	cd dsgrep	; $(MAKE) $(MFLAGS) all

# install executables and libraries
install:
	cd server	; $(MAKE) $(MFLAGS) install
	cd client	; $(MAKE) $(MFLAGS) install
	cd mclient	; $(MAKE) $(MFLAGS) install
	cd edsc		; $(MAKE) $(MFLAGS) install
	
# for deleting all but sources
clean:
	cd et		; $(MAKE) $(MFLAGS) clean
	cd ss		; $(MAKE) $(MFLAGS) clean
	cd usp		; $(MAKE) $(MFLAGS) clean
	cd ets		; $(MAKE) $(MFLAGS) clean
	cd include	; $(MAKE) $(MFLAGS) clean
	cd libds	; $(MAKE) $(MFLAGS) clean
	cd server	; $(MAKE) $(MFLAGS) clean
	cd client	; $(MAKE) $(MFLAGS) clean
	cd regex	; $(MAKE) $(MFLAGS) clean
	cd mclient	; $(MAKE) $(MFLAGS) clean
	cd edsc		; $(MAKE) $(MFLAGS) clean
	cd dsgrep	; $(MAKE) $(MFLAGS) clean

dist:
	-mkdir ../dist/source
	-chmod g+w ../dist/source
	cp -p Makefile.in ../dist/source/
	cp -p install-sh  ../dist/source/
	cd et		; $(MAKE) $(MFLAGS) dist
	cd ss		; $(MAKE) $(MFLAGS) dist
	cd ets		; $(MAKE) $(MFLAGS) dist
	cd usp		; $(MAKE) $(MFLAGS) dist
	cd libds	; $(MAKE) $(MFLAGS) dist
	cd server	; $(MAKE) $(MFLAGS) dist
	cd client	; $(MAKE) $(MFLAGS) dist
	cd regex	; $(MAKE) $(MFLAGS) dist
	cd mclient	; $(MAKE) $(MFLAGS) dist
	cd include	; $(MAKE) $(MFLAGS) dist
	cd edsc		; $(MAKE) $(MFLAGS) dist

Makefile: Makefile.in config.status
	$(SHELL) config.status
config.status: configure
	$(SHELL) ./configure --no-create
configure: configure.in
	autoconf $(ACFLAGS)
	
