# Makefile
# This file holds the make rules for the Telephony Engine test cases

CXX := @CXX@ -Wall
SED := sed
DEFS :=
INCLUDES := -I@top_srcdir@
CFLAGS := -O0 @MODULE_CPPFLAGS@ @INLINE_FLAGS@
LDFLAGS:= @LDFLAGS@
YATELIBS:= -L../.. -lyate @LIBS@
MODFLAGS:= @MODULE_LDFLAGS@
MODSTRIP:= @MODULE_SYMBOLS@

MKDEPS  := ../../config.status
PROGS = randcall.yate
LIBS =
OBJS =

LOCALFLAGS =
LOCALLIBS =
COMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CFLAGS)
LINK = $(CXX) $(LDFLAGS)
MODLINK = $(CXX) $(MODFLAGS) $(MODSTRIP) $(LDFLAGS)
MODCOMP = $(COMPILE) $(MODFLAGS) $(MODSTRIP) $(LDFLAGS)

prefix = @prefix@
exec_prefix = @exec_prefix@

# include optional local make rules
-include YateLocal.mak

.PHONY: all
all: $(LIBS) $(PROGS)

.PHONY: strip
strip: all
	strip --strip-debug --discard-locals $(PROGS)

.PHONY: clean
clean:
	@-$(RM) $(PROGS) $(LIBS) $(OBJS) core 2>/dev/null

%.o: @srcdir@/%.cpp $(MKDEPS) @top_srcdir@/yateclass.h @top_srcdir@/yatengine.h
	$(COMPILE) -c $<

Makefile: @srcdir@/Makefile.in $(MKDEPS)
	cd ../.. && ./config.status

lib%.so: %.o
	$(LINK) -shared -o $@ $^

%.yate: @srcdir@/%.cpp $(MKDEPS) $(INCFILES)
	$(MODCOMP) -o $@ $(LOCALFLAGS) $< $(LOCALLIBS) $(YATELIBS)
