Files
bootrr/Makefile
Dmitry Baryshkov 388e281ef2 Makefile: change install paths, provide bootrr-run script
Install all the tests into separe dir (${prefix}/libexec/bootrr).
Provide a generic script to run all the tests on the target board.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
2021-11-01 11:48:12 -05:00

51 lines
918 B
Makefile

.PHONY: all
all:
all-install :=
DESTDIR ?= dest
CPIONAME ?= bootrr
HELPERS := $(wildcard helpers/*)
BOARDS := $(wildcard boards/*)
BINS := bin/bootrr
LIBEXEC_DIR ?= $(prefix)/libexec
BOOTRR_DIR = $(LIBEXEC_DIR)/bootrr
define add-scripts
$(DESTDIR)$1/$2: $2
@echo "INSTALL $$<"
@install -D -m 755 $$< $$@
all-install += $(DESTDIR)$1/$2
endef
$(foreach v,${BOARDS},$(eval $(call add-scripts,$(BOOTRR_DIR),$v)))
$(foreach v,${HELPERS},$(eval $(call add-scripts,$(BOOTRR_DIR),$v)))
$(foreach v,${BINS},$(eval $(call add-scripts,$(prefix),$v)))
bin/bootrr: bin/bootrr.in Makefile
@sed -e 's!@BOOTRR@!$(BOOTRR_DIR)!g' $< > $@.tmp
@mv $@.tmp $@
install: $(all-install)
CPIO := $(PWD)/$(CPIONAME).cpio
$(CPIO): $(all-install)
@cd $(DESTDIR) && find ./$(prefix) | cpio -o -H newc > $(CPIO)
%.cpio.gz: %.cpio
@gzip < $< > $@
cpio: $(CPIO)
cpio.gz: $(CPIO).gz
clean:
@rm -f $(CPIO) $(CPIO).gz bin/bootrr