Skip to content

Commit

Permalink
Fixed makefiles, align with ts_vms
Browse files Browse the repository at this point in the history
  • Loading branch information
pkubanek committed Dec 5, 2023
1 parent c6499f1 commit d99ff16
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ src/libM1M3TS.a: FORCE

ts-M1M3thermald: src/ts-M1M3thermald.cpp.o src/libM1M3TS.a
@echo '[LD ] $@'
${co}$(CPP) $(LIBS_FLAGS) -o $@ $^ $(LIBS) $(SAL_LIBS) ../ts_cRIOcpp/lib/libcRIOcpp.a $(shell pkg-config --libs readline $(silence))
${co}$(CPP) $(LIBS_FLAGS) -o $@ $^ ../ts_cRIOcpp/lib/libcRIOcpp.a $(LIBS) $(SAL_LIBS) $(shell pkg-config --libs readline $(silence))


m1m3tscli: src/m1m3tscli.cpp.o src/libM1M3TS.a
@echo '[LD ] $@'
${co}$(CPP) $(LIBS_FLAGS) -o $@ $^ $(LIBS) ../ts_cRIOcpp/lib/libcRIOcpp.a $(shell pkg-config --libs readline $(silence))
${co}$(CPP) $(LIBS_FLAGS) -o $@ $^ ../ts_cRIOcpp/lib/libcRIOcpp.a $(LIBS) $(shell pkg-config --libs readline $(silence)) -lreadline

# Other Targets
clean:
Expand Down
47 changes: 25 additions & 22 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ifndef VERBOSE
silence := --silence-errors
endif

c_opts := -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE # -DSPDLOG_FMT_EXTERNAL
c_opts := -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE

ifdef DEBUG
c_opts += -g
Expand All @@ -13,37 +13,40 @@ else
c_opts += -O3
endif

# compile x86 simulator or real cRIO stuff
ifdef SIMULATOR
C := gcc -Wall ${c_opts}
CPP := g++ -std=c++14 -pedantic -Wall ${c_opts} -DSIMULATOR -lpthread
else
C := gcc -Wall -fmessage-length=0 ${c_opts}
CPP := g++ -std=c++14 -Wall -fmessage-length=0 ${c_opts} -ldl -lpthread
endif
CRIOCPP := ../ts_cRIOcpp/

PKG_CPPFLAGS := $(shell pkg-config yaml-cpp --cflags $(silence)) \
PKG_CPPFLAGS := \
$(shell pkg-config yaml-cpp --cflags $(silence)) \
$(shell pkg-config spdlog --cflags $(silence)) \
$(shell pkg-config fmt --cflags $(silence))

SAL_CPPFLAGS += $(PKG_CPPFLAGS) -I${OSPL_HOME}/include -I${OSPL_HOME}/include/sys -I${OSPL_HOME}/include/dcps/C++/SACPP -I${SAL_WORK_DIR}/MTM1M3TS/cpp/src -I${SAL_WORK_DIR}/include -I${SAL_HOME}/include -I${LSST_SDK_INSTALL}/include
SAL_CPPFLAGS += $(PKG_CPPFLAGS) \
-I${OSPL_HOME}/include -I${OSPL_HOME}/include/sys -I${OSPL_HOME}/include/dcps/C++/SACPP \
-I${SAL_WORK_DIR}/MTM1M3/cpp/src -I${SAL_WORK_DIR}/MTMount/cpp/src -I${SAL_WORK_DIR}/include \
-I${SAL_HOME}/include -I${LSST_SDK_INSTALL}/include

CRIO_DIR ?= ../ts_cRIOcpp
CRIO_CFLAGS := -I${CRIO_DIR}/include
PKG_LIBS := \
$(shell pkg-config yaml-cpp --libs $(silence))

PKG_LIBS := $(shell pkg-config yaml-cpp --libs $(silence)) \
$(shell pkg-config spdlog --libs $(silence)) \
$(shell pkg-config fmt --libs $(silence)) \
-lreadline
CPP := g++ -std=c++17 -Wall -fPIE ${c_opts}

ifdef SIMULATOR
LIBS := $(PKG_LIBS) -ldl ${SAL_WORK_DIR}/lib/libSAL_MTM1M3TS.a -ldcpssacpp -ldcpsgapi -lddsuser -lddskernel -lpthread -lddsserialization -lddsconfparser -lddsconf -lddsdatabase -lddsutil -lddsos
C := gcc -Wall ${c_opts}
CPP += -pedantic -DSIMULATOR
PKG_LIBS += $(shell pkg-config spdlog --libs $(silence))
else
LIBS := $(PKG_LIBS) ${SAL_WORK_DIR}/lib/libSAL_MTM1M3TS.a -lpthread
SAL_LIBS := -ldcpssacpp -ldcpsgapi -lddsuser -lddskernel -lddsserialization -lddsconfparser -lddsconf -lddsdatabase -lddsutil -lddsos
C := gcc -Wall -fmessage-length=0 ${c_opts}
CPP += -fmessage-length=0
# static linkage for cRIO binary
PKG_LIBS += $(shell pkg-config spdlog --libs $(silence) | sed -E 's/-l([a-z0-9]*)/-l:lib\1.a/g')
endif

LIBS_FLAGS += -L"${SAL_WORK_DIR}/lib" -L"${OSPL_HOME}/lib" -L"${LSST_SDK_INSTALL}/lib"
LIBS += $(PKG_LIBS) -ldl -ldcpssacpp -ldcpsgapi -lddsuser -lddskernel \
-lpthread -lddsserialization -lddsconfparser -lddsconf -lddsdatabase \
-lddsutil -lddsos \
${SAL_WORK_DIR}/lib/libSAL_MTM1M3TS.a

LIBS_FLAGS += -L${OSPL_HOME}/lib -L${LSST_SDK_INSTALL}/lib

VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "unknown:non-git")
VERSION := $(shell git describe --tags --dirty 2>/dev/null || echo "unknown:non-git")
GIT_HASH := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown-non-git")
8 changes: 5 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ all: libM1M3TS.a
.PHONY: clean force

version.c: force
${co}grep -qsF "VERSION=\"$(VERSION)\"" version.c \
|| echo "[VER] version $(VERSION) git hash $(GIT_HASH)" && \
printf >version.c 'const char *VERSION="%s";\nconst char *GIT_HASH="%s";' $(VERSION) $(GIT_HASH)
${co}(grep -qsF "VERSION=\"$(VERSION)\"" version.c == 0 && echo "[VER] version.c $(VERSION) OK") || \
( \
echo "[VER] version $(VERSION) git hash $(GIT_HASH)" && \
printf >version.c 'const char *VERSION="%s";\nconst char *GIT_HASH="%s";\nconst char *CONFIG_URL="https://github.com/lsst-ts/ts_config_mttcs/MTM1M3TS/v1";\nconst char *CONFIG_SCHEMA_VERSION="v1";' $(VERSION) $(GIT_HASH) \
)

CFLAGS += ${SAL_CPPFLAGS} \
-I../../ts_cRIOcpp/include \
Expand Down
2 changes: 1 addition & 1 deletion src/ts-M1M3thermald.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void M1M3thermald::init() {

SPDLOG_INFO("Creating publisher");
TSPublisher::instance().setSAL(_m1m3tsSAL);
TSPublisher::instance().setLogLevel(getSpdLogLogLevel() * 10);
TSPublisher::instance().setLogLevel(static_cast<int>(getSpdLogLogLevel()) * 10);

SPDLOG_INFO("Starting controller thread");
LSST::cRIO::ControllerThread::instance().start();
Expand Down

0 comments on commit d99ff16

Please sign in to comment.