Skip to content
Snippets Groups Projects
Makefile 3.59 KiB
Newer Older
Teresa Nunez's avatar
Teresa Nunez committed
#=============================================================================
#
# file :        Makefile
#
# description : Include for the Keithley428 class.
#
# project :     Makefile to generate a Tango server
#
# $Author:  $
#
# $Revision: $
#
#
# copyleft :    European Synchrotron Radiation Facility
#               BP 220, Grenoble 38043
#               FRANCE
#
#=============================================================================
#  		This file is generated by POGO
#	(Program Obviously used to Generate tango Object)
#
#         (c) - Software Engineering Group - ESRF
#=============================================================================
#

CLASS      = Keithley428
MAJOR_VERS = 1
MINOR_VERS = 1
RELEASE    = Release_$(MAJOR_VERS)_$(MINOR_VERS)

ifndef _ARCH
	_ARCH = $(shell uname -m)
endif
ifeq ($(_ARCH), x86_64)
	libdir=lib64
else
	libdir=lib
endif
#-----------------------------------------
#	Set default home directories
#-----------------------------------------


TANGO_HOME   =  /usr/local
ABS_CLASS    =
CPP_SERVERS  =  $(TANGO_DIR)/Libraries/cppserver
UTIL_DIR=$(TANGO_DIR)/Libraries/util/trunk

ifdef no_debug
	DEBUG = -O
else
	DEBUG = -g
endif

#
# if 'make using_trunk=1' use the trunk directories
#
ifdef using_trunk
  CTRL_DIR = $(TANGO_DIR)/DeviceClasses/Communication/GpibDeviceServer/trunk
else
  CTRL_DIR = $(shell find $(TANGO_DIR)/DeviceClasses/Communication/GpibDeviceServer/tags -type d -regex '.*Release_[0-9]*_[0-9]*' | sort -t '_' -k2 -k3 -nr | head -1)
endif

INCLUDE_DIRS =  -I$(TANGO_HOME)/include/tango \
		-I/usr/local/include \
		-I.	\
		-I$(CTRL_DIR) \
                -I$(CPP_SERVERS)/include

OBJS_DIR    = obj
LIB_DIRS    = 	-L $(TANGO_HOME)/$(libdir) \
		-L /usr/local/$(libdir) \
		-L $(CPP_SERVERS)/$(libdir)



#-----------------------------------------
#	Set  CXXFLAGS and LFLAGS
#-----------------------------------------
CXXFLAGS =  $(DEBUG) -D_REENTRANT $(INCLUDE_DIRS)
LFLAGS =  $(DEBUG) $(LIB_DIRS)  		\
				-ltango			\
				-llog4tango		\
				-lomniORB4 		\
				-lomniDynamic4	\
				-lomnithread	\
				-lCOS4			\
				-lGpibDeviceServer \
				/usr/local/$(libdir)/libgpib.a \
				-ldl -lpthread 




#-----------------------------------------
#	Set  dependences
#-----------------------------------------

SVC_OBJS = $(OBJS_DIR)/main.o	\
		$(OBJS_DIR)/ClassFactory.o	\
		$(OBJS_DIR)/$(CLASS)Class.o	\
		$(OBJS_DIR)/$(CLASS)StateMachine.o	\
		$(OBJS_DIR)/$(CLASS).o

SVC_INC = $(CLASS)Class.h \
		$(CLASS).h


$(OBJS_DIR)/%.o: %.cpp $(SVC_INC)
	$(CXX) $(CXXFLAGS) -c $< -o $(OBJS_DIR)/$*.o

#-----------------------------------------
#	 Make Entry
#-----------------------------------------
all: other_classes $(CLASS)

other_classes: 
	@echo -e "\n >>> Making $(CPP_SERVERS)/$(libdir)/libGpibDeviceServer.a \n"
	cd $(CTRL_DIR) && make linux=1 lib

$(CLASS):	make_obj_dir make_bin_dir $(SVC_OBJS)
	$(CXX) $(SVC_OBJS) -o $(CLASS) $(LFLAGS)
	@mv $(CLASS) bin/$(CLASS)

clean:
	rm -f $(OBJS_DIR)/*.o  \
	$(OBJS_DIR)/*.so.o \
	bin/$(CLASS) \
	core

make_obj_dir:
	@mkdir -p obj

make_bin_dir:
	@mkdir -p bin

#-----------------------------------------
#	 Install binary file
#-----------------------------------------
install:
	cp bin/$(CLASS)  $(DESTDIR)


#----------------------------------------------------
#	Tag the SVN module corresponding to this class
#----------------------------------------------------
tag:
ifeq ($(shell ls -d ../tags/$(RELEASE) 2>/dev/null ), ../tags/$(RELEASE))
	@echo $(RELEASE) exists, specify new version numbers
else
	svn copy ../trunk ../tags/$(RELEASE)
	svn commit ../tags/$(RELEASE) \
	-m "Tagging the $(RELEASE) of the $(CLASS) project."
endif

show_tag:
	@cvstag -d