Skip to content

Commit

Permalink
Move Makefile variable def's to the top.
Browse files Browse the repository at this point in the history
Looks like there are parts of a Makefile that are parsed from top to
bottom. The last refactoring of the Makefile, which moved the
`IN_DOCKER` logic nearer to the bottom caused the `ifneq` blocks to not
be evaluated in time. The fix was to move this back up to the top which
sadly reduces the Makefile's readability, but at least it's correct
again. Sorry, y'all!

Signed-off-by: Fletcher Nichol <[email protected]>

Pull request: #587
Approved by: juliandunn
  • Loading branch information
fnichol authored and jtimberman committed Jun 12, 2016
1 parent 2f02cfe commit 9f136df
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
IN_DOCKER := true
endif

ifneq ($(IN_DOCKER),)
build_args := --build-arg HAB_DEPOT_URL=$(HAB_DEPOT_URL)
run_args := -e HAB_DEPOT_URL=$(HAB_DEPOT_URL)
run_args := $(run_args) -e HAB_ORIGIN=$(HAB_ORIGIN)
ifneq (${http_proxy},)
build_args := $(build_args) --build-arg http_proxy="${http_proxy}"
run_args := $(run_args) -e http_proxy="${http_proxy}"
endif
ifneq (${https_proxy},)
build_args := $(build_args) --build-arg https_proxy="${https_proxy}"
run_args := $(run_args) -e https_proxy="${https_proxy}"
endif

dimage := habitat/devshell
docker_cmd := env http_proxy= https_proxy= docker
compose_cmd := env http_proxy= https_proxy= docker-compose
common_run := $(compose_cmd) run --rm $(run_args)
run := $(common_run) shell
docs_host := ${DOCKER_HOST}
docs_run := $(common_run) -p 9633:9633 shell
else
run :=
docs_host := 127.0.0.1
docs_run :=
endif

BIN = director hab sup
LIB = builder-dbcache builder-protocol common core depot-client depot-core net
SRV = builder-api builder-jobsrv builder-sessionsrv builder-vault builder-worker depot
Expand Down Expand Up @@ -105,37 +136,6 @@ docs: image ## build the docs
cp -r images ./components/sup/target/doc/habitat_sup; \
echo "<meta http-equiv=refresh content=0;url=habitat_sup/index.html>" > components/sup/target/doc/index.html;'

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
IN_DOCKER := true
endif

ifneq ($(IN_DOCKER),)
build_args := --build-arg HAB_DEPOT_URL=$(HAB_DEPOT_URL)
run_args := -e HAB_DEPOT_URL=$(HAB_DEPOT_URL)
run_args := $(run_args) -e HAB_ORIGIN=$(HAB_ORIGIN)
ifneq (${http_proxy},)
build_args := $(build_args) --build-arg http_proxy="${http_proxy}"
run_args := $(run_args) -e http_proxy="${http_proxy}"
endif
ifneq (${https_proxy},)
build_args := $(build_args) --build-arg https_proxy="${https_proxy}"
run_args := $(run_args) -e https_proxy="${https_proxy}"
endif

dimage := habitat/devshell
docker_cmd := env http_proxy= https_proxy= docker
compose_cmd := env http_proxy= https_proxy= docker-compose
common_run := $(compose_cmd) run --rm $(run_args)
run := $(common_run) shell
docs_host := ${DOCKER_HOST}
docs_run := $(common_run) -p 9633:9633 shell
else
run :=
docs_host := 127.0.0.1
docs_run :=
endif

define BUILD
build-$1: image ## builds the $1 component
$(run) sh -c 'cd components/$1 && cargo build'
Expand Down

0 comments on commit 9f136df

Please sign in to comment.