-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.projects
75 lines (61 loc) · 2.26 KB
/
Makefile.projects
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Project management
show-projects:
@echo "Git Projects: $(GIT_PROJECTS)"
@echo "Archive Projects: $(TAR_PROJECTS)"
# Have repositories
# Git variables
#
# <project>-git-repo - URI of the repo to clone
# <project>-git-checkout - Something to checkout (commit/branch/etc)
# <project>-git-clone-opts - Extra options for cloning
# You can see all those with the target 'show-%-git'
.PHONY:
$(GIT_PROJECTS:%=show-%-vars)::
@echo "$(@:show-%-vars=%-git-repo) = $($(@:show-%-vars=%-git-repo))"
@echo "$(@:show-%-vars=%-git-checkout) = $($(@:show-%-vars=%-git-checkout))"
@echo "$(@:show-%-vars=%-git-clone-opts) = $($(@:show-%-vars=%-git-cone-opts))"
.PHONY:
.SECONDEXPANSION :
$(GIT_PROJECTS) : $(SOURCES_DIR)/$$@-git
$(SOURCES_DIR)/%-git :
$(call remote-maybe, if [ ! -d $@ ] || [ -z "$(force-$*-clone)" ]; then \
git clone $($*-git-clone-opts) $($*-git-repo) $@ && \
cd $@ && \
[ -n "$($*-git-checkout)" ] && git checkout $($*-git-checkout) || echo "Nothing to checkout"; \
fi)
%-git-purge:
$(call remote-maybe, rm -rf $(SOURCES_DIR)/$*-git)
.PHONY:
%-git-clean:
$(call remote-maybe, cd $(SOURCES_DIR)/$*-git && $(MAKE) clean)
%-distclean:
$(call remote-maybe, cd $(SOURCES_DIR)/$*-git && $(MAKE) distclean)
print-vars:
@echo "GNU_TOOLS_FTP=$(GNU_TOOLS_FTP)"
@echo "GNU_TOOLS_ZIP=$(GNU_TOOLS_ZIP)"
@echo "GNU_TOOLS_DIR=$(GNU_TOOLS_DIR)"
@echo "GNU_TOOLS=$(GNU_TOOLS)"
@echo "GNU_TOOLS_UTILS=$(GNU_TOOLS_UTILS)"
@echo "GNU_TOOLS_BIN=$(GNU_TOOLS_BIN)"
@echo "GNU_TOOLS_HOST=$(GNU_TOOLS_HOST)"
@echo "GNU_TOOLS_PREFIX=$(GNU_TOOLS_PREFIX)"
@echo "CROSS_COMPILE=$(CROSS_COMPILE)"
@echo "PATH=$(PATH)"
@echo "uboot-git-repo=$(uboot-git-repo)"
@echo "linux-git-repo=$(linux-git-repo)"
@echo "busybox-git-repo=$(busybox-git-repo)"
@echo "openssh-zip-url=$(openssh-zip-url)"
# For zip archives we need a url to the zip archive an the path from
# the zip root to the project root.
.SECONDEXPANSION :
$(TAR_PROJECTS) : $(SOURCES_DIR) $(SOURCES_DIR)/$$@-archive
.SECONDARY:
$(DRAFTS_DIR)/%.tar.gz: | $(DRAFTS_DIR)
echo "Pulling $*."
wget $($*-tar-url) -O $(DRAFTS_DIR)/$*.tar.gz
.SECONDEXPANSION :
$(SOURCES_DIR)/%-archive : | $(DRAFTS_DIR)/$$*.tar.gz
mkdir $@
cd $@ && tar xvzf $(DRAFTS_DIR)/$*.tar.gz
%-clean-archive:
rm -rf $(SOURCES_DIR)/$*-archive $(DRAFTS_DIR)/$*.tar.gz