diff --git a/Makefile b/Makefile index 42da15288..efeb138de 100644 --- a/Makefile +++ b/Makefile @@ -20,12 +20,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . ################################################################################### @@ -45,7 +45,7 @@ V ?= 2 # Common flags LDLIBS = CFLAGS += -I. -Iinclude -Iinclude/villas -CFLAGS += -std=c11 -MMD -mcx16 +CFLAGS += -std=c11 -MMD -mcx16 CFLAGS += -Wall -Werror -fdiagnostics-color=auto LDFLAGS += -L$(BUILDDIR) @@ -65,7 +65,7 @@ endif ifdef PROFILE CFLAGS += -pg LDFLAGS += -pg - + VARIANTS += profile endif @@ -73,10 +73,10 @@ ifdef COVERAGE CFLAGS += -fprofile-arcs -ftest-coverage LDFLAGS += --coverage LDLIBS += -lgcov - + LIB_LDFLAGS += -coverage LIB_LDLIBS += -gcov - + VARIANTS += coverage endif @@ -87,16 +87,21 @@ VARIANT = $(subst $(SPACE),-,$(strip $(VARIANTS))) BUILDDIR := $(BUILDDIR)/$(VARIANT) SRCDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +VPATH = $(SRCDIR) + # Add git revision and build variant defines VERSION := $(shell git describe --tags --abbrev=0 --match v*) VERSION_NUM := $(shell VERSION=$(VERSION); echo $${VERSION:1}) ifdef CI VARIANT := $(VARIANT)-ci -endif -GIT_REV := $(shell git rev-parse --short=7 HEAD) -GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) + GIT_REV := $(shell echo $${CI_COMMIT_SHA:0:7}) + GIT_BRANCH := $(CI_COMMIT_REF_NAME) +else + GIT_REV := $(shell git rev-parse --short=7 HEAD) + GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) +endif # pkg-config dependencies PKGS = libconfig diff --git a/src/Makefile.inc b/src/Makefile.inc index c88b73c5c..a071b53ad 100644 --- a/src/Makefile.inc +++ b/src/Makefile.inc @@ -10,12 +10,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . ################################################################################### @@ -56,7 +56,7 @@ $(TARGETS): $(BUILDDIR)/villas-%: $(BUILDDIR)/src/%.o $(BUILDDIR)/villas-fpga: $(addprefix $(BUILDDIR)/src/,fpga-bench.o $(BENCH_OBJS)) # Compile executable objects -$(BUILDDIR)/src/%.o: src/%.c $(BUILDDIR)/defines | $$(dir $$@) +$(BUILDDIR)/src/%.o: src/%.c | $$(dir $$@) $(CC) $(SRC_CFLAGS) -c $< -o $@ # Build villas-shmem only with libvillas-ext (to ensure that libext contains everything needed) diff --git a/tests/unit/Makefile.inc b/tests/unit/Makefile.inc index 40fae311e..29600e300 100644 --- a/tests/unit/Makefile.inc +++ b/tests/unit/Makefile.inc @@ -10,12 +10,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . ################################################################################### @@ -33,7 +33,7 @@ run-unit-tests: tests $(BUILDDIR)/unit-tests # Compile -$(BUILDDIR)/tests/unit/%.o: tests/unit/%.c $(BUILDDIR)/defines | $$(dir $$@) +$(BUILDDIR)/tests/unit/%.o: tests/unit/%.c | $$(dir $$@) $(CC) $(TEST_CFLAGS) -c $< -o $@ # Link @@ -46,8 +46,8 @@ endif # Tests are not installed install-tests: - + clean-tests: rm -rf $(BUILDDIR)/tests $(BUILDDIR)/testsuite -.PHONY: unit-tests install-unit-tests clean-unit-tests run-unit-tests \ No newline at end of file +.PHONY: unit-tests install-unit-tests clean-unit-tests run-unit-tests diff --git a/tools/Makefile.inc b/tools/Makefile.inc index 6f2392176..c9cd603b1 100644 --- a/tools/Makefile.inc +++ b/tools/Makefile.inc @@ -10,12 +10,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . ################################################################################### @@ -33,7 +33,7 @@ ifeq ($(shell $(PKGCONFIG) libzmq; echo $$?),0) endif # Compile executable objects -$(BUILDDIR)/tools/%.o: tools/%.c $(BUILDDIR)/defines | $$(dir $$@) +$(BUILDDIR)/tools/%.o: tools/%.c | $$(dir $$@) $(CC) $(TOOLS_CFLAGS) -c $< -o $@ # Link target executables @@ -49,4 +49,4 @@ install-tools: $(TOOLS) install -m 0755 tools/villas.sh $(DESTDIR)$(PREFIX)/bin/villas install -m 0755 -D -t $(DESTDIR)$(PREFIX)/bin $(TOOLS) -.PHONY: tools clean-tools install-tools \ No newline at end of file +.PHONY: tools clean-tools install-tools