# Set our CommEngine directory (by splitting the pwd into two words
# at /userspace and taking the first word only).
# Then include the common defines under CommEngine.
#
CURR_DIR := $(shell pwd)
BUILD_DIR:=$(subst /userspace, /userspace,$(CURR_DIR))
BUILD_DIR:=$(word 1, $(BUILD_DIR))

include $(BUILD_DIR)/make.common


#LIBS = -lcms_dal -lcms_msg $(CMS_COMMON_LIBS) -ldl $(CMS_CORE_LIBS)

#
# Private apps and libs are allowed to link with libraries from the
# private and public directories.
#
# WARNING: Do not modify this section unless you understand the
# license implications of what you are doing.
#
#ALLOWED_LIB_DIRS := /lib:/lib/private:/lib/public

LIBS = -lZBDevice

EXE = PTZ110PA
OBJS = PTZ110PA.o

all:  $(EXE)


dynamic: all install

install:
	install -m 755 $(TOOLCHAIN)/mips-linux-uclibc/lib/libstdc++.so.6 $(INSTALL_DIR)/lib
	mkdir -p $(INSTALL_DIR)/usr/lib
	install -m 755 ../lib/libZBDevice.so ../lib/libZ101a.so ../lib/libB2A.so $(INSTALL_DIR)/usr/lib
#	mkdir -p $(INSTALL_DIR)/testZ110
#	install -m 755 $(EXE) $(INSTALL_DIR)/testZ110
#	$(STRIP) $(INSTALL_DIR)/testZ110/$(EXE)
	install -m 755 $(EXE) $(INSTALL_DIR)/bin
	install -m 777 testZ110.sh $(INSTALL_DIR)/bin
#	install -m 755 ./lib/libTCPClient4l.so1 ./lib/libTCPClient.so libTCPClient4l.so ./lib/libZ101b.so $(INSTALL_DIR)/testZ110
#	install -m 755 ./lib/libZ101b.so $(INSTALL_DIR)/testZ110
	install -m 755 ../lib/libZ101b.so $(INSTALL_DIR)/lib
        
$(EXE): $(OBJS)
#	$(CXX) -o $@ $(OBJS) -lZBDevice -Wl,--rpath-link ./lib -I/opt/toolchains/uclibc-crosstools-gcc-4.4.2-1/usr/include -L./lib
	$(CXX) -o $@ $(OBJS) -Wl,-allow-shlib-undefined  -L../lib/ -lpthread -ldl $(LIBS)

$(EXE).a: $(OBJS)
	$(AR) rcs $@ $(OBJS)
	
clean:
	-rm -f $(EXE) *.o *.d  $(EXE).a

include ../../../../../make.deprules

-include $(OBJS:.o=.d)
