#
# Makefile
#
# Make file for Open Phone Abstraction library
#
# Copyright (c) 2001 Equivalence Pty. Ltd.
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is Open Phone Abstraction Library.
#
# The Initial Developer of the Original Code is Equivalence Pty. Ltd.
#
# Contributor(s): ______________________________________.
#
# $Revision: 22306 $
# $Author: rjongbloed $
# $Date: 2009-03-27 05:08:50 +0000 (Fri, 27 Mar 2009) $
#

include opal_defs.mak

SHELL		:= /bin/sh
OS_NAME=$(shell uname -s)
ifeq ($(OS_NAME),SunOS)
  override SHELL=/usr/bin/bash
endif

SUBDIRS := 

ifeq ($(OPAL_PLUGINS),yes)
SUBDIRS += plugins 
endif

ifeq ($(OPAL_SAMPLES),yes)
SUBDIRS += samples/simple samples/opalcodecinfo samples/callgen samples/c_api
endif


ifeq ($(DEBUG_BUILD),yes)
  LIB_FILENAME_STATIC=$(DEBUG_LIB_FILENAME_STATIC)
  LIB_FILENAME_SHARED=$(DEBUG_LIB_FILENAME_SHARED)
  LIB_FILENAME_SHARED_PAT=$(DEBUG_LIB_FILENAME_SHARED_PAT)
  OPAL_OBJDIR=$(DEBUG_OPAL_OBJDIR)
  OPAL_DEPDIR=$(DEBUG_OPAL_DEPDIR)
else
  LIB_FILENAME_STATIC=$(RELEASE_LIB_FILENAME_STATIC)
  LIB_FILENAME_SHARED=$(RELEASE_LIB_FILENAME_SHARED)
  LIB_FILENAME_SHARED_PAT=$(RELEASE_LIB_FILENAME_SHARED_PAT)
  OPAL_OBJDIR=$(RELEASE_OPAL_OBJDIR)
  OPAL_DEPDIR=$(RELEASE_OPAL_DEPDIR)
endif


ASN_SRCDIR := $(OPAL_SRCDIR)/asn
ASN_INCDIR := $(OPAL_INCDIR)/asn

VPATH_CXX := $(OPAL_SRCDIR)/opal \
	     $(OPAL_SRCDIR)/rtp \
	     $(OPAL_SRCDIR)/lids \
	     $(OPAL_SRCDIR)/codec \
             $(OPAL_SRCDIR)/t38 \
             $(OPAL_SRCDIR)/im

ifneq (,$(wildcard src/iax2))
IAX2_AVAIL = yes
VPATH_CXX += $(OPAL_SRCDIR)/iax2 
endif

ifneq (,$(wildcard src/zrtp))
ZRTP_AVAIL = yes
VPATH_CXX += $(OPAL_SRCDIR)/zrtp
endif

ifneq (,$(wildcard src/sip))
SIP_AVAIL = yes
VPATH_CXX += $(OPAL_SRCDIR)/sip
endif

ifneq (,$(wildcard src/h323))
H323_AVAIL = yes
VPATH_CXX += $(OPAL_SRCDIR)/h323 \
	     $(OPAL_SRCDIR)/t120 \
	     $(OPAL_SRCDIR)/asn 
endif

ifneq (,$(wildcard src/h224))
H224_AVAIL = yes
VPATH_CXX += $(OPAL_SRCDIR)/h224

endif

ifneq (,$(wildcard src/h460))
H460_AVAIL = yes
VPATH_CXX += $(OPAL_SRCDIR)/h460
endif

VPATH_C := $(OPAL_SRCDIR)/codec

########################################
# Source files for library

SOURCES := $(OPAL_SRCDIR)/opal/manager.cxx \
           $(OPAL_SRCDIR)/opal/endpoint.cxx \
           $(OPAL_SRCDIR)/opal/rtpep.cxx \
           $(OPAL_SRCDIR)/opal/connection.cxx \
           $(OPAL_SRCDIR)/opal/rtpconn.cxx \
           $(OPAL_SRCDIR)/opal/localep.cxx \
           $(OPAL_SRCDIR)/opal/call.cxx \
           $(OPAL_SRCDIR)/opal/mediafmt.cxx \
           $(OPAL_SRCDIR)/opal/mediatype.cxx \
           $(OPAL_SRCDIR)/opal/mediastrm.cxx \
           $(OPAL_SRCDIR)/opal/patch.cxx \
           $(OPAL_SRCDIR)/opal/transcoders.cxx \
           $(OPAL_SRCDIR)/opal/transports.cxx \
           $(OPAL_SRCDIR)/opal/guid.cxx \
           $(OPAL_SRCDIR)/opal/opalmixer.cxx \
	   $(OPAL_SRCDIR)/opal/opalglobalstatics.cxx \
           $(OPAL_SRCDIR)/rtp/rtp.cxx \
           $(OPAL_SRCDIR)/rtp/jitter.cxx \
	   $(OPAL_SRCDIR)/opal/opal_c.cxx \
	   $(OPAL_SRCDIR)/opal/pcss.cxx 

ifeq ($(OPAL_IVR), yes)
SOURCES += $(OPAL_SRCDIR)/opal/ivr.cxx \
           $(OPAL_SRCDIR)/opal/opalvxml.cxx 
endif


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

# H.323 files

ifeq ($(OPAL_H323),yes)
ifdef H323_AVAIL

H450_ASN_FILES := h4501 h4502 h4503 h4504 h4505 h4506 h4507 h4508 h4509 h45010 h45011
SIMPLE_ASN_FILES := x880 $(H450_ASN_FILES) mcs gcc

ASN_H_FILES   := $(addprefix $(ASN_INCDIR)/,$(addsuffix .h,  $(SIMPLE_ASN_FILES)))
ASN_CXX_FILES := $(addprefix $(ASN_SRCDIR)/,$(addsuffix .cxx,$(SIMPLE_ASN_FILES)))

ASN_H_FILES   += $(ASN_INCDIR)/h225.h
ASN_CXX_FILES += $(ASN_SRCDIR)/h225_1.cxx $(ASN_SRCDIR)/h225_2.cxx

ASN_H_FILES   += $(ASN_INCDIR)/h235.h $(ASN_SRCDIR)/h235_t.cxx
ASN_CXX_FILES += $(ASN_SRCDIR)/h235.cxx

ASN_H_FILES   += $(ASN_INCDIR)/h245.h
ASN_CXX_FILES += $(ASN_SRCDIR)/h245_1.cxx $(ASN_SRCDIR)/h245_2.cxx $(ASN_SRCDIR)/h245_3.cxx

ASN_H_FILES   += $(ASN_INCDIR)/h248.h
ASN_CXX_FILES += $(ASN_SRCDIR)/h248.cxx

ASN_H_FILES   += $(ASN_INCDIR)/h501.h
ASN_CXX_FILES += $(ASN_SRCDIR)/h501.cxx

.PRECIOUS: $(ASN_CXX_FILES) $(ASN_H_FILES)


SOURCES += $(ASN_CXX_FILES) \
           $(OPAL_SRCDIR)/h323/h323ep.cxx \
           $(OPAL_SRCDIR)/h323/h323.cxx \
           $(OPAL_SRCDIR)/h323/h323caps.cxx \
           $(OPAL_SRCDIR)/h323/h323neg.cxx \
           $(OPAL_SRCDIR)/h323/h323pdu.cxx \
           $(OPAL_SRCDIR)/h323/h323rtp.cxx \
           $(OPAL_SRCDIR)/h323/channels.cxx \
           $(OPAL_SRCDIR)/h323/svcctrl.cxx \
           $(OPAL_SRCDIR)/h323/h450pdu.cxx \
           $(OPAL_SRCDIR)/h323/q931.cxx \
           $(OPAL_SRCDIR)/h323/transaddr.cxx \
           $(OPAL_SRCDIR)/h323/gkclient.cxx \
           $(OPAL_SRCDIR)/h323/gkserver.cxx \
           $(OPAL_SRCDIR)/h323/h225ras.cxx \
           $(OPAL_SRCDIR)/h323/h323trans.cxx \
           $(OPAL_SRCDIR)/h323/h235auth.cxx \
           $(OPAL_SRCDIR)/h323/h501pdu.cxx \
           $(OPAL_SRCDIR)/h323/h323annexg.cxx \
           $(OPAL_SRCDIR)/h323/peclient.cxx \

ifeq ($(OPAL_H460), yes)
ifdef H460_AVAIL
SOURCES += $(OPAL_SRCDIR)/h460/h4601.cxx \
	   $(OPAL_SRCDIR)/h460/h46018.cxx \
	   $(OPAL_SRCDIR)/h460/h46019.cxx \
	   $(OPAL_SRCDIR)/h460/h4609.cxx \
	   $(OPAL_SRCDIR)/h460/h460p.cxx \
	   $(OPAL_SRCDIR)/h460/h460pres.cxx \
	   $(OPAL_SRCDIR)/h460/h460tm.cxx
endif
endif

ifdef OPAL_PTLIB_SSL
SOURCES += $(OPAL_SRCDIR)/h235auth1.cxx
endif

SOURCES += $(OPAL_SRCDIR)/t120/t120proto.cxx \
           $(OPAL_SRCDIR)/t120/h323t120.cxx \
           $(OPAL_SRCDIR)/t120/x224.cxx 

ifeq ($(OPAL_T38_CAP), yes)
SOURCES += $(OPAL_SRCDIR)/t38/h323t38.cxx
endif

ifeq ($(OPAL_HAS_H224), yes)
ifdef H224_AVAIL
SOURCES += $(OPAL_SRCDIR)/h224/h323h224.cxx
endif
endif

endif
endif

##################
# IAX2 files

ifeq ($(OPAL_IAX2), yes)
ifdef IAX2_AVAIL

SOURCES += \
           $(OPAL_SRCDIR)/iax2/callprocessor.cxx \
           $(OPAL_SRCDIR)/iax2/frame.cxx \
           $(OPAL_SRCDIR)/iax2/iax2con.cxx \
           $(OPAL_SRCDIR)/iax2/iax2ep.cxx \
           $(OPAL_SRCDIR)/iax2/iax2jitter.cxx \
           $(OPAL_SRCDIR)/iax2/iax2medstrm.cxx \
           $(OPAL_SRCDIR)/iax2/iedata.cxx \
           $(OPAL_SRCDIR)/iax2/ies.cxx \
           $(OPAL_SRCDIR)/iax2/processor.cxx \
           $(OPAL_SRCDIR)/iax2/receiver.cxx \
           $(OPAL_SRCDIR)/iax2/regprocessor.cxx\
           $(OPAL_SRCDIR)/iax2/remote.cxx \
           $(OPAL_SRCDIR)/iax2/safestrings.cxx \
           $(OPAL_SRCDIR)/iax2/sound.cxx \
           $(OPAL_SRCDIR)/iax2/specialprocessor.cxx \
           $(OPAL_SRCDIR)/iax2/transmit.cxx 
endif
endif

################################################################################
# ZRTP files

ifeq ($(OPAL_ZRTP),yes)
ifdef ZRTP_AVAIL

SOURCES += $(OPAL_SRCDIR)/zrtp/opalzrtp.cxx \
           $(OPAL_SRCDIR)/rtp/zrtpudp.cxx

endif
endif


################################################################################
# SIP files

ifeq ($(OPAL_SIP),yes)
ifdef SIP_AVAIL

SOURCES += $(OPAL_SRCDIR)/sip/sipep.cxx \
           $(OPAL_SRCDIR)/sip/sipcon.cxx \
           $(OPAL_SRCDIR)/sip/sippdu.cxx \
           $(OPAL_SRCDIR)/sip/sdp.cxx \
           $(OPAL_SRCDIR)/sip/handlers.cxx \

ifeq ($(OPAL_T38_CAP), yes)
SOURCES += $(OPAL_SRCDIR)/t38/sipt38.cxx
endif

endif
endif

##################
# H.224 files

ifeq ($(OPAL_HAS_H224), yes)
ifdef H224_AVAIL

SOURCES += $(OPAL_SRCDIR)/h224/q922.cxx \
	   $(OPAL_SRCDIR)/h224/h224.cxx \
	   $(OPAL_SRCDIR)/h224/h281.cxx
endif
endif

##################
# LIDS

ifeq ($(OPAL_LID), yes)

SOURCES += $(OPAL_SRCDIR)/lids/lid.cxx \
           $(OPAL_SRCDIR)/lids/lidep.cxx \
           $(OPAL_SRCDIR)/lids/lidpluginmgr.cxx \

endif

##################
# SRTP

ifeq ($(OPAL_SRTP), yes)
SOURCES += $(OPAL_SRCDIR)/rtp/srtp.cxx \

endif


####################################################
# Java interface

ifeq ($(OPAL_JAVA), yes)

JAVA_SRCDIR      = $(OPAL_SRCDIR)/java
JAVA_WRAPPER     = $(JAVA_SRCDIR)/java_swig_wrapper.c

VPATH_C         += $(JAVA_SRCDIR)
SOURCES         += $(JAVA_WRAPPER)

endif


##################
# T.38 Fax

ifeq ($(OPAL_FAX), yes)
SOURCES += $(OPAL_SRCDIR)/t38/t38proto.cxx \
           $(ASN_SRCDIR)/t38.cxx
endif


##################
# IM/MSRP

SOURCES += $(OPAL_SRCDIR)/im/t140.cxx \
	   $(OPAL_SRCDIR)/im/im_mf.cxx \
	   $(OPAL_SRCDIR)/im/rfc4103.cxx 

ifeq ($(OPAL_HAS_MSRP), yes)
SOURCES += $(OPAL_SRCDIR)/im/msrp.cxx 
endif
ifeq ($(OPAL_HAS_SIPIM), yes)
SOURCES += $(OPAL_SRCDIR)/im/sipim.cxx 
endif

##################
# Software codecs

SOURCES += $(OPAL_SRCDIR)/codec/g711codec.cxx \
           $(OPAL_SRCDIR)/codec/g711.c \
           $(OPAL_SRCDIR)/codec/g722mf.cxx \
           $(OPAL_SRCDIR)/codec/g7221mf.cxx \
           $(OPAL_SRCDIR)/codec/g7222mf.cxx \
           $(OPAL_SRCDIR)/codec/g7231mf.cxx \
           $(OPAL_SRCDIR)/codec/g726mf.cxx \
           $(OPAL_SRCDIR)/codec/g728mf.cxx \
           $(OPAL_SRCDIR)/codec/g729mf.cxx \
           $(OPAL_SRCDIR)/codec/gsm0610mf.cxx \
           $(OPAL_SRCDIR)/codec/gsmamrmf.cxx \
           $(OPAL_SRCDIR)/codec/iLBCmf.cxx \
           $(OPAL_SRCDIR)/codec/t38mf.cxx \
           $(OPAL_SRCDIR)/codec/rfc2833.cxx \
           $(OPAL_SRCDIR)/codec/opalwavfile.cxx \
	   $(OPAL_SRCDIR)/codec/silencedetect.cxx \
	   $(OPAL_SRCDIR)/codec/echocancel.cxx \
	   $(OPAL_SRCDIR)/codec/opalpluginmgr.cxx \
	   $(OPAL_SRCDIR)/codec/ratectl.cxx 

ifeq ($(OPAL_VIDEO), yes)
SOURCES += $(OPAL_SRCDIR)/codec/vidcodec.cxx 
endif

ifeq ($(OPAL_RFC4175), yes)
SOURCES += $(OPAL_SRCDIR)/codec/rfc4175.cxx
endif

ifeq ($(OPAL_G711PLC), yes)
SOURCES += $(OPAL_SRCDIR)/codec/g711a1_plc.cxx
endif

ifeq ($(OPAL_AEC), yes)

ifeq ($(SPEEXDSP_SYSTEM), no)

SPEEXDSP_SRCDIR    = $(OPAL_SRCDIR)/codec/speex/libspeex

VPATH_C         += $(SPEEXDSP_SRCDIR)
VPATH_CXX       += $(SPEEXDSP_SRCDIR)

SOURCES         += $(SPEEXDSP_SRCDIR)/speex_preprocess.c \
		   $(SPEEXDSP_SRCDIR)/smallft.c \
                   $(SPEEXDSP_SRCDIR)/misc.c \
                   $(SPEEXDSP_SRCDIR)/mdf.c \
                   $(SPEEXDSP_SRCDIR)/math_approx.c \
                   $(SPEEXDSP_SRCDIR)/kiss_fftr.c \
                   $(SPEEXDSP_SRCDIR)/kiss_fft.c \
                   $(SPEEXDSP_SRCDIR)/fftwrap.c
endif # SPEEXDSP_SYSTEM

endif # ifeq ($(OPAL_AEC), yes)

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

ifeq ($(OSTYPE),Darwin)
CFLAGS		+= -fno-common -dynamic
ARCHIVE			:= libtool -static -o
endif # Darwin

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

ifeq ($(OSTYPE),mingw)
LDFLAGS += -enable-auto-import -enable-runtime-pseudo-reloc -enable-stdcall-fixup -fatal-warning
endif # mingw

###############################################################################
# Build rules

.SUFFIXES:	.cxx .prc 

vpath %.cxx $(VPATH_CXX)
vpath %.cpp $(VPATH_CXX)
vpath %.c   $(VPATH_C)
vpath %.o   $(OPAL_OBJDIR)
vpath %.dep $(OPAL_DEPDIR)

#  clean whitespace out of source file list
SOURCES         := $(strip $(SOURCES))

#
# create list of object files 
#
SRC_OBJS := $(SOURCES:.c=.o)
SRC_OBJS := $(SRC_OBJS:.cxx=.o)
SRC_OBJS := $(SRC_OBJS:.cpp=.o)
OBJS	 := $(EXTERNALOBJS) $(patsubst %.o, $(OPAL_OBJDIR)/%.o, $(notdir $(SRC_OBJS) $(OBJS)))

#
# create list of dependency files 
#
SRC_DEPS := $(SOURCES:.c=.dep)
SRC_DEPS := $(SRC_DEPS:.cxx=.dep)
SRC_DEPS := $(SRC_DEPS:.cpp=.dep)
DEPS	 := $(patsubst %.dep, $(OPAL_DEPDIR)/%.dep, $(notdir $(SRC_DEPS) $(DEPS)))

#
# define rule for .cxx, .cpp and .c files
#
$(OPAL_OBJDIR)/%.o : %.cxx
	@if [ ! -d $(OPAL_OBJDIR) ] ; then mkdir -p $(OPAL_OBJDIR) ; fi
	$(CXX) $(CXXFLAGS) -c $< -o $@

$(OPAL_OBJDIR)/%.o :  %.c 
	@if [ ! -d $(OPAL_OBJDIR) ] ; then mkdir -p $(OPAL_OBJDIR) ; fi
	$(CC) $(CFLAGS) -c $< -o $@

#
# define rule for .dep files
#
$(OPAL_DEPDIR)/%.dep : %.cxx 
	@if [ ! -d $(OPAL_DEPDIR) ] ; then mkdir -p $(OPAL_DEPDIR) ; fi
	@printf %s $(OPAL_OBJDIR)/ > $@
	$(CXX) $(CXXFLAGS:-g=) -M $< >> $@

$(OPAL_DEPDIR)/%.dep : %.c 
	@if [ ! -d $(OPAL_DEPDIR) ] ; then mkdir -p $(OPAL_DEPDIR) ; fi
	@printf %s $(OPAL_OBJDIR)/ > $@
	$(CC) $(CFLAGS:-g=) -M $< >> $@


#####################################################################
# Main targets

# This target was intetionally put here since make dumbly executes the first it finds
# when called without an explicit target.

default:  Makefile $(OPAL_LIBDIR)/$(LIB_FILENAME_STATIC) $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED) subdirs

subdirs:
	@set -e; $(foreach dir,$(SUBDIRS),if test -d ${dir} ; then $(MAKE) -C $(dir); fi ; )

clean:
	rm -rf $(OPAL_LIBDIR)
	@set -e; $(foreach dir,$(SUBDIRS),if test -d ${dir} ; then $(MAKE) -C $(dir) clean; fi ; )

depend:   Makefile $(DEPS) 
	@set -e; $(foreach dir,$(SUBDIRS),if test -d ${dir} ; then $(MAKE) -C $(dir) depend; fi ; )


ifneq ($(wildcard $(OPAL_DEPDIR)/*.dep),)
include $(OPAL_DEPDIR)/*.dep
endif

Makefile: Makefile.in configure
	@echo
	@echo "*******************************************************"
	@echo Makefile is not up to date, is a ./configure necessary?
	@echo "*******************************************************"
	@false

ifdef JAVA_WRAPPER
ifneq (,$(SWIG))
$(JAVA_WRAPPER): $(JAVA_SRCDIR)/opal.i $(OPAL_INCDIR)/opal.h
	$(SWIG) -java -package org.opalvoip -w451 -I$(OPAL_INCDIR) -o $@ $<
endif
endif


#####################################################################
# Targets for the libraries

$(OPAL_LIBDIR)/$(LIB_FILENAME_STATIC): $(OBJS) 
	@if [ ! -d $(OPAL_LIBDIR) ] ; then mkdir $(OPAL_LIBDIR) ; fi
	$(ARCHIVE) $(OPAL_LIBDIR)/$(LIB_FILENAME_STATIC) $(OBJS)
ifeq ($(HAVE_RANLIB),yes)
	$(RANLIB) $(OPAL_LIBDIR)/$(LIB_FILENAME_STATIC)
endif

$(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED): $(OPAL_LIBDIR)/$(LIB_FILENAME_STATIC)

ifeq ($(OPAL_SHARED_LIB),yes)

  $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED): $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED_PAT)
	rm -f $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED) ; ln -sf  $(LIB_FILENAME_SHARED_PAT) $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED)

  $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED_PAT): $(OPAL_LIBDIR)/$(LIB_FILENAME_STATIC)
	@echo EXTLIBS = $(EXTLIBS)
	@echo SYSLIBS = $(SYSLIBS)
	@if [ ! -d $(OPAL_LIBDIR) ] ; then mkdir $(OPAL_LIBDIR) ; fi
	$(LD) $(LDSOOPTS) -o $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED_PAT) $(LDFLAGS) $(EXTLIBS) $(OBJS) $(LIBS)

endif # OPAL_SHARED_LIB


#####################################################################
# Install targets

install:
	mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir)
	$(INSTALL) -m 755 $(OPAL_LIBDIR)/$(LIB_FILENAME_STATIC) $(DESTDIR)$(libdir)
	$(INSTALL) -m 755 $(OPAL_LIBDIR)/$(LIB_FILENAME_SHARED_PAT) $(DESTDIR)$(libdir)
	ln -snf $(LIB_FILENAME_SHARED_PAT) $(DESTDIR)$(libdir)/$(LIB_FILENAME_SHARED)
	mkdir -p $(DESTDIR)$(libdir)/pkgconfig ; chmod 755 $(DESTDIR)$(libdir)/pkgconfig
	$(INSTALL) -m 644 opal.pc $(DESTDIR)$(libdir)/pkgconfig

	mkdir -p $(DESTDIR)$(includedir)/opal; chmod 755 $(DESTDIR)$(includedir)/opal
	$(INSTALL) -m 644 include/opal.h $(DESTDIR)$(includedir)/opal
	( for dir in asn codec h323 h460 iax2 im lids opal rtp sip t120 t38 zrtp; \
		do mkdir -p $(DESTDIR)$(includedir)/opal/$$dir ; chmod 755 $(DESTDIR)$(includedir)/opal/$$dir ; \
		( for fn in include/$$dir/*.h ; do \
			$(INSTALL) -m 644 $$fn $(DESTDIR)$(includedir)/opal/$$dir ; \
		done); \
	done)

ifeq ($(OPAL_PLUGINS),yes)
	$(MAKE) -C plugins install
endif

uninstall:
	( for filename in $(LIB_FILENAME_SHARED) \
                          $(LIB_FILENAME_SHARED_PAT) \
                          $(LIB_FILENAME_STATIC); \
	do rm -f $(DESTDIR)$(libdir)/$$filename ;\
	done)
	rm -rf $(DESTDIR)$(includedir)/opal
	rm -f $(DESTDIR)$(libdir)/pkgconfig/opal.pc

ifeq ($(OPAL_PLUGINS),yes)
	$(MAKE) -C plugins uninstall
endif


###############################################################################
# A collection or random useful targets

docs: FORCE
	cat opal_cfg.dxy > /tmp/docs.dxy ; echo HAVE_DOT=NO >> /tmp/docs.dxy
	doxygen /tmp/docs.dxy

graphdocs: FORCE
	cat opal_cfg.dxy > /tmp/docs.dxy ; echo HAVE_DOT=YES >> /tmp/docs.dxy
	doxygen /tmp/docs.dxy

FORCE:

opt:
	$(MAKE) DEBUG_BUILD=no

optdepend:
	$(MAKE) DEBUG_BUILD=no depend

debug:
	$(MAKE) DEBUG_BUILD=yes

debugdepend:
	$(MAKE) DEBUG_BUILD=yes depend

both: opt debug

all: optdepend opt debugdepend debug

update:
	svn -q update
	$(MAKE) all

distclean: clean
	rm -rf config.log config.err autom4te.cache config.status a.out aclocal.m4
	rm -rf lib*

# End of file #################################################################
