####BEGIN_OS_CONF
#cat .simplemake//Makefile.os/HPUX.flex
LEXFLAGS=$(LEXFLAG)
LEX=flex $(LEXFLAGS)
LEXLIB=-lfl
#cat .simplemake//Makefile.os/HPUX.gcc
OS=HPUX
OSTEXT="Using OS $(OS)"
NETFLAGS=$(NETFLAG)
GENNET=GenNet $(NETFLAGS)
YACCFLAGS=$(YACCFLAG) -v -d
YACC=yacc $(YACCFLAGS)
CFLAGS=-D$(OS) -DGCC $(CFLAG)
SHL_LIBS=$(LEXLIB) $(SHL_LIB)
LIBS=$(LEXLIB) $(LIB)
INCLUDE=-I. $(INCL)
CC=gcc
CXX=g++
AR=ar -r
SL=ld -b -o
####END_OS_CONF
#######################################################
include .simplemake/Makefile.ver
include Makefile.def
#######################################################

#######################################################

all: 
	@DIRS=`ls */Makefile 2>/dev/null | sed -e s%/.*%%`;for d in $$DIRS; do cd $$d; make all; cd ..; done
	make allthis
	@echo $(OSTEXT)
	@echo DONE

allthis: targets

nodebug: strip

production: strip

strip: all
	@DIRS=`ls */Makefile 2>/dev/null | sed -e s%/.*%%`;for d in $$DIRS; do cd $$d; make strip;cd ..; done
	@.simplemake/striptargets $(TARGETS)
	@echo DONE

install: strip debug_install

debug_install: all
	@DIRS=`ls */Makefile 2>/dev/null | sed -e s%/.*%%`;for d in $$DIRS; do cd $$d; make install; cd ..; done
	make install_all



clean: 
	@DIRS=`ls */Makefile 2>/dev/null | sed -e s%/.*%%`;for d in $$DIRS; do cd $$d; make clean; cd ..; done
	make CLEANALL=0 clean_all

cleanall:
	@DIRS=`ls */Makefile 2>/dev/null | sed -e s%/.*%%`;for d in $$DIRS; do cd $$d; make clean; cd ..; done
	make CLEANALL=1 clean_all
	

makefile: bootstrap depend

makefiles:
	@DIRS=`ls */Makefile 2>/dev/null | sed -e s%/.*%%`;for d in $$DIRS; do cd $$d;make makefiles;cd ..; done
	@make makefile

newMakefiles:
	@DIRS=`ls */Makefile 2>/dev/null | sed -e s%/.*%%`;for d in $$DIRS; do cd $$d;newMakefile;make newMakefiles;cd ..; done
	

depend:
	@TARGETS="$(TARGETS)";export TARGETS; \
	NOCLEANT="$(NOCLEANTARGETS)";export NOCLEANT; \
	.simplemake/maketargets

dep:
	@SRC="$(SRC)";export SRC;\
	TARGET="$(TARGET)";export TARGET;\
	CPP="$(CPP)";export CPP; \
	CLEANFILE="$(CLEANFILE)";export CLEANFILE; \
	.simplemake/makedep $(DEPFILE)

bootstrap:
	@.simplemake/makebootstrap

srcdistZ:
	@make srcdist GZ="Z"


####ADDBYMAKEDEP

strext.o: strext.cxx  harray.hxx herror.hxx hini.hxx hlog.hxx hregex.hxx strext.hxx string.hxx y2k.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) strext.cxx

herror.o: herror.cxx  harray.hxx herror.hxx hini.hxx hlog.hxx hregex.hxx strext.hxx string.hxx y2k.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) herror.cxx

hini.o: hini.cxx  harray.hxx herror.hxx hini.hxx hlog.hxx hregex.hxx strext.hxx string.hxx y2k.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) hini.cxx

hregex.o: hregex.cxx  harray.hxx herror.hxx hini.hxx hlog.hxx hregex.hxx strext.hxx string.hxx y2k.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) hregex.cxx

hlog.o: hlog.cxx  harray.hxx herror.hxx hini.hxx hlog.hxx hregex.hxx strext.hxx string.hxx y2k.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) hlog.cxx

y2k.o: y2k.cxx  harray.hxx herror.hxx hini.hxx hlog.hxx hregex.hxx strext.hxx string.hxx y2k.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) y2k.cxx

libbasic.a:  strext.o herror.o hini.o hregex.o hlog.o y2k.o
	$(AR) libbasic.a  strext.o herror.o hini.o hregex.o hlog.o y2k.o

tst_strext.o: tst_strext.cxx  herror.hxx hregex.hxx strext.hxx string.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) tst_strext.cxx

tst_strext:  tst_strext.o strext.o herror.o hregex.o
	$(CXX) -o tst_strext $(LDFLAGS)  tst_strext.o strext.o herror.o hregex.o $(LIBS)

tst_ini.o: tst_ini.cxx  harray.hxx herror.hxx hini.hxx hregex.hxx strext.hxx string.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) tst_ini.cxx

tst_ini:  tst_ini.o strext.o herror.o hini.o hregex.o
	$(CXX) -o tst_ini $(LDFLAGS)  tst_ini.o strext.o herror.o hini.o hregex.o $(LIBS)

tst_rx.o: tst_rx.cxx  herror.hxx hregex.hxx string.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) tst_rx.cxx

tst_rx:  tst_rx.o herror.o hregex.o
	$(CXX) -o tst_rx $(LDFLAGS)  tst_rx.o herror.o hregex.o $(LIBS)

tst_herror.o: tst_herror.cxx  herror.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) tst_herror.cxx

tst_herror:  tst_herror.o herror.o
	$(CXX) -o tst_herror $(LDFLAGS)  tst_herror.o herror.o $(LIBS)

tst_harray.o: tst_harray.cxx  harray.hxx herror.hxx hregex.hxx strext.hxx string.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) tst_harray.cxx

tst_harray:  tst_harray.o herror.o strext.o hregex.o
	$(CXX) -o tst_harray $(LDFLAGS)  tst_harray.o herror.o strext.o hregex.o $(LIBS)

tst_hlog.o: tst_hlog.cxx  hlog.hxx
	$(CXX) -c $(INCLUDE) $(CFLAGS) tst_hlog.cxx

tst_hlog:  tst_hlog.o hlog.o
	$(CXX) -o tst_hlog $(LDFLAGS)  tst_hlog.o hlog.o $(LIBS)

targets:  libbasic.a tst_strext tst_ini tst_rx tst_herror tst_harray tst_hlog

clean_all:
	@echo "cleaning up..."
	@rm -f libbasic.a
	@rm -f strext.o
	@rm -f herror.o
	@rm -f hini.o
	@rm -f hregex.o
	@rm -f hlog.o
	@rm -f y2k.o
	@rm -f tst_strext
	@rm -f tst_strext.o
	@rm -f strext.o
	@rm -f herror.o
	@rm -f hregex.o
	@rm -f tst_ini
	@rm -f tst_ini.o
	@rm -f strext.o
	@rm -f herror.o
	@rm -f hini.o
	@rm -f hregex.o
	@rm -f tst_rx
	@rm -f tst_rx.o
	@rm -f herror.o
	@rm -f hregex.o
	@rm -f tst_herror
	@rm -f tst_herror.o
	@rm -f herror.o
	@rm -f tst_harray
	@rm -f tst_harray.o
	@rm -f herror.o
	@rm -f strext.o
	@rm -f hregex.o
	@rm -f tst_hlog
	@rm -f tst_hlog.o
	@rm -f hlog.o
	@echo "done."

install_all: targets
	@echo "installing binaries to INSTALLDIR=$(INSTALLDIR)" 
	@INSTALLDIR=$(INSTALLDIR);export INSTALLDIR;\
	CHMOD=555;export CHMOD; \
	INSTALLTYPE="BIN";export INSTALLTYPE;\
	INSTALLEXE=$(INSTALLEXE);export INSTALLEXE;\
	.simplemake/makeinstall  tst_strext tst_ini tst_rx tst_herror tst_harray tst_hlog $(INSTALLEXTRA)
	@echo "installing libraries to INSTALLLIB=$(INSTALLLIB)" 
	@INSTALLDIR=$(INSTALLLIB);export INSTALLDIR;\
	INSTALLTYPE="LIB";export INSTALLTYPE;\
	CHMOD=555;export CHMOD; \
	INSTALLEXE=$(INSTALLEXE);export INSTALLEXE;\
	.simplemake/makeinstall  libbasic.a
	@echo "installing headers to INSTALLHDR=$(INSTALLHDR)" 
	@INSTALLDIR=$(INSTALLHDR);export INSTALLDIR;\
	INSTALLTYPE="HDR";export INSTALLTYPE;\
	CHMOD=444;export CHMOD; \
	INSTALLEXE=$(INSTALLEXE);export INSTALLEXE;\
	.simplemake/makeinstall  harray.hxx herror.hxx strext.hxx string.hxx hregex.hxx herror.hxx herror.hxx hregex.hxx hlog.hxx strext.hxx string.hxx harray.hxx herror.hxx hini.hxx hregex.hxx strext.hxx string.hxx harray.hxx herror.hxx hini.hxx hregex.hxx hlog.hxx y2k.hxx strext.hxx string.hxx herror.hxx hregex.hxx

gzip: clean
	@echo "gzip -r..."
	@gzip -r .
	@echo "gunzip Makefile.gz Makefile.def.gz"; \
	gunzip Makefile.gz Makefile.def.gz
	@echo "done."

gunzip:
	@echo "gunzip -r..."
	@gunzip -r .
	@echo "done."

srcdist: clean
	@echo "Making source distribution for $(TAR)"
	@.simplemake/makesrcdist $(TAR)

newversion: clean
	@.simplemake/makever $(TAR)
