RSS Git Download  Clone
Raw Blame History
################################################################################
#	Makefile settings for TMS System
################################################################################
#

# The main version
PROJECT		= TMS
VERSION		= 2.3.0
RELEASE		= 1.beam

# CERN Internal BUILD
#BUILD_ENV	= CERN

# The BUILD type
BUILD		?= FULL
#BUILD		?= CLIENT
#BUILD		?= LIB
BEAMLIB_BUILD	= LINUX

# The TARGET system. el7 is base 32bit system for TMS System. el7_64 is 64bit version for client systems
TARGET		?= fc39
#TARGET		?= el7_64
#TARGET		?= el7

#TARGET		?= fc25
#TARGET		?= fc16
#TARGET		?= el6
#TARGET		?= fc6
#TARGET		?= rh7
#TARGET		?= fpgaLinux
#TARGET		?= lynxos

ARCH		?= $(shell arch)


DEST_DIR	= 
PREFIX		= /usr/tms
#RPM_DIR	= /usr/src/redhat
RPM_DIR		= /scratch/rpms
#RPM_DIR	= $(HOME)/rpmbuild
DIST_DIR	= /dist/tms

RELEASE_RPM	:= ${RELEASE}.${TARGET}

SYSETCDIR	= $(DEST_DIR)/etc
SYSSYSTEMD	= $(DEST_DIR)/usr/lib/systemd
SYSDATADIR	= $(DEST_DIR)/data
BINDIR		= $(DEST_DIR)/$(PREFIX)/bin
INCDIR		= $(DEST_DIR)/$(PREFIX)/include
LIBDIR		= $(DEST_DIR)/$(PREFIX)/${ARCH_LIB}
DOCDIR		= $(DEST_DIR)/$(PREFIX)/doc
HTMLDIR		= $(DEST_DIR)/$(PREFIX)/html

DESKTOPDIR	= $(DEST_DIR)/usr/share/applications
DESKTOPDIRDIR	= $(DEST_DIR)/usr/share/desktop-directories
ICONSDIR	= $(DEST_DIR)/usr/share/icons
#LIBDIR		= $(DEST_DIR)/$(PREFIX)/${ARCH_LIB}/$(CPU)


CONFDIR		= $(DEST_DIR)/$(PREFIX)/config
STATETABLEDIR	= $(DEST_DIR)/$(PREFIX)/stateTables
DATADIR		= $(DEST_DIR)/$(PREFIX)/data
FPGADIR		= $(DEST_DIR)/$(PREFIX)/fpga

# Build Settings
SRCINCDIR	= ${TOP}/include
SRCLIBDIR	= ${TOP}/${ARCH_LIB}/$(CPU)
INCDIRS		= -I${SRCINCDIR} -I${SRCINCDIR}/Beam
LIBDIRS		= -L${SRCLIBDIR}

#COPTIONS	= -pipe -Wall -Wno-parentheses -Wreturn-type -Wno-conversion
COPTIONS	= -Wall -Wno-parentheses -Wreturn-type -Wno-conversion
COPTIONS	+= -DCERN_TMS
DEBUGFLAGS	= -O2
CXXFLAGS	= $(COPTIONS) $(DEBUGFLAGS) -I. $(INCDIRS) -DVERSION=\"$(VERSION)\"
CXXFLAGS	+= -D_GNU_SOURCE
CXXFLAGS	+= -Wno-deprecated -Wno-write-strings
CXXFLAGS	+= -MMD
CPFLAGS		= -a
CFLAGS		= $(CXXFLAGS)
#LIBDIR		= $(DEST_DIR)/$(PREFIX)/${ARCH_LIB}/$(CPU)
LDFLAGS		= $(LIBDIRS) $(DEBUGFLAGS)
LDLIBS		= -lBeam
DFLAGS		= -Y -I. $(INCDIRS)

CXX		= g++
CC		= g++
RANLIB		= true

# TARGET Special Settings
ifeq ("$(TARGET)", "fc39")
	#BUILD		= CLIENT
	ARCH		= x86_64
	CXXFLAGS	+= -m64
	LDFLAGS		+= -m64
	LDLIBS		+= -lpthread
	RELEASE_RPM	:= ${RELEASE}.fc39
endif
ifeq ("$(TARGET)", "el7_64")
	#BUILD		= CLIENT
	ARCH		= x86_64
	CXXFLAGS	+= -m64
	LDFLAGS		+= -m64
	CXXFLAGS	+= -DOLD_GXX
	LDLIBS		+= -lpthread
	RELEASE_RPM	:= ${RELEASE}.el7
endif
ifeq ("$(TARGET)", "el7")
	ARCH		= i686
	CXXFLAGS	+= -m32
	LDFLAGS		+= -m32
	CXXFLAGS	+= -DOLD_GXX
	LDLIBS		+= -lpthread
endif
ifeq ("$(TARGET)", "fc25")
	CXXFLAGS	+= -DHAVE_GETIFADDRS -DTARGET_fc25
#	LDLIBS		+= -lpthread -lz
	LDLIBS		+= -lpthread
endif
ifeq ("$(TARGET)", "fc16")
	CXXFLAGS	+= -DHAVE_GETIFADDRS -DTARGET_fc16
#	LDLIBS		+= -lpthread -lz
	LDLIBS		+= -lpthread
endif
ifeq ("$(TARGET)", "fc6")
	CXXFLAGS	+= -DHAVE_GETIFADDRS -DHAVE_DA8150
#	LDLIBS		+= -lpthread -lz
	LDLIBS		+= -lpthread
endif
ifeq ("$(TARGET)", "el6")
	CXXFLAGS	+= -DHAVE_GETIFADDRS -DHAVE_DA8150
#	LDLIBS		+= -lpthread -lz
	LDLIBS		+= -lpthread
endif
ifeq ("$(TARGET)", "fpgaLinux")
	CXXFLAGS	+= -DOLD_GXX
	LDLIBS		+= -lpthread
endif
ifeq ("$(TARGET)", "lynxos")
	CXXFLAGS	+= -DOLD_GXX
	LDLIBS		+= -mthreads
	CPFLAGS		=
endif

ifeq ("$(BUILD_ENV)", "CERN")
	# Map standard program production rules
	ifeq ("$(TARGET)", "lynxos")
		CPU		= ppc4
	else
		CPU		= Linux
	endif

	DEBUGFLAGS	= -Os
	DARCH		= .$(CPU)
	LIBDIR		= $(DEST_DIR)/$(PREFIX)/lib/$(CPU)

	# Include CERN standard program production rules
	#include /ps/dsc/src/co/Make.auto
	include $(TOP)/Makefile.rules
endif

# Build Settings
ifeq ("${ARCH}","x86_64")
ARCH_LIB	= lib64
else
ARCH_LIB	= lib
endif

# QT Version
QTVER	= 5
#QTDIR		= $(shell ls -d /usr/${ARCH_LIB}/qt-* | tail -1)


.SUFFIXES: .spec

%.spec:	Makefile.config
	@(if ! grep "^Version:.*${VERSION}" $@; then\
		sed -e "s/^Version:.*/Version:\t${VERSION}/" $@ > $@.tmp;\
		mv $@.tmp $@; fi) 2>&1 > /dev/null
	@(if ! grep "^Release:.*${RELEASE_RPM}" $@; then\
		sed -e "s/^Release:.*/Release:\t${RELEASE_RPM}/" $@ > $@.tmp;\
		mv $@.tmp $@; fi) 2>&1 > /dev/null