Commit 85f07dab authored by Adam Wujek's avatar Adam Wujek 💬

Makefile: remove loop

This allows parallel build.
Initialize only missing repos.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 62c34f74
......@@ -3,6 +3,12 @@
REPO_PARENT=$(shell /bin/pwd)/..
-include $(REPO_PARENT)/parent_common.mk
all: kernel lib tools
# a hack, to prevent compiling wr-nic.ko, which won't work on older kernels
CONFIG_WR_NIC=n
export CONFIG_WR_NIC
# The user can override, using environment variables, all these three:
FMC_BUS ?= $(shell pwd)/fmc-bus
ZIO ?= $(shell pwd)/zio
......@@ -25,37 +31,35 @@ export SPEC_SW_ABS
ZIO_VERSION = $(shell cd $(ZIO); git describe --always --dirty --long --tags)
export ZIO_VERSION
DIRS = $(FMC_BUS) $(ZIO) $(SPEC_SW) kernel lib tools
$(SPEC_SW): $(FMC_BUS)
kernel: $(FMC_BUS) $(ZIO) $(SPEC_SW)
lib: $(ZIO)
tools: lib
DESTDIR ?= /usr/local
.PHONY: all clean modules install modules_install default
.PHONY: gitmodules prereq prereq_install prereq_install_warn prereq_clean
.PHONY: all clean modules install modules_install $(DIRS)
.PHONY: gitmodules prereq_install prereq_install_warn
DIRS = kernel lib tools
install modules_install: prereq_install_warn
all clean modules install modules_install: gitmodules
@if echo $@ | grep -q install; then $(MAKE) prereq_install_warn; fi
for d in $(DIRS); do $(MAKE) ZIO=$(ZIO) FMC_BUS=$(FMC_BUS) -C $$d $@ || exit 1; done
all clean modules install modules_install: $(DIRS)
all modules: prereq
clean: TARGET = clean
modules: TARGET = modules
install: TARGET = install
modules_install: TARGET = modules_install
clean_all: clean prereq_clean
# a hack, to prevent compiling wr-nic.ko, which won't work on older kernels
CONFIG_WR_NIC=n
export CONFIG_WR_NIC
$(DIRS):
$(MAKE) -C $@ $(TARGET)
#### The following targets are used to manage prerequisite repositories
gitmodules:
@test -d fmc-bus/doc || echo "Checking out submodules"
@test -d fmc-bus/doc || git submodule update --init
@git submodule update
# The user can override, using environment variables, all these three:
SUBMOD = $(FMC_BUS) $(ZIO) $(SPEC_SW)
prereq:
for d in $(SUBMOD); do $(MAKE) -C $$d || exit 1; done
prereq_install_warn:
@test -f .prereq_installed || \
echo -e "\n\n\tWARNING: Consider \"make prereq_install\"\n"
......@@ -64,7 +68,21 @@ prereq_install:
for d in $(SUBMOD); do $(MAKE) -C $$d modules_install || exit 1; done
touch .prereq_installed
prereq_clean:
for d in $(SUBMOD); do $(MAKE) -C $$d clean || exit 1; done
$(FMC_BUS): fmc-bus-init_repo
$(ZIO): zio-init_repo
$(SPEC_SW): spec-sw-init_repo
# init submodule if missing
fmc-bus-init_repo:
@test -d $(FMC_BUS)/doc || ( echo "Checking out submodule $(FMC_BUS)"; git submodule update --init $(FMC_BUS) )
# init submodule if missing
zio-init_repo:
@test -d $(ZIO)/doc || ( echo "Checking out submodule $(ZIO)" && git submodule update --init $(ZIO) )
# init submodule if missing
spec-sw-init_repo:
@test -d $(SPEC_SW)/doc || ( echo "Checking out submodule $(SPEC_SW)" && git submodule update --init $(SPEC_SW) )
include scripts/gateware.mk
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment