mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
build thirdparty dependencies out-of-source as well
This commit is contained in:
parent
af14793901
commit
1cbfd72d35
7 changed files with 97 additions and 84 deletions
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -16,3 +16,9 @@
|
||||||
[submodule "thirdparty/pciutils"]
|
[submodule "thirdparty/pciutils"]
|
||||||
path = thirdparty/pciutils
|
path = thirdparty/pciutils
|
||||||
url = https://github.com/pciutils/pciutils.git
|
url = https://github.com/pciutils/pciutils.git
|
||||||
|
[submodule "thirdparty/jansson"]
|
||||||
|
path = thirdparty/jansson
|
||||||
|
url = https://github.com/akheron/jansson.git
|
||||||
|
[submodule "thirdparty/libcurl"]
|
||||||
|
path = thirdparty/libcurl
|
||||||
|
url = https://github.com/curl/curl.git
|
||||||
|
|
|
@ -59,5 +59,6 @@ RUN dnf -y update && \
|
||||||
bison \
|
bison \
|
||||||
texinfo
|
texinfo
|
||||||
|
|
||||||
|
WORKDIR /villas
|
||||||
|
|
||||||
ENTRYPOINT /bin/bash
|
ENTRYPOINT /bin/bash
|
||||||
|
|
59
Makefile
59
Makefile
|
@ -17,7 +17,7 @@
|
||||||
#################################################################################
|
#################################################################################
|
||||||
|
|
||||||
# Project modules
|
# Project modules
|
||||||
MODULES = lib plugins src tests
|
MODULES = lib plugins src tests thirdparty
|
||||||
|
|
||||||
# Default prefix for install target
|
# Default prefix for install target
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
@ -41,30 +41,38 @@ else ifdef GIT
|
||||||
CFLAGS += -D_GIT_REV='"$(shell git rev-parse --short HEAD)"'
|
CFLAGS += -D_GIT_REV='"$(shell git rev-parse --short HEAD)"'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# We must compile without optimizations for gcov!
|
||||||
|
ifdef DEBUG
|
||||||
|
CFLAGS += -O0 -g
|
||||||
|
VARIANTS += debug
|
||||||
|
else
|
||||||
|
CFLAGS += -O3
|
||||||
|
VARIANTS += release
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef PROFILE
|
||||||
|
CFLAGS += -pg
|
||||||
|
LDFLAGS += -pg
|
||||||
|
|
||||||
|
VARIANTS += profile
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef COVERAGE
|
ifdef COVERAGE
|
||||||
CFLAGS += -fprofile-arcs -ftest-coverage
|
CFLAGS += -fprofile-arcs -ftest-coverage
|
||||||
LDFLAGS += --coverage
|
LDFLAGS += --coverage
|
||||||
LDLIBS += -lgcov
|
LDLIBS += -lgcov
|
||||||
|
|
||||||
LIB_LDFLAGS += --coverage
|
LIB_LDFLAGS += -coverage
|
||||||
LIB_LDLIBS += -gcov
|
LIB_LDLIBS += -gcov
|
||||||
|
|
||||||
|
VARIANTS += coverage
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# We must compile without optimizations for gcov!
|
SPACE :=
|
||||||
ifneq ($(or $(DEBUG),$(COVERAGE)),)
|
SPACE +=
|
||||||
CFLAGS += -O0 -g
|
BUILDDIR := $(BUILDDIR)/$(subst $(SPACE),-,$(strip $(VARIANTS)))
|
||||||
else
|
|
||||||
CFLAGS += -O3
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Build variant
|
SRCDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||||
ifdef COVERAGE
|
|
||||||
BUILDDIR := $(BUILDDIR)/coverage
|
|
||||||
else ifdef DEBUG
|
|
||||||
BUILDDIR := $(BUILDDIR)/debug
|
|
||||||
else
|
|
||||||
BUILDDIR := $(BUILDDIR)/release
|
|
||||||
endif
|
|
||||||
|
|
||||||
# pkg-config dependencies
|
# pkg-config dependencies
|
||||||
PKGS = libconfig
|
PKGS = libconfig
|
||||||
|
@ -77,26 +85,21 @@ CFLAGS += $(shell pkg-config --cflags ${PKGS})
|
||||||
LDLIBS += $(shell pkg-config --libs ${PKGS})
|
LDLIBS += $(shell pkg-config --libs ${PKGS})
|
||||||
|
|
||||||
# Default target: build everything; no tests, docs
|
# Default target: build everything; no tests, docs
|
||||||
all: $(MODULES)
|
all: src
|
||||||
|
|
||||||
everything:
|
everything:
|
||||||
$(MAKE) DEBUG=1
|
$(MAKE) DEBUG=1
|
||||||
$(MAKE) COVERAGE=1
|
$(MAKE) COVERAGE=1
|
||||||
|
$(MAKE) PROFILE=1
|
||||||
$(MAKE) doc
|
$(MAKE) doc
|
||||||
$(MAKE) tests
|
$(MAKE) tests
|
||||||
|
|
||||||
.PHONY: all clean install docker doc $(MODULES)
|
.PHONY: all clean install docker doc $(MODULES)
|
||||||
.SECONDARY:
|
|
||||||
.SECONDEXPANSION:
|
|
||||||
|
|
||||||
# Create non-existent directories in build directory
|
|
||||||
$(BUILDDIR)/%/:
|
|
||||||
mkdir -p $@
|
|
||||||
|
|
||||||
install: $(addprefix install-,$(MODULES))
|
install: $(addprefix install-,$(MODULES))
|
||||||
install -m 0755 tools/villas.sh $(PREFIX)/bin/villas
|
install -m 0755 tools/villas.sh $(PREFIX)/bin/villas
|
||||||
|
|
||||||
clean:
|
clean: $(addprefix clean-,$(MODULES))
|
||||||
rm -rf $(BUILDDIR)
|
rm -rf $(BUILDDIR)
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
|
@ -106,5 +109,11 @@ docker:
|
||||||
doc:
|
doc:
|
||||||
( cat Doxyfile ; echo "OUTPUT_DIRECTORY=$(BUILD)/doc/" ) | doxygen -
|
( cat Doxyfile ; echo "OUTPUT_DIRECTORY=$(BUILD)/doc/" ) | doxygen -
|
||||||
|
|
||||||
|
# Create non-existent directories
|
||||||
|
%/:
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
|
||||||
-include $(wildcard $(BUILDDIR)/**/*.d)
|
-include $(wildcard $(BUILDDIR)/**/*.d)
|
||||||
$(foreach MODULE,$(MODULES),$(eval -include $(MODULE)/Makefile.inc))
|
-include $(addsuffix /Makefile.inc,$(MODULES))
|
||||||
|
|
|
@ -83,5 +83,5 @@ install-lib:
|
||||||
install -m 0644 $(LIBS) $(PREFIX)/lib
|
install -m 0644 $(LIBS) $(PREFIX)/lib
|
||||||
install -m 0755 -d $(PREFIX)/include/villas/
|
install -m 0755 -d $(PREFIX)/include/villas/
|
||||||
install -m 0644 include/villas/*.h $(PREFIX)/include/villas/
|
install -m 0644 include/villas/*.h $(PREFIX)/include/villas/
|
||||||
echo "note: you may need to run 'ldconfig'"
|
@echo "note: you may need to run 'ldconfig'"
|
||||||
echo "note: make sure $(PREFIX)/lib is in your /etc/ld.so.conf or $$LD_LIBRARY_PATH"
|
@echo "note: make sure $(PREFIX)/lib is in your /etc/ld.so.conf or $$LD_LIBRARY_PATH"
|
||||||
|
|
49
thirdparty/Makefile
vendored
49
thirdparty/Makefile
vendored
|
@ -1,49 +0,0 @@
|
||||||
DEPS = libxil libconfig libnl libwebsockets criterion
|
|
||||||
|
|
||||||
.PHONY: $(DEPS) all clean
|
|
||||||
|
|
||||||
TMPDIR ?= $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
|
|
||||||
# Install all dependencies
|
|
||||||
all: $(DEPS)
|
|
||||||
|
|
||||||
# Install & compile libconfig dependency
|
|
||||||
libconfig:
|
|
||||||
cd $@ && \
|
|
||||||
rm -f lib/scanner.[ch] && \
|
|
||||||
autoreconf && \
|
|
||||||
./configure --prefix=$(PREFIX) --disable-examples && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
# Install & compile libnl3 dependency
|
|
||||||
libnl:
|
|
||||||
cd $@ && \
|
|
||||||
./autogen.sh && \
|
|
||||||
./configure --prefix=$(PREFIX) --disable-cli && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
# Install & compile libwebsockets dependency
|
|
||||||
libwebsockets:
|
|
||||||
mkdir $@/build && cd $@/build && \
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(PREFIX) .. && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
# Install & compile Criterion unittest framework
|
|
||||||
criterion:
|
|
||||||
mkdir $@/build && cd $@/build && \
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(PREFIX) .. && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
# Install & compile Xilinx standalone drivers
|
|
||||||
libxil:
|
|
||||||
cd $@ && \
|
|
||||||
make install
|
|
||||||
|
|
||||||
clean:
|
|
||||||
for DEP in ${DEPS}; do \
|
|
||||||
pushd $$DEP; \
|
|
||||||
git checkout . ; \
|
|
||||||
git clean -dxf $$DEP . ; \
|
|
||||||
popd; \
|
|
||||||
done
|
|
34
thirdparty/Makefile.inc
vendored
Normal file
34
thirdparty/Makefile.inc
vendored
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
DEPS_CMAKE = libwebsockets criterion jansson
|
||||||
|
DEPS_AUTOCONF = libnl libconfig libcurl
|
||||||
|
|
||||||
|
DEPS = libxil $(DEPS_CMAKE) $(DEPS_AUTOCONF)
|
||||||
|
|
||||||
|
.PHONY: $(DEPS)
|
||||||
|
|
||||||
|
# Install all dependencies
|
||||||
|
thirdparty: $(DEPS)
|
||||||
|
|
||||||
|
# Install & compile autotools based projects
|
||||||
|
$(DEPS_AUTOCONF): | $(BUILDDIR)/thirdparty/$$@/
|
||||||
|
autoreconf -fi $(SRCDIR)/thirdparty/$@
|
||||||
|
cd $(BUILDDIR)/thirdparty/$@ && $(SRCDIR)/thirdparty/$@/configure --prefix=$(PREFIX) && make install
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Install & compile Xilinx standalone drivers
|
||||||
|
libxil: | $(BUILDDIR)/thirdparty/$$@/
|
||||||
|
make -C$(BUILDDIR)/thirdparty/$@ \
|
||||||
|
-f$(SRCDIR)/thirdparty/$@/Makefile install
|
||||||
|
|
||||||
|
clean-thirdparty:
|
||||||
|
for DEP in $(DEPS); do \
|
||||||
|
pushd $$DEP; \
|
||||||
|
git checkout . ; \
|
||||||
|
git clean -dxf $$DEP . ; \
|
||||||
|
popd; \
|
||||||
|
done
|
24
thirdparty/libxil/Makefile
vendored
24
thirdparty/libxil/Makefile
vendored
|
@ -2,12 +2,16 @@ LIB = libxil.so
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
SRCS = $(wildcard src/*.c)
|
SRCDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||||
SRCS += $(wildcard orig/*/src/*.c)
|
|
||||||
OBJS = $(SRCS:c=o)
|
VPATH = $(SRCDIR)
|
||||||
|
|
||||||
|
SRCS = $(wildcard $(SRCDIR)/src/*.c)
|
||||||
|
SRCS += $(wildcard $(SRCDIR)/orig/*/src/*.c)
|
||||||
|
OBJS = $(SRCS:$(SRCDIR)/%.c=%.o)
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -O3 -fPIC -Iinclude/xilinx -Iorig/common_v1_00_a/src -Wno-int-conversion -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
|
CFLAGS = -O3 -fPIC -I$(SRCDIR)/include/xilinx -Iorig/common_v1_00_a/src -Wno-int-conversion -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -DDEBUG -DXDEBUG_WARNING -g
|
CFLAGS += -DDEBUG -DXDEBUG_WARNING -g
|
||||||
|
@ -24,5 +28,13 @@ clean:
|
||||||
install: $(LIB)
|
install: $(LIB)
|
||||||
mkdir -p $(PREFIX)/include/xilinx
|
mkdir -p $(PREFIX)/include/xilinx
|
||||||
install -m 0644 $(LIB) $(PREFIX)/lib
|
install -m 0644 $(LIB) $(PREFIX)/lib
|
||||||
install -m 0644 include/xilinx/*.h $(PREFIX)/include/xilinx
|
install -m 0644 $(SRCDIR)/include/xilinx/*.h $(PREFIX)/include/xilinx
|
||||||
ldconfig
|
@echo "note: you may need to run 'ldconfig'"
|
||||||
|
@echo "note: make sure $(PREFIX)/lib is in your /etc/ld.so.conf or $$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
|
||||||
|
$(OBJS): | $$(dir $$@)
|
||||||
|
|
||||||
|
%/:
|
||||||
|
mkdir -p $@
|
Loading…
Add table
Reference in a new issue