Skip to content

Commit a10d93a

Browse files
committed
Support running docker-builds from out-of-tree (shadow) builds
1 parent b70e8fb commit a10d93a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ make_noop = $(eval $$($1): % : ; @:)
7777
ensure_binary = $(if $(shell which $1),,\
7878
$(error Could not find '$(strip $1)' binary))
7979

80+
# Note: Doesn't work for paths with spaces in them
81+
SRC_DIR=$(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
82+
8083
# ------------ Multiple platforms ------------
8184

8285
ifeq ($(shell expr $(words $(PLATFORMS)) \> 1), 1)
@@ -95,7 +98,8 @@ else ifneq ($(NATIVE_PLATFORM),$(PLATFORMS))
9598
linux-gcc-%: docker ;
9699
docker:
97100
$(call ensure_binary,docker-compose)
98-
@docker-compose run --rm $(PLATFORMS) $(MFLAGS) $(ACTUAL_GOALS) DEBUG=$(DEBUG); \
101+
@docker-compose -f $(SRC_DIR)/docker-compose.yaml run --rm \
102+
$(PLATFORMS) $(MFLAGS) $(ACTUAL_GOALS) DEBUG=$(DEBUG); \
99103
stty sane # Work around docker-compose messing up the terminal
100104

101105
$(call make_noop,ACTUAL_GOALS)
@@ -117,8 +121,6 @@ ifeq ($(strip $(ACTUAL_GOALS)),)
117121
$(NATIVE_PLATFORM): $(ACTUAL_GOALS)
118122
endif
119123

120-
# Note: Doesn't work for paths with spaces in them
121-
SRC_DIR=$(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
122124
vpath %.cpp $(SRC_DIR)/src
123125

124126
PKG_CONFIG = pkg-config

0 commit comments

Comments
 (0)