
TANGO_DIR ?= /c/tango_root/tango/win64/include/vc10
OMNIORB_DIR ?= /c/tango_root/tango/win64/include/vc10/omniORB4
RUNTIME_DIR ?= /runtime

TANGO_INC = ${TANGO_DIR}/include/tango
OMNIORB_INC = ${OMNIORB_DIR}/include
RUNTIME_INC = ${RUNTIME_DIR}/include

INC_DIR = -I${TANGO_INC} -I${OMNIORB_INC} -I${RUNTIME_INC}

TANGO_LIB = ${TANGO_DIR}/lib
OMNIORB_LIB = ${OMNIORB_DIR}/lib
RUNTIME_LIB = ${RUNTIME_DIR}/lib

LIB_DIR = -L${TANGO_LIB} -L${OMNIORB_LIB} -L${RUNTIME_LIB} -L/usr/local/lib

#-----------------------------------------
#	 Default make entry
#-----------------------------------------
default: release
release debug: bin/$(NAME_SRV)

#-----------------------------------------
#	Set CXXFLAGS and LDFLAGS
#----------------------------------------r
CXXFLAGS += -D__linux__ -D__OSVERSION__=2 -pedantic -Wall -Wextra \
	-Wno-non-virtual-dtor -Wno-long-long -DOMNI_UNLOADABLE_STUBS \
	$(INC_DIR) -Isrc
LDFLAGS += $(LIB_DIR) -ltango -llog4tango -lomniORB4 -lomniDynamic4 \
	-lCOS4 -lomnithread -lzmq

#-----------------------------------------
#	Set dependencies
#-----------------------------------------
SRC_FILES += $(wildcard src/*.cpp)
OBJ_FILES += $(addprefix obj/,$(notdir $(SRC_FILES:.cpp=.o)))

obj/%.o: $(SRC_FILES:%.cpp)
	$(CXX) $(CXXFLAGS) -c -o $@ $<

.nse_depinfo: $(SRC_FILES)
	@$(CXX) $(CXXFLAGS) -M -MM $^ | sed 's/\(.*\)\.o/obj\/\1.o/g' > $@
-include .nse_depinfo

#-----------------------------------------
#	 Main make entries
#-----------------------------------------
bin/$(NAME_SRV): bin obj $(OBJ_FILES)
	$(CXX) $(CXXFLAGS) $(OBJ_FILES) -o bin/$(NAME_SRV) $(LDFLAGS)

clean:
	@rm -fr obj/ bin/ core* .nse_depinfo src/*~

bin obj:
	@mkdir $@

#-----------------------------------------
#	 Target specific options
#-----------------------------------------
release: CXXFLAGS += -O2 -DNDEBUG
release: LDFLAGS += -s
debug: CXXFLAGS += -ggdb3

.PHONY: clean
