2016-12-05 13:12:19 -06:00
|
|
|
###############################################################################
|
|
|
|
## Wrapper for starting make inside sonic-slave container
|
|
|
|
###############################################################################
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
SHELL = /bin/bash
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
USER := $(shell id -un)
|
|
|
|
PWD := $(shell pwd)
|
2016-10-31 23:50:59 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
MAKEFLAGS += -B
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
DOCKER_RUN := docker run --rm=true --privileged \
|
|
|
|
-v $(PWD):/sonic \
|
2017-01-31 13:47:52 -06:00
|
|
|
-i$(SONIC_SLAVE_TTY)
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
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
|
2016-11-23 18:18:35 -06:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
.PHONY: sonic-slave-build sonic-slave-bash
|
2016-09-27 13:42:35 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
.DEFAULT_GOAL := all
|
2016-10-31 23:50:59 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
%::
|
|
|
|
@docker inspect --type image sonic-slave-$(USER) &> /dev/null || $(DOCKER_BUILD)
|
2017-01-31 13:47:52 -06:00
|
|
|
@$(DOCKER_RUN) sonic-slave-$(USER) make \
|
2016-12-05 13:12:19 -06:00
|
|
|
-C sonic \
|
|
|
|
-f slave.mk \
|
|
|
|
PLATFORM=$(PLATFORM) \
|
2017-01-29 13:33:33 -06:00
|
|
|
SKU=$(SKU) \
|
2017-02-14 18:56:08 -06:00
|
|
|
DEBUG_BUILD=$(DEBUG_BUILD) \
|
2016-12-05 13:12:19 -06:00
|
|
|
$@
|
2016-08-04 12:39:33 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
sonic-slave-build :
|
|
|
|
@$(DOCKER_BUILD)
|
2016-10-31 23:50:59 -05:00
|
|
|
|
2016-12-05 13:12:19 -06:00
|
|
|
sonic-slave-bash :
|
2017-01-31 13:47:52 -06:00
|
|
|
@$(DOCKER_RUN) -t sonic-slave-$(USER) bash
|