mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
more improvement for our build system
This commit is contained in:
parent
1376055f7f
commit
17bc32ad89
6 changed files with 52 additions and 53 deletions
|
@ -79,4 +79,4 @@ RUN rm -rf /tmp
|
|||
|
||||
WORKDIR /villas
|
||||
|
||||
ENTRYPOINT /bin/bash
|
||||
ENTRYPOINT make clean && make install && villas node; bash
|
||||
|
|
5
Makefile
5
Makefile
|
@ -84,9 +84,8 @@ CFLAGS += $(addprefix -DWITH_, $(shell echo ${PKGS} | tr a-z- A-Z_ | tr -dc ' A-
|
|||
CFLAGS += $(shell pkg-config --cflags ${PKGS})
|
||||
LDLIBS += $(shell pkg-config --libs ${PKGS})
|
||||
|
||||
# Default target: build everything; no tests, docs
|
||||
all: src
|
||||
|
||||
all: src plugins | lib
|
||||
|
||||
everything:
|
||||
$(MAKE) DEBUG=1
|
||||
$(MAKE) COVERAGE=1
|
||||
|
|
|
@ -24,13 +24,12 @@ ifeq ($(shell pkg-config libnl-route-3.0; echo $$?),0)
|
|||
LIB_PKGS += libnl-route-3.0
|
||||
endif
|
||||
|
||||
# Enable VILLASfpga support when libpci is available
|
||||
ifeq ($(shell pkg-config libpci; echo $$?),0)
|
||||
# Enable VILLASfpga support when libxil is available
|
||||
ifeq ($(shell pkg-config libxil; echo $$?),0)
|
||||
LIB_SRCS += $(addprefix lib/nodes/, fpga.c)
|
||||
LIB_SRCS += $(addprefix lib/kernel/, pci.c vfio.c)
|
||||
LIB_SRCS += $(wildcard lib/fpga/*.c)
|
||||
LIB_PKGS += libpci
|
||||
LIB_LDLIBS += -lxil
|
||||
PKGS += libxil
|
||||
endif
|
||||
|
||||
# Enable NGSI support
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
# Executables
|
||||
TARGETS = $(BUILDDIR)/node \
|
||||
$(BUILDDIR)/pipe \
|
||||
$(BUILDDIR)/signal \
|
||||
$(BUILDDIR)/test \
|
||||
$(BUILDDIR)/fpga
|
||||
TARGETS = $(BUILDDIR)/villas-node \
|
||||
$(BUILDDIR)/villas-pipe \
|
||||
$(BUILDDIR)/villas-signal \
|
||||
$(BUILDDIR)/villas-test
|
||||
|
||||
SRC_LDLIBS = $(LDLIBS) -pthread -lm -lvillas -lxil
|
||||
SRC_LDLIBS = $(LDLIBS) -pthread -lm -lvillas
|
||||
SRC_CFLAGS = $(CFLAGS)
|
||||
SRC_LDFLAGS = $(LDFLAGS)
|
||||
SRC_LDFLAGS = $(LDFLAGS) -Wl,-rpath,'$$ORIGIN'
|
||||
|
||||
src: $(TARGETS)
|
||||
# Enable VILLASfpga support when libxil is available
|
||||
ifeq ($(shell pkg-config libxil; echo $$?),0)
|
||||
LIB_SRCS += $(addprefix lib/nodes/, fpga.c)
|
||||
LIB_SRCS += $(addprefix lib/kernel/, pci.c vfio.c)
|
||||
LIB_SRCS += $(wildcard lib/fpga/*.c)
|
||||
TARGETS += $(BUILDDIR)/villas-fpga
|
||||
PKGS += libxil
|
||||
|
||||
# Add support for LAPACK / BLAS benchmarks / solvers
|
||||
ifeq ($(shell pkg-config blas lapack; echo $$?),0)
|
||||
PKGS += blas lapack
|
||||
BENCH_OBJS += fpga-bench-overruns.o
|
||||
# Add support for LAPACK / BLAS benchmarks / solvers
|
||||
ifeq ($(shell pkg-config blas lapack; echo $$?),0)
|
||||
PKGS += blas lapack
|
||||
BENCH_OBJS += fpga-bench-overruns.o
|
||||
endif
|
||||
endif
|
||||
|
||||
src: $(TARGETS)
|
||||
|
||||
# Dependencies for individual binaries
|
||||
$(BUILDDIR)/fpga: $(addprefix $(BUILDDIR)/src/,fpga.o fpga-tests.o fpga-bench.o $(BENCH_OBJS))
|
||||
$(BUILDDIR)/node: $(BUILDDIR)/src/node.o
|
||||
$(BUILDDIR)/pipe: $(BUILDDIR)/src/pipe.o
|
||||
$(BUILDDIR)/signal: $(BUILDDIR)/src/signal.o
|
||||
$(BUILDDIR)/test: $(BUILDDIR)/src/test.o
|
||||
$(TARGETS): $(BUILDDIR)/villas-%: $(BUILDDIR)/src/%.o
|
||||
|
||||
# Some additional prereqs for individual binaries
|
||||
$(BUILDDIR)/villas-fpga: $(addprefix $(BUILDDIR)/src/,fpga-tests.o fpga-bench.o $(BENCH_OBJS))
|
||||
|
||||
|
||||
# Compile executable objects
|
||||
$(BUILDDIR)/src/%.o: src/%.c | $$(dir $$@)
|
||||
|
@ -35,12 +40,8 @@ $(TARGETS): | $(LIBS)
|
|||
$(CC) $(SRC_LDFLAGS) $^ $(SRC_LDLIBS) -o $@
|
||||
|
||||
# Install
|
||||
install-src:
|
||||
install -m 0755 $(BUILDDIR)/node -T $(PREFIX)/bin/villas-node
|
||||
install -m 0755 $(BUILDDIR)/fpga -T $(PREFIX)/bin/villas-fpga
|
||||
install -m 0755 $(BUILDDIR)/signal -T $(PREFIX)/bin/villas-signal
|
||||
install -m 0755 $(BUILDDIR)/pipe -T $(PREFIX)/bin/villas-pipe
|
||||
install -m 0755 $(BUILDDIR)/test -T $(PREFIX)/bin/villas-test
|
||||
install-src: src
|
||||
install -m 0755 $(TARGETS) $(PREFIX)/bin
|
||||
|
||||
clean-src:
|
||||
rm -rf $(BUILDDIR)/src $(TARGETS)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
TARGETS += $(BUILDDIR)/tests
|
||||
|
||||
TEST_SRCS = $(wildcard tests/*.c)
|
||||
TEST_OBJS = $(patsubst %.c,$(BUILDDIR)/%.o,$(TEST_SRCS))
|
||||
|
||||
TEST_CFLAGS = $(CFLAGS)
|
||||
TEST_LDFLAGS = $(LDFLAGS)
|
||||
TEST_LDLIBS = $(LDLIBS) -l criterion
|
||||
TEST_LDFLAGS = $(LDFLAGS) -Wl,-rpath,'$$ORIGIN'
|
||||
TEST_LDLIBS = $(LDLIBS) -lcriterion -lvillas
|
||||
|
||||
tests: $(BUILDDIR)/testsuite
|
||||
|
||||
# Compile
|
||||
$(BUILDDIR)/tests/%.o: tests/%.c | $$(dir $$@)
|
||||
$(CC) $(TEST_CFLAGS) -c $< -o $@
|
||||
|
||||
# Link
|
||||
$(BUILDDIR)/tests: $(TEST_OBJS) | $(LIBS)
|
||||
$(CC) $(TEST_LDFLAGS) $(TEST_LDLIBS) $^ -o $@#
|
||||
$(BUILDDIR)/testsuite: $(TEST_OBJS) | $(LIBS)
|
||||
$(CC) $(TEST_LDFLAGS) $(TEST_LDLIBS) $^ -o $@
|
||||
|
||||
ifdef COVERAGE
|
||||
-include Makefile.gcov.inc
|
||||
|
|
30
thirdparty/Makefile.inc
vendored
30
thirdparty/Makefile.inc
vendored
|
@ -3,36 +3,36 @@ DEPS_AUTOCONF = libnl libconfig libcurl
|
|||
|
||||
DEPS = $(DEPS_CMAKE) $(DEPS_AUTOCONF)
|
||||
|
||||
.PHONY: $(DEPS)
|
||||
|
||||
# Install all dependencies
|
||||
thirdparty: libxil
|
||||
thirdparty:
|
||||
|
||||
# Install & compile autotools based projects
|
||||
$(DEPS_AUTOCONF): | $(BUILDDIR)/thirdparty/$$@/
|
||||
autoreconf -fi $(SRCDIR)/thirdparty/$@
|
||||
cd $(BUILDDIR)/thirdparty/$@ && $(SRCDIR)/thirdparty/$@/configure --prefix=$(PREFIX) && make install
|
||||
cd $(BUILDDIR)/thirdparty/$@ && $(SRCDIR)/thirdparty/$@/configure --prefix=$(PREFIX) && make
|
||||
|
||||
# Install & compile CMake based projects
|
||||
$(DEPS_CMAKE): | $(BUILDDIR)/thirdparty/$$@/
|
||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(PREFIX) \
|
||||
-H$(SRCDIR)/thirdparty/$@ \
|
||||
-B$(BUILDDIR)/thirdparty/$@
|
||||
make -C$(BUILDDIR)/thirdparty/$@ install
|
||||
make -C$(BUILDDIR)/thirdparty/$@
|
||||
|
||||
$(addprefix install-,$(DEPS)): install-%: %
|
||||
make -C$(BUILDDIR)/thirdparty/$(@:install-%=%) install
|
||||
ldconfig
|
||||
|
||||
$(addprefix clean-,$(DEPS)):
|
||||
rm -rf $(BUILDDIR)/thirdparty/$(@:clean-%=%)
|
||||
|
||||
install-thirdparty:
|
||||
|
||||
clean-thirdparty:
|
||||
for DEP in $(DEPS); do \
|
||||
pushd $$DEP; \
|
||||
git checkout . ; \
|
||||
git clean -dxf $$DEP . ; \
|
||||
popd; \
|
||||
done
|
||||
rm -rf $(BUILDDIR)/thirdparty
|
||||
|
||||
install-thirdparty: $(addprefix install-,$(DEPS))
|
||||
.PHONY: $(DEPS) thirdparty clean-thirdparty install-thirdparty
|
||||
|
||||
clean-thirdparty: $(addprefix clean-,$(DEPS))
|
||||
|
||||
.PHONY: $(DEPS) thirdparty clean-thirdparty install-thirdparty# libconfig's build system is currently broken.
|
||||
# libconfig's build system is currently broken.
|
||||
# This is a workaround for: https://github.com/hyperrealm/libconfig/issues/53
|
||||
libconfig: | libconfig-fix
|
||||
libconfig-fix:
|
||||
|
|
Loading…
Add table
Reference in a new issue