RELEASE = 1.beam
TARGET ?=
DIST ?=
PREFIX ?= /usr/tms
ifeq ("$(TARGET)", "")
TARGET = $(shell cut -d " " -f1 /etc/bsystype.txt)
endif
ifeq ("$(DIST)", "")
DIST = $(shell cut -d " " -f2 /etc/bsystype.txt)
endif
ifeq ("$(TARGET)", "")
$(error TARGET not defined)
endif
ifeq ("$(DIST)", "")
$(error DIST not defined)
endif
FPGADIR = $(DEST_DIR)$(PREFIX)/fpga
all::
# TARGET Special Settings
ifeq ("$(TARGET)", "fedora")
# Build RPM packages
RPMBUILD_DIR = ${HOME}/rpmbuild
DISTDIR_RELEASE = /dist/cern/tms/${TARGET}_${DIST}
packages: clean package/rpm/tms-fpga.spec
ln -sf tms-fpga-$(VERSION).bit tms-fpga.bit
rpmbuild --define "_topdir $(RPMBUILD_DIR)" --target noarch --build-in-place -bb package/rpm/tms-fpga.spec
packages-install:
cp ${RPMBUILD_DIR}/RPMS/noarch/tms-fpga*.noarch.rpm ${DISTDIR_RELEASE}/packages
createrepo ${DISTDIR_RELEASE}
.SUFFIXES: .spec
%.spec: Config.mk
@(if ! grep "^Version:.*${VERSION}" $@; then sed -i -e "s/^Version:.*/Version:\t${VERSION}/" $@; fi) 2>&1 > /dev/null
@(if ! grep "^Release:.*${RELEASE}" $@; then sed -i -e "s/^Release:.*/Release:\t${RELEASE}%{dist}/" $@; fi) 2>&1 > /dev/null
else ifeq ("$(TARGET)", "debian")
# Build DEB packages