#
# Makefile 
#
# This file is part of
#
# LGMP -- Local Group based Multicast Protocol
#
# (C) 1996, 1997, 1998, 1999 Markus Hofmann and Jochen Schlick
#     (hofmann@acm.org)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
#    must display the following acknowledgement:
#      This product includes software developed by Markus Hofmann,
#      Jochen Schlick and other contributors.
# 4. Neither the name of the Authors nor the names of other contributors
#    may be used to endorse or promote products derived from this software
#    without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# (schlick@telematik.informatik.uni-karlsruhe.de)
#
#
# "$Id: Makefile,v 1.24 1999/02/20 13:56:06 schlick Exp $"
###############################################################################

#................................... include system/compiler dependant Rules ..
include ../Rules.Make


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

EXRUNDIR	= ../$(RUNDIR)
LGMP_INCDIR	= ../include/
LGMP_SRCDIR	= ../lgmp_src/

#..................................................................... Progs ..
EXPRGS	        = ex_dcp_static		\
		  ex_gc_msg	    	\
		  ex_gc_strm		\
		  ex_gc_msgublk		\
		  ex_gc_strmublk	\
		  ex_r_msg		\
		  ex_r_strm     	\
		  ex_r_msgublk  	\
		  ex_r_strmublk 	\
		  ex_s_norate		\
		  ex_s_rate      


#............................................................ static library ..
LIB		= -llgmp
LIBRARY		= liblgmp.a


#............................................ additional include-directories ..
INCLUDEDIRS     = -I. -I$(LGMP_INCDIR)

#................................................................. libraries ..
#................ additional libraries 
LOADLIBDIRS	= -L$(LGMP_SRCDIR) -L$(EXRUNDIR)
LOADLIBS	=  $(SYSTHRDLIBS) $(SYSDEPLIBS) $(LIB)

#..................................................................... shell ..
SHELL		= /bin/sh

#.............................................................  preprocessor ..
CPP		= $(COMPILER) $(INCLUDEDIRS) -E




###############################################################################
all:	examples
	-echo  "229.0.0.220  5001" > mclocaladdr


examples: $(EXPRGS)
	@echo "**************** make examples .............................."


#..................................................
install:
	@echo "**************** install examples --> $(EXRUNDIR) ..........."
	-mkdir -p $(EXRUNDIR)
	-cp -f $(EXPRGS)  $(EXRUNDIR)
	-echo  "229.0.0.220  5001" > $(EXRUNDIR)/mclocaladdr

#..................................................
clean:
	@echo "**************** clean examples ............................."
	-rm -f $(EXPRGS) *.o core *~ LOG.* yyyy.txt

osclean: clean
	@echo "**************** cleanup dependencies ......................."
	sed '/\#\#\# Dependencies/q' < Makefile > .makedep
	cp .makedep Makefile
	rm -f .makedep

installclean:
	@echo "**************** clean installed examples in $(EXRUNDIR) ..,."
	-rm -f $(EXRUNDIR)core $(EXRUNDIR)yyyy.txt $(EXRUNDIR)LOG.* 
	for ex in $(EXPRGS); do \
	  rm -f $(EXRUNDIR)$$ex; done;

mrproper: installclean osclean
	@echo "**************** mrproper/distclean examples ................"



#..................................................
dep:	depend

.depend: depend

depend:
	@echo "**************** remove dependencies ........................"
	sed '/\#\#\# Dependencies/q' < Makefile > .makedep
	@echo "**************** create dependencies ........................"
	(for i in *.c ;do $(CPP) -M $$i;done) >> .makedep
	cp .makedep Makefile
	rm -f .makedep



#............................................................ implicit rules ..
.c.o:
	$(COMPILER) $(CFLAGS) $(INCLUDEDIRS) -c $*.c

#.o:
#	$(COMPILER) $(LDFLAGS) -o $@  $^  $(LOADLIBDIRS) $(LOADLIBS)


#............................................................. phony targets ..
.PHONY: examples dep depend all clean mrproper distclean osclean


#..............................................................................


ex_dcp_static:		ex_dcp_static.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_s_norate:		ex_s_norate.o 
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_s_rate:		ex_s_rate.o 
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)


ex_r_msgublk:		ex_r_msgublk.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_r_strmublk:		ex_r_strmublk.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_r_msg:		ex_r_msg.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_r_strm:		ex_r_strm.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)


ex_gc_msgublk:		ex_gc_msgublk.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_gc_strmublk:		ex_gc_strmublk.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_gc_msg:		ex_gc_msg.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)

ex_gc_strm:		ex_gc_strm.o
	$(COMPILER) $(LDFLAGS) -o $@  $@.o  $(LOADLIBDIRS) $(LOADLIBS)



########################## end of Makefile ####################################
###############################################################################
### Do not remove the following line. We need this for depend #################
### Dependencies:
