forked from sonoble/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (29 loc) · 942 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
###############################################################################
## Wrapper for starting make inside sonic-slave container
###############################################################################
SHELL = /bin/bash
USER := $(shell id -un)
PWD := $(shell pwd)
MAKEFLAGS += -B
DOCKER_RUN := docker run --rm=true --privileged \
-v $(PWD):/sonic \
-it sonic-slave-$(USER)
DOCKER_BUILD = docker build --no-cache \
--build-arg user=$(USER) \
--build-arg uid=$(shell id -u) \
--build-arg guid=$(shell id -g) \
-t sonic-slave-$(USER) \
sonic-slave
.PHONY: sonic-slave-build sonic-slave-bash
.DEFAULT_GOAL := all
%::
@docker inspect --type image sonic-slave-$(USER) &> /dev/null || $(DOCKER_BUILD)
@$(DOCKER_RUN) make \
-C sonic \
-f slave.mk \
PLATFORM=$(PLATFORM) \
$@
sonic-slave-build :
@$(DOCKER_BUILD)
sonic-slave-bash :
@$(DOCKER_RUN) bash