forked from linux-msm/bootrr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (32 loc) · 947 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.PHONY: all
all:
all-install :=
DESTDIR ?= dest
CPIONAME ?= bootrr
HELPERS := $(wildcard helpers/*)
BOARDS := $(wildcard boards/*)
BINS := bin/bootrr bin/bootrr-generate-template
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' $< > [email protected]
@mv [email protected] $@
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