<commit_before>NODE_DIR?=/opt/compiler-explorer/node
NPM:=$(shell env PATH=$(NODE_DIR)/bin:$(PATH) which yarn)
NODE:=$(shell env PATH=$(NODE_DIR)/bin:$(PATH) which node || env PATH=$(NODE_DIR)/bin:$(PATH) which nodejs)
default: run

NODE_VERSION_USED:=8
NODE_VERSION:=$(shell $(NODE) --version)
NODE_MAJOR_VERSION:=$(shell echo $(NODE_VERSION) | cut -f1 -d. | sed 's/^v//g')
NODE_VERSION_TEST:=$(shell [ $(NODE_MAJOR_VERSION) -eq $(NODE_VERSION_USED) ] && echo true)
NODE_VERSION_TEST_FAIL:=$(shell [ $(NODE_MAJOR_VERSION) -lt $(NODE_VERSION_USED) ] && echo true)

ifneq ($(NODE_VERSION_TEST), true)
ifeq ($(NODE_VERSION_TEST_FAIL), true)
$(error Compiler Explorer needs node v$(NODE_VERSION_USED).x, but $(NODE_VERSION) was found. \
Visit https://nodejs.org/ for installation instructions \
To configure where we look for node, set NODE_DIR to its installation base)
else
$(warning Compiler Explorer needs node v$(NODE_VERSION_USED).x, but $(NODE_VERSION) was found. \
The higher node version might work but it has not been tested.)
endif
endif

.PHONY: clean run test run-amazon c-preload optional-haskell-support optional-d-support optional-rust-support
.PHONY: dist lint prereqs node_modules travis-dist
prereqs: optional-haskell-support optional-d-support optional-rust-support node_modules webpack c-preload
GDC?=gdc
DMD?=dmd
LDC?=ldc2
ifneq "" "$(shell which $(GDC) 2>/dev/null || which $(DMD) 2>/dev/null || which $(LDC) 2>/dev/null)"
optional-d-support:
	$(MAKE) -C d
else
optional-d-support:
	@echo "D language support disabled"
endif

GHC?=ghc
ifneq "" "$(shell which $(GHC) 2>/dev/null)"
optional-haskell-support:
	$(MAKE) -C haskell
else
optional-haskell-support:
	@echo "Haskell language support disabled"
endif

ifneq "" "$(shell which cargo)"
rust/bin/rustfilt: rust/src/main.rs rust/Cargo.lock rust/Cargo.toml
	cd rust && cargo build --release && cargo install --root . --force && cargo clean
optional-rust-support: rust/bin/rustfilt 
else
optional-rust-support:
	@echo "Rust language support disabled"
endif


NODE_MODULES=.npm-updated
$(NODE_MODULES): package.json
	$(NPM) install
	@touch $@
<commit_msg>Look for yarn in /opt too, and if found there, invoke it via the picked node version (and not just whatever version of node is on the PATH)<commit_after>NODE_DIR?=/opt/compiler-explorer/node
YARN_DIR?=/opt/compiler-explorer/yarn
YARN_EXE:=$(shell env PATH=$(NODE_DIR)/bin:$(YARN_DIR)/bin:$(PATH) which yarn)
NODE:=$(shell env PATH=$(NODE_DIR)/bin:$(PATH) which node || env PATH=$(NODE_DIR)/bin:$(PATH) which nodejs)
YARN:=$(NODE) $(YARN_EXE).js
default: run

NODE_VERSION_USED:=8
NODE_VERSION:=$(shell $(NODE) --version)
NODE_MAJOR_VERSION:=$(shell echo $(NODE_VERSION) | cut -f1 -d. | sed 's/^v//g')
NODE_VERSION_TEST:=$(shell [ $(NODE_MAJOR_VERSION) -eq $(NODE_VERSION_USED) ] && echo true)
NODE_VERSION_TEST_FAIL:=$(shell [ $(NODE_MAJOR_VERSION) -lt $(NODE_VERSION_USED) ] && echo true)

ifneq ($(NODE_VERSION_TEST), true)
ifeq ($(NODE_VERSION_TEST_FAIL), true)
$(error Compiler Explorer needs node v$(NODE_VERSION_USED).x, but $(NODE_VERSION) was found. \
Visit https://nodejs.org/ for installation instructions \
To configure where we look for node, set NODE_DIR to its installation base)
else
$(warning Compiler Explorer needs node v$(NODE_VERSION_USED).x, but $(NODE_VERSION) was found. \
The higher node version might work but it has not been tested.)
endif
endif

.PHONY: clean run test run-amazon c-preload optional-haskell-support optional-d-support optional-rust-support
.PHONY: dist lint prereqs node_modules travis-dist
prereqs: optional-haskell-support optional-d-support optional-rust-support node_modules webpack c-preload
GDC?=gdc
DMD?=dmd
LDC?=ldc2
ifneq "" "$(shell which $(GDC) 2>/dev/null || which $(DMD) 2>/dev/null || which $(LDC) 2>/dev/null)"
optional-d-support:
	$(MAKE) -C d
else
optional-d-support:
	@echo "D language support disabled"
endif

GHC?=ghc
ifneq "" "$(shell which $(GHC) 2>/dev/null)"
optional-haskell-support:
	$(MAKE) -C haskell
else
optional-haskell-support:
	@echo "Haskell language support disabled"
endif

ifneq "" "$(shell which cargo)"
rust/bin/rustfilt: rust/src/main.rs rust/Cargo.lock rust/Cargo.toml
	cd rust && cargo build --release && cargo install --root . --force && cargo clean
optional-rust-support: rust/bin/rustfilt 
else
optional-rust-support:
	@echo "Rust language support disabled"
endif


NODE_MODULES=.npm-updated
$(NODE_MODULES): package.json
	$(YARN) install
	@touch $@

{'fraction_non_alphanumeric': 0.14458641560188298, 'fraction_numerical': 0.003138309796009863, 'mean_word_length': 5.410919540229885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3641512', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1509, 'n_words': 432}