-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
60 lines (44 loc) · 1.78 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
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
PROJECT_ROOT=$(shell realpath .)
OUT_DIR = build-cache
GEN_DIRS += $(OUT_DIR)
PTXPROJ = ptxproj
PTXPROJ_PATH=$(PROJECT_ROOT)/$(PTXPROJ)
GEN_DIRS += $(PTXPROJ)
USERID ?= $(shell id -u)
USERID := $(USERID)
DOCKER_BUILDFLAGS += --build-arg 'USERID=$(USERID)'
ifeq ("$(USERID)","0")
$(error Do not run as root)
endif
.PHONY: all
all: builder
$(GEN_DIRS):
mkdir -p $@
.PHONY: builder
builder: $(OUT_DIR)/cc100-builder
$(OUT_DIR)/cc100-builder: Dockerfile docker/build.sh Makefile | $(OUT_DIR)
docker build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag cc100-builder docker
.PHONY: bash
bash: builder | $(PTXPROJ)
docker run --rm -it --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder bash
.PHONY: get
get: builder | $(PTXPROJ)
docker run --rm -it --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder build get
.PHONY: offline-get
offline-get: builder | $(PTXPROJ)
docker run --rm -i --network none --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder build get
.PHONY: init
init: builder | $(PTXPROJ)
docker run --rm -i --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder build init
.PHONY: build
build: builder | $(PTXPROJ)
docker run --rm -it --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder build
.PHONY: offline-build
offline-build: builder | $(PTXPROJ)
docker run --rm -it --network none --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder build
.PHONY: images
images: builder | $(PTXPROJ)
docker run --rm -it --network none --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder build images
.PHONY: wup
wup: builder | $(PTXPROJ)
docker run --rm -it --network none --user "$(USERID)" -v "$(PTXPROJ_PATH):/home/user/ptxproj" cc100-builder build wup