-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (27 loc) · 1.62 KB
/
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
.PHONY: all modules cask deps
NPROCS:=1
OS:=$(shell uname -s)
ifeq ($(OS),Linux)
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
endif
ifeq ($(OS),Darwin) # Assume Mac OS X
NPROCS:=$(shell system_profiler | awk '/Number Of CPUs/{print $4}{next;}')
endif
all: modules deps
modules:
make -C modules
cask:
ifeq (,$(shell command -v cask 2> /dev/null))
curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python
endif
deps:
make -C deps
remote-update:
-git submodule foreach --recursive --quiet pwd | xargs -P${NPROCS} -I{} bash -c "cd {}; git reset HEAD --hard"
-git submodule foreach --recursive --quiet pwd | xargs -P${NPROCS} -I{} bash -c "cd {}; git fetch --recurse-submodules --prune"
-git submodule foreach --recursive --quiet pwd | xargs -P${NPROCS} -I{} bash -c "cd {}; git checkout origin/$(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
-git submodule foreach --recursive --quiet pwd | xargs -P${NPROCS} -I{} bash -c "cd {}; git branch -D $(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
-git submodule foreach --recursive --quiet pwd | xargs -P${NPROCS} -I{} bash -c "cd {}; git checkout -b master origin/$(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
-git submodule foreach --recursive --quiet pwd | xargs -P${NPROCS} -I{} bash -c "cd {}; git checkout $(shell git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
-git submodule foreach --recursive --quiet pwd | xargs -P${NPROCS} -I{} bash -c "cd {}; git submodule update --init --recursive"
update: remote-update deps modules