#
# 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.ext,v 1.22 1999/02/20 13:55:28 schlick Exp $"
###############################################################################

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


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

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


#..................................................................... Progs ..
TESTPRGS1	= test_dcp_static	\
		  test_s                \
		  test_r

TESTPRGS	= $(TESTPRGS1)

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



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

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

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

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




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


test:   test1

test1:	testprgs1

testprgs1: $(TESTPRGS1)
	@echo "**************** make testprgs(1)............................"


#..................................................
install:
	@echo "**************** install testprgs --> $(TESTRUNDIR) ........."
	-mkdir -p $(TESTRUNDIR)
	-cp -f $(TESTPRGS)  $(TESTRUNDIR)
	-cp    lgmpdcp.ini  $(TESTRUNDIR)
	-echo  "229.0.0.220  5001" > $(TESTRUNDIR)mclocaladdr


#..................................................
clean:
	@echo "**************** clean testprgs ............................."
	rm -f $(TESTPRGS) *.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 testprgs in $(TESTRUNDIR) .."
	-rm -f $(TESTRUNDIR)core* $(TESTRUNDIR)yyyy.txt 
	-rm -f $(TESTRUNDIR).lgmpdcp.ini 
	-rm -f $(TESTRUNDIR)lgmpdcp.ini $(TESTRUNDIR)mclocaladdr
	-rm -f $(TESTRUNDIR)LOG.*
	for te in $(TESTPRGS); do \
	  -rm -f $(TESTRUNDIR)$$te; done;

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


#..................................................
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: testprgs dep depend all clean mrproper distclean osclean test1 test2


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

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

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

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



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