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

CFLAGS := $(CFLAGS_LIB) -I../tinySAK/src -I../tinyNET/src -I../tinySDP/include -I./include
LDFLAGS := $(LDFLAGS_LIB) -ltinySAK_$(MARCH) -ltinyNET_$(MARCH) -ltinySDP_$(MARCH) -lm

all: $(APP)

OBJS = \
	src/tmedia.o \
	src/tmedia_codec.o \
	src/tmedia_codec_dummy.o \
	src/tmedia_common.o \
	src/tmedia_consumer.o \
	src/tmedia_converter_video.o \
	src/tmedia_defaults.o \
	src/tmedia_denoise.o \
	src/tmedia_imageattr.o \
	src/tmedia_jitterbuffer.o \
	src/tmedia_params.o \
	src/tmedia_producer.o \
	src/tmedia_qos.o \
	src/tmedia_resampler.o \
	src/tmedia_session.o \
	src/tmedia_session_dummy.o \
	src/tmedia_session_ghost.o \
	\
	src/content/tmedia_content.o \
	src/content/tmedia_content_cpim.o \
	src/content/tmedia_content_multipart.o \
	src/content/tmedia_content_sip_frag.o
	

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

%.o: %.c
	$(CC) -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)
	
clean:
	@rm -f $(OBJS) $(APP)