Files

51 lines
956 B
Makefile
Raw Permalink Normal View History

2018-02-27 11:54:26 -08:00
.PHONY: all
all:
all-install :=
2019-02-06 08:25:51 +01:00
DESTDIR ?= dest
CPIONAME ?= bootrr
HELPERS := $(wildcard helpers/*)
2018-02-27 11:54:26 -08:00
BOARDS := $(wildcard boards/*)
2018-02-27 11:54:26 -08:00
BINS := bin/bootrr bin/bootrr-generate-template
LIBEXEC_DIR ?= $(prefix)/libexec
BOOTRR_DIR = $(LIBEXEC_DIR)/bootrr
2018-02-27 11:54:26 -08:00
define add-scripts
$(DESTDIR)$1/$2: $2
2018-02-27 11:54:26 -08:00
@echo "INSTALL $$<"
@install -D -m 755 $$< $$@
all-install += $(DESTDIR)$1/$2
2018-02-27 11:54:26 -08:00
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 $@
2018-02-27 11:54:26 -08:00
install: $(all-install)
2019-02-06 08:25:51 +01:00
CPIO := $(PWD)/$(CPIONAME).cpio
$(CPIO): $(all-install)
@cd $(DESTDIR) && find ./$(prefix) | cpio -o -H newc -R +0:+0 > $(CPIO)
2019-02-06 08:25:51 +01:00
%.cpio.gz: %.cpio
@gzip < $< > $@
cpio: $(CPIO)
cpio.gz: $(CPIO).gz
2018-02-27 11:54:26 -08:00
clean:
@rm -f $(CPIO) $(CPIO).gz bin/bootrr