#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

CC=gcc

$(TGT):$(OBJS)
	$(CC) -o $(TGT) $(CFLAGS) $(MAIN) $(SRCS) $(INCDIR) $(LIBS)
	chmod a+x $(TGT)

$(OBJS):%.o:%.c
	$(CC) $(CFLAGS) -c -o $@ $< $(INCDIR)
clean:
	rm -rf $(OBJS) $(TGT)
