Skip to content

Commit 388e281

Browse files
lumagandersson
authored andcommitted
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 <[email protected]>
1 parent e5413c7 commit 388e281

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dest/
22
bootrr.cpio*
3-
3+
bin/bootrr

Makefile

+16-6
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,33 @@ HELPERS := $(wildcard helpers/*)
1111

1212
BOARDS := $(wildcard boards/*)
1313

14+
BINS := bin/bootrr
15+
16+
LIBEXEC_DIR ?= $(prefix)/libexec
17+
BOOTRR_DIR = $(LIBEXEC_DIR)/bootrr
18+
1419
define add-scripts
15-
$(DESTDIR)$(prefix)/bin/$(notdir $1): $1
20+
$(DESTDIR)$1/$2: $2
1621
@echo "INSTALL $$<"
1722
@install -D -m 755 $$< $$@
1823

19-
all-install += $(DESTDIR)$(prefix)/bin/$(notdir $1)
24+
all-install += $(DESTDIR)$1/$2
2025
endef
2126

22-
$(foreach v,${BOARDS},$(eval $(call add-scripts,$v)))
23-
$(foreach v,${HELPERS},$(eval $(call add-scripts,$v)))
27+
$(foreach v,${BOARDS},$(eval $(call add-scripts,$(BOOTRR_DIR),$v)))
28+
$(foreach v,${HELPERS},$(eval $(call add-scripts,$(BOOTRR_DIR),$v)))
29+
$(foreach v,${BINS},$(eval $(call add-scripts,$(prefix),$v)))
30+
31+
bin/bootrr: bin/bootrr.in Makefile
32+
@sed -e 's!@BOOTRR@!$(BOOTRR_DIR)!g' $< > $@.tmp
33+
@mv $@.tmp $@
2434

2535
install: $(all-install)
2636

2737
CPIO := $(PWD)/$(CPIONAME).cpio
2838

2939
$(CPIO): $(all-install)
30-
@cd $(DESTDIR) && find ./$(prefix)/bin | cpio -o -H newc > $(CPIO)
40+
@cd $(DESTDIR) && find ./$(prefix) | cpio -o -H newc > $(CPIO)
3141

3242
%.cpio.gz: %.cpio
3343
@gzip < $< > $@
@@ -37,4 +47,4 @@ cpio: $(CPIO)
3747
cpio.gz: $(CPIO).gz
3848

3949
clean:
40-
@rm -f $(CPIO) $(CPIO).gz
50+
@rm -f $(CPIO) $(CPIO).gz bin/bootrr

bin/bootrr.in

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
BOOTRR_DIR=@BOOTRR@
4+
5+
PATH=${BOOTRR_DIR}/helpers:${PATH}
6+
7+
bootrr-generic-tests
8+
9+
for TEST in $(tr "\0" "\n" < /proc/device-tree/compatible); do
10+
if [ -x "${BOOTRR_DIR}/boards/${TEST}" ]; then
11+
${BOOTRR_DIR}/boards/${TEST}
12+
fi
13+
done

0 commit comments

Comments
 (0)