######################################################
#
#
# If you want to test the library, please use the following commands:
# $>make EXTRA=-DSELF_TEST
######################################################

TARGETS = ncc_comm

LIB 	= libncc_comm.so
LIB_OBJ = ncc_comm.o

CFLAGS :=	-I.\
	 	-I../inc \
		-I../leobox_Pro/inc \
		-I../jjbox/inc \
		-Wall -Werror 
CFLAGS += $(EXTRA)

LDFLAGS = -lleobox -ljjbox -lpthread

all: $(LIB)

test: $(TARGETS)

$(LIB): $(LIB_OBJ)
	$(CC) -Werror -shared -Wl,--whole-archive,-soname,$@ -o $@ $(LIB_OBJ) -Wl,--no-whole-archive

%: %.o
	$(CC) $(LDFLAGS) -g -o $@ $^

$.o: %.c
	$(CC) $(CFLAGS) -g -c -o $@ $< -g -Wp,-MD,.$<.dep

clean:
	rm -rf $(TARGETS) $(LIB_OBJ)  $(LIB) *.dep

install:
	install -m 755 $(LIB) $(LIBDIR)
