#make gnproto

####################### IDC #########################################
TOPDIR:=.
TGT:=./fdSHApp

DIR=$(TOPDIR)/libfdcore $(TOPDIR)/libfdproto $(TOPDIR)/freeDiameterd $(TOPDIR)/extensions/sh_app  $(TOPDIR)/include/freeDiameter
SRCS=$(foreach dir, $(DIR), $(wildcard $(dir)/*.c))
OBJS:=$(patsubst %.c,%.o,$(SRCS))
MAIN=$(TOPDIR)/daemon/daemon.c

INCDIR=$(foreach dir, $(DIR), -I $(dir)/ )
LIBS=-lpthread -ldl -lcrypt -lnsl -lm -lrt  -lsctp -lgcrypt -lgnutls /usr/lib/x86_64-linux-gnu/libidn.a

CFLAGS=-Wall -g -DDEBUG -DX86_64 -lm -lrt -ldl -lsctp -lgcrypt -lgnutls -lpthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include/ -I/usr/local/lib/glib-2.0/include  -L/usr/local/lib -lglib-2.0

#CFLAGS=-Wall -g -DDEBUG -DX86_64 -lm -lrt -ldl -lsctp -lgcrypt -lgnutls -lpthread

CC=gcc

$(TGT):$(OBJS)
	if [ ! -d $(TOPDIR)/lib ]; then mkdir $(TOPDIR)/lib; fi
	$(AR) -rcs $(TOPDIR)/lib/libdiameter.a $(OBJS)

$(OBJS):%.o:%.c
	$(CC) $(CFLAGS) -c -o $@ $< $(INCDIR)

clean:
	rm -rf $(OBJS) $(TGT)
	rm -rf $(TOPDIR)/lib/libdiameter.a
