Makefile: add docker-shell target(s).
authorJoel Martin <github@martintribe.org>
Fri, 15 Sep 2017 04:37:26 +0000 (23:37 -0500)
committerJoel Martin <github@martintribe.org>
Fri, 15 Sep 2017 04:37:26 +0000 (23:37 -0500)
Makefile

index 38a189a..c446e19 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,8 @@ all help:
        @echo
        @echo 'make "docker-build^IMPL"          # build docker image for IMPL'
        @echo
+       @echo 'make "docker-shell^IMPL"          # start bash shell in docker image for IMPL'
+       @echo
 
 #
 # Command line settings
@@ -276,10 +278,10 @@ get_build_command = $(strip $(if $(strip $(DOCKERIZE)),\
     ,\
     $(MAKE) $(if $(strip $($(1)_MODE)),$(1)_MODE=$($(1)_MODE),)))
 
-# Takes impl and step arguments
+# Takes impl and step args. Optional env vars and dockerize args
 # Returns a command prefix (docker command and environment variables)
 # necessary to launch the given impl and step
-get_run_prefix = $(strip $(if $(strip $(DOCKERIZE)),\
+get_run_prefix = $(strip $(if $(strip $(DOCKERIZE) $(4)),\
     docker run -e STEP=$($2) -e MAL_IMPL=$(MAL_IMPL) \
     -it --rm -u $(shell id -u) \
     -v $(dir $(abspath $(lastword $(MAKEFILE_LIST)))):/mal \
@@ -315,6 +317,8 @@ ALL_TESTS = $(filter-out $(test_EXCLUDES),\
 
 DOCKER_BUILD = $(foreach impl,$(DO_IMPLS),docker-build^$(impl))
 
+DOCKER_SHELL = $(foreach impl,$(DO_IMPLS),docker-shell^$(impl))
+
 IMPL_PERF = $(foreach impl,$(filter-out $(perf_EXCLUDES),$(DO_IMPLS)),perf^$(impl))
 
 IMPL_REPL = $(foreach impl,$(DO_IMPLS),repl^$(impl))
@@ -377,29 +381,26 @@ $(STEP_TESTS): $$(foreach step,$$(subst test^,,$$@),$$(filter %^$$(step),$$(ALL_
 
 
 #
-# Dist rules
+# Docker build rules
 #
 
-dist: $(IMPL_DIST)
+docker-build: $(DOCKER_BUILD)
 
-$(IMPL_DIST):
+$(DOCKER_BUILD):
        @echo "----------------------------------------------"; \
        $(foreach impl,$(word 2,$(subst ^, ,$(@))),\
-         echo "Running: make -C $(impl) dist"; \
-         $(MAKE) --no-print-directory -C $(impl) dist)
-
+         echo "Running: docker build -t $(call impl_to_image,$(impl)) .:"; \
+         cd $(impl) && docker build -t $(call impl_to_image,$(impl)) .)
 
 #
-# Docker build rules
+# Docker shell rules
 #
 
-docker-build: $(DOCKER_BUILD)
-
-$(DOCKER_BUILD):
-       echo "----------------------------------------------"; \
+$(DOCKER_SHELL):
+       @echo "----------------------------------------------"; \
        $(foreach impl,$(word 2,$(subst ^, ,$(@))),\
-         echo "Running: docker build -t $(call impl_to_image,$(impl)) .:"; \
-         cd $(impl) && docker build -t $(call impl_to_image,$(impl)) .)
+         echo "Running: $(call get_run_prefix,$(impl),stepA,,dockerize) bash"; \
+         $(call get_run_prefix,$(impl),stepA,,dockerize) bash)
 
 
 #