RSS Git Download  Clone
Raw Blame History
################################################################################
# Makefile for BString class
#		T.Barnaby,	BEAM Ltd,	19/6/91
# updated by	D.Korchagin,	CERN AB-BI-SW,	2007-08-31
################################################################################
#

TOP	= ../..
include ${TOP}/Makefile.config

VERSION_H	= $(shell echo ${VERSION} | awk  'BEGIN { FS="."}{ print $$1; }')
VERSION_M	= $(shell echo ${VERSION} | awk  'BEGIN { FS="."}{ print $$2; }')
VERSION_L	= $(shell echo ${VERSION} | awk  'BEGIN { FS="."}{ print $$3; }')

DEBUGFLAGS	= -g -O2 -DDEBUG
LDLIBS		= -lmysqlclient -lcurl -lpthread

OBJS	= BRefData.o BString.o BError.o BFile.o BConfig.o BTime.o
OBJS	+= BCond.o BCondInt.o BMutex.o BSema.o BSemaphore.o BRWLock.o
OBJS	+= BDate.o BTimeStamp.o BTimeStampMs.o 
OBJS	+= BObj.o
OBJS	+= BObjStringFormat.o

ifeq ("${BEAMLIB_BUILD}", "LINUX")
OBJS	+= BEndian.o BBuffer.o BEntry.o BDir.o
OBJS	+= BThread.o 
OBJS	+= BRtc.o BTimer.o BPoll.o BSocket.o BEvent.o
OBJS	+= Boap.o BoapnsD.o BoapnsC.o
OBJS	+= BFifoCirc.o
OBJS	+= BDuration.o
OBJS	+= BDebug.o BDict.o BTable.o
OBJS	+= BErrorTime.o
OBJS	+= BoapMc.o BComms.o
OBJS	+= BFileData.o BFileCsv.o
OBJS	+= BCrc16.o
OBJS	+= BEvent1.o
ifneq ("$(DIST)", "el5")
OBJS	+= BSpi.o
endif
endif

ifeq ("${BEAMLIB_BUILD}", "FULL")
OBJS	+= BEndian.o BBuffer.o BEntry.o BDir.o
OBJS	+= BThread.o 
OBJS	+= BRtc.o BTimer.o BPoll.o BSocket.o BEvent.o
OBJS	+= Boap.o BoapnsD.o BoapnsC.o
OBJS	+= BFifoCirc.o
OBJS	+= BDuration.o
OBJS	+= BDebug.o BDict.o BTable.o
OBJS	+= BErrorTime.o
OBJS	+= BoapMc.o BComms.o
OBJS	+= BFileData.o BFileCsv.o
OBJS	+= BCrc16.o
OBJS	+= BEvent1.o
OBJS	+= BUrl.o
OBJS	+= BMysql.o 
ifneq ("$(DIST)", "el5")
OBJS	+= BSpi.o
endif
endif

OBJS	:= $(addprefix ${BUILDDIR},${OBJS})
LIB	= ${BUILDDIR}libBeam.a
LIBSO	= ${BUILDDIR}libBeam.so

# General
ifeq ("${BEAMLIB_BUILD_SHAREDLIBS}", "YES")
all:	includes ${LIB} ${LIBSO} install_src_static install_src_shared
install: all install_includes install_static install_shared
else
all:	includes ${LIB} install_src_static
install: all install_includes install_static
endif

info:
	@echo "Build: ${BUILD}"
	@echo "Target: ${TARGET}"
	@echo "Dist: ${DIST}"

includes:
	-mkdir -p $(SRCINCDIR)/Beam
	cp $(CPFLAGS) *.h *.inc $(SRCINCDIR)/Beam

install_src_shared:
	-mkdir -p $(SRCLIBDIR)
	cp -a $(CPFLAGS) ${LIB} $(SRCLIBDIR)
	cp -a $(CPFLAGS) ${LIBSO}* $(SRCLIBDIR)

install_src_static:
	-mkdir -p $(SRCLIBDIR)
	cp -a $(CPFLAGS) ${LIB} $(SRCLIBDIR)

install_includes:
	-mkdir -p $(INCDIR)/Beam
	cp *.h *.inc $(INCDIR)/Beam

install_shared:
	mkdir -p $(LIBDIR)
	cp -a $(CPFLAGS) ${LIBSO}* $(LIBDIR)

install_static:
	mkdir -p $(LIBDIR)
	cp -a $(CPFLAGS) ${LIB} $(LIBDIR)

clean:
	rm -f ${OBJS} $(OBJS:.o=.d) $(LIB) ${LIBSO}*

update:
	cp $(CPFLAGS) ../boapns/BoapnsC.h .
	cp $(CPFLAGS) ../boapns/BoapnsD.h .
	cp $(CPFLAGS) ../boapns/BoapnsC.cc BoapnsC.cpp
	cp $(CPFLAGS) ../boapns/BoapnsD.cc BoapnsD.cpp

${LIB}:	$(OBJS)
	rm -f ${LIB}
	ar cq ${LIB} $(OBJS)
	$(RANLIB) ${LIB}

${LIBSO}:	$(OBJS)
	rm -f ${LIBSO}*
	$(LINK.cc) -shared -Wl,-soname,libBeam.so.$(VERSION_H) -o ${LIBSO}.$(VERSION_H).$(VERSION_M).$(VERSION_L) $(OBJS) $(LDFLAGS) $(LDLIBS)
	ln -sf libBeam.so.$(VERSION_H).$(VERSION_M).$(VERSION_L) ${LIBSO}.$(VERSION_H)
	ln -sf libBeam.so.$(VERSION_H) ${LIBSO}

# Depenancies
-include $(OBJS:.o=.d)