LOCATION=authoring
#
# Add other locations as needed.
#
CC=g++
Cc=gcc

#ifeq ($(LOCATION),authoring)
 BOSTLIB=-L/usr/lib/boost
 BOSINCL=-L/usr/include/boost
 ARTKLIB=
 ARTKINCL=
#endif

SLIBS= -L/usr/lib $(BOSTLIB) $(LOG4LIB) -l boost_system -l boost_thread

ARTKFLAGS=-shared -fPIC -Wl,-soname,libAusRegEPPTK.so 

ifeq ($(LOCATION),authoring)
SINCL= -I include -I /usr/include/log4cpp  $(BOSINCL)
CFLAGS= -DCURRENT_DEBUG=1000  
endif

CLIBS= -L$(USRLIB) 

CLFLAGS= -Wall -Wundef -Wpointer-arith -Wshadow \
	 -Wcast-align -Winline -Wmissing-declarations -Wredundant-decls \
	 -Wmissing-prototypes -Wnested-externs \
	 -Wstrict-prototypes -Waggregate-return -Wno-implicit 

# --- targets
#

ifeq ($(LOCATION),authoring)
all:    cliever 
endif

cliever: build/drde-cliever 

.c.o:
	$(Cc) -c $(CLFLAGS) -o  $<

build/mdLogger.o: server/mdLogger.cpp include/mdLogger.h 
	$(CC) $(CFLAGS) server/mdLogger.cpp -c -o build/mdLogger.o $(SINCL)
	
build/cliever.o: server/cliever-md.cpp include/*.h
	$(CC) $(CFLAGS) server/cliever-md.cpp -c -o build/cliever.o $(SINCL)

build/drde-cliever: build/cliever.o  build/mdLogger.o 
	$(CC) $(CFLAGS) -o build/cliever $(SINCL) $(LIBS) build/mdLogger.o  $(SLIBS)
	
doxygen/index.html: etc/doxygen.config
	doxygen etc/doxygen.config 

# --- rebuild on copy to a new host
distclean:
	clrbak
	rm -rf build
	rm -rf doxygen
	mkdir doxygen
	mkdir build
	touch etc/doxygen.config

clean:
	clrbak
	find ./build -name "*.o"   -print | perl -ne "print;chop;unlink"
	find ./build -name "*.rpo" -print | perl -ne "print;chop;unlink"
	rm build/drde-cliever