Skip to content

Commit 49787c6

Browse files
committed
Makefile: allow injecting prebuilt thrift compiler
This is required for Nix builds. I also switched pwd to be resolved from PATH because /bin/pwd is not a thing on NixOS.
1 parent 9e62ac3 commit 49787c6

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#
6464

6565
CABAL_BIN=cabal
66-
PWD := $(shell /bin/pwd)
66+
PWD := $(shell pwd)
6767

6868
# There's a lot of parallelism in the schema-generated code
6969
# If you have >=16G and >=4 cores, trying passing these:
@@ -243,13 +243,25 @@ thrift:: thrift-compiler thrift-hs
243243
thrift-hs:: thrift-hsthrift-hs thrift-glean-hs
244244

245245
.PHONY: thrift-compiler
246+
# Allow injecting a prebuilt thrift compiler by setting THRIFT_COMPILE in
247+
# environment (e.g. with Nix).
248+
ifndef THRIFT_COMPILE
246249
thrift-compiler::
247250
(cd hsthrift && make CABAL="$(CABAL)" compiler)
248251
$(eval THRIFT_COMPILE := $$(shell $$(CABAL) -v0 list-bin exe:thrift-compiler))
252+
else
253+
thrift-compiler::
254+
# no-op
255+
endif
249256

250257
.PHONY: thrift-hsthrift-hs
258+
ifndef THRIFT_COMPILE
251259
thrift-hsthrift-hs::
252260
(cd hsthrift && make CABAL="$(CABAL)" thrift-hs)
261+
else
262+
thrift-hsthrift-hs::
263+
# no-op
264+
endif
253265

254266
.PHONY: gen-schema
255267
gen-schema :: glean.cabal cxx-libraries

0 commit comments

Comments
 (0)