########################################################
#
# Makefile for plantlib.so installation and 
# related examples' building...
#
# (c) 1996 a.cella (cella@marvin.conecta.it)
# please see the gnu GPL license v.2
#
# feel free to modify the variables to suit your needs
#
########################################################
######
###### YOU MUST RUN THIS AS ROOT (gently, djently, ...)
###
### where do i have to install the library?
### (defaults to /usr/local/lib)
###
### you might want to change this...
###
LOCAL_LIBS_DIR=/usr/local/lib
###


#################################################
##
## you shouldn't need to modify these ones...
##
#################################################
all: install examples
	
#
# lib definitions
#
LIBNAME=libplant
LIBVERS=0.8.1
SYMLINKLIBNAME=libplant.so
REALLIBNAME=$(LIBNAME).so.$(LIBVERS)

#
# where the examples are...
#
EXAMPLES_DIRS=examples/exch examples/thandler


##################################################
##
## don't modify anything below this line
##
###################################################
.PHONY: examples cleanexamples stripexamples install

examples: 
	@for EDIR in $(EXAMPLES_DIRS); do make -C $$EDIR; done

cleanexamples:
	@for EDIR in $(EXAMPLES_DIRS); do make -C $$EDIR clean; done

stripexamples:
	@for EDIR in $(EXAMPLES_DIRS); do make -C $$EDIR strip; done
	

install:
	@echo "installing "$(LIBNAME)" ("$(SYMLINKLIBNAME)")\
	in "$(LOCAL_LIBS_DIR)" ..."
	@cp  $(REALLIBNAME) $(LOCAL_LIBS_DIR)
	@echo "adding symbolic link..."
	@ln -s $(LOCAL_LIBS_DIR)/$(REALLIBNAME) $(LOCAL_LIBS_DIR)/$(SYMLINKLIBNAME)
	@echo "running ldconfig..."
	@ldconfig
	@echo "all done!"



