# Copyright (C) 2015 by the University of Southern California
# $Id: Makefile 24240 2015-05-29 22:00:18Z liangzhu $
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.  

CC=g++
CFLAGS=-std=c++11 -Wall #-DDEBUG -g
LFLAGS=-lldns -levent -levent_openssl -lssl -lcrypto #-levent_pthreads -lpthread #-lgnutls 
SOURCES=$(wildcard *.cc)
OBJECTS=$(patsubst %.cc,%.o,$(SOURCES))
CSOURCES=$(wildcard *.c)
COBJECTS=$(patsubst %.c,%.o,$(CSOURCES))
EXECUTABLE=tdns-svr-proxy

all: $(EXECUTABLE)

.PHONY:
	clean all

$(EXECUTABLE): $(OBJECTS) $(COBJECTS) #safe_queue.hh
	$(CC) -o $@ $(OBJECTS) $(COBJECTS) $(LFLAGS)

#%.o: %.c
.cc.o:
	$(CC) $(CFLAGS) -c $< -o $@
.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -rf *~ $(OBJECTS) $(COBJECTS) $(EXECUTABLE)

test:
	./$(EXECUTABLE) -s 8.8.8.8 -c ./cert -k ./pkey  -t tcp

readme:
	man ./README.man

package:
	today=`date +%Y%m%d`;\
	tar -czvf $(EXECUTABLE)-$$today.tar.gz *.cc *.c *.h *.hh Makefile README.man LICENSE.usc ChangeLog
