########################################################################
#
#	Makefile
#
########################################################################

CXX     =       $(OWCDIR)/bin/CC
CXXFLAGS =      -g
QUIET_CXX =     $(CXX)

PREPRO_CLEAN = sed -e 's/\#line/\/\/\#line/'
EXES	=	vphysdemo

HXXFILES =	vphys_serv.hxx vphys_peer.hxx vphys.hxx
CFILES	=	vphys_serv.cx vphys_peer.cx vphys.cx
OFILES	=	vphys_serv.o vphys_peer.o vphys.o

LIBES	=	$(OTSO_LIBES)
		
all:		$(EXES) 

inst-all:	$(LIBDIR)libvphys.a

$(LIBDIR)libvphys.a:	libvphys.a
		-rm -f $@
		@# update .hxx interfaces
		for i in $(HXXFILES); \
		  do (echo $$i; \
		    rm -rf $(PINCDIR)$$i; \
		    cp $$i $(PINCDIR)$$i); \
		  done
		cp libvphys.a $@
		-rm $(TOPDIR)libvphys.a
		@$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib
		-@ls -gls $@
		-@echo ""

libvphys.a:	vphysvrsn.o
		-rm -f $@
		@$(UTILDIR)make-lib.sh $(SYSTEM) $(ARFLAGS) $@ $(OFILES) \
			vphysvrsn.o
		-@rm -f $(TOPDIR)libvphys.a 
		-@$(LN) libvphys.a $(TOPDIR)libvphys.a
		-@ls -l $@
		-@echo "libvphys built normally"

vphysdemo:	$(OFILES) vphys_demo.o $(LIBES) 
		-@echo "compiling vphysdemo: "
		$(CXX) -o vphysdemo  vphys_demo.o $(OFILES) $(LIBES) 

vphys_demo.o:	vphys_demo.cx vphys_demo.hx

vphysvrsn.c:	$(OFILES)
		@$(UTILDIR)version.sh tran > $@

################################################################
# clean
################################################################
clean:;		-rm -f $(CLEANSTRINGS) *.[chi]xx vphysdemo
