APP := lib$(PROJECT).$(EXT)

CFLAGS := $(CFLAGS_LIB) -fno-rtti -fno-exceptions -I../../_common -I../../. -I../../../tinySAK/src -I../../../tinyNET/src -I../../../tinyHTTP/include -I../../../tinySIP/include
LDFLAGS := $(LDFLAGS_LIB) -lstdc++ -ltinySAK -ltinyHTTP -ltinyIPSec -ltinyNET -ltinySIP



all: $(APP)

OBJS = tinyWRAP_wrap.o\
	../../_common/MessagingEvent.o \
	../../_common/PublicationEvent.o \
	../../_common/PublicationSession.o \
	../../_common/RegistrationEvent.o \
	../../_common/RegistrationSession.o \
	../../_common/SafeObject.o \
	../../_common/SipCallback.o \
	../../_common/SipDebug.o \
	../../_common/SipEvent.o \
	../../_common/SipMessage.o \
	../../_common/SipSession.o \
	../../_common/SipStack.o \
	../../_common/SipUri.o \
	../../_common/SubscriptionEvent.o \
	../../_common/SubscriptionSession.o


$(APP): $(OBJS)
ifeq ($(EXT), a)
	$(AR) rcs $@ $^
else
	$(CC) $(LDFLAGS) -o $@ $^
endif

%.o: %.cxx
	$(CPP) -c $(INCLUDE) $(CFLAGS) $< -o $@
	
install: $(APP)
	$(ANDROID_SDK_ROOT)/tools/adb remount
	$(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(LIB_DIR)/$(APP)
	$(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(LIB_DIR)/$(APP)

shell:
	$(ANDROID_SDK_ROOT)/tools/adb shell

run:
	$(ANDROID_SDK_ROOT)/tools/adb shell $(LIB_DIR)/$(APP)
	
clean:
	@rm -f $(OBJS) $(APP)