<commit_before>-include config.mk	# Create and use this file to override any of 'Settings' #

# Settings #
SRC					?=	src
OUT					?=	.output
.BUILD				?=	.build
NODEJS				?=	node_modules

# Use 'TARGET=public-ludumdare.com' if you want to build a specific build (such as public-ludumdare.com) #
ifneq ($(strip $(TARGET)),)
THE_MAKEFILES			:=	$(SRC)/$(subst /,,$(TARGET))/Makefile
endif # BUILD

# if JOBS are specified in config.mk, then use that to start a parallel build
ifdef JOBS
ifndef MAIN_FOLDER
$(info [*] Running with $(JOBS) JOBS)
endif # MAIN_FOLDER
JOBS				:=	-j $(JOBS)
endif # JOBS

ifndef MAIN_FOLDER
ifdef DEBUG
$(info [*] Debug output enabled)
endif # DEBUG
endif # MAIN_FOLDER

ifndef MAIN_FOLDER
ifdef SOURCEMAPS
$(info [*] Source Maps enabled)
endif # SOURCEMAPS
endif # MAIN_FOLDER

# TODO: REMOVE THIS
STATIC_DOMAIN		?=	static.jammer.work

# Copy un-minified files
ifdef WINDOWS_HOST
ifndef MAIN_FOLDER
$(info [*] Running on WINDOWS_HOST)
endif # MAIN_FOLDER
endif # WINDOWS_HOST

# Include Folders (modified by recursive scripts) #
ifdef INCLUDE_FOLDERS
INCLUDE_FOLDERS		+=	src/compat/
endif # INCLUDE_FOLDERS
INCLUDE_FOLDERS		?=	$(SRC)/
BUILD_FOLDER		:=	$(OUT)/$(.BUILD)/$(subst /,,$(TARGET))

# Functions (must use '=', and not ':=') #
REMOVE_UNDERSCORE	=	$(foreach v,$(1),$(if $(findstring /_,$(v)),,$(v)))
INCLUDE_INCLUDES	=	$(filter $(addsuffix %,$(dir $(INCLUDE_FOLDERS))),$(1))
FIND_FILE			=	$(call REMOVE_UNDERSCORE,$(call INCLUDE_INCLUDES,$(shell find $(1) -name '$(2)')))
# NOTE: My standard build tree rule is to ignore any file/folder prefixed with an underscore #

# Files #
ALL_JS_FILES		:=	$(filter-out %.min.js,$(call FIND_FILE,$(SRC)/,*.js))
ALL_LESS_FILES		:=	$(filter-out %.min.less,$(call FIND_FILE,$(SRC)/,*.less))
ALL_CSS_FILES		:=	$(filter-out %.min.css,$(call FIND_FILE,$(SRC)/,*.css))
ALL_SVG_FILES		:=	$(filter-out %.min.svg,$(call FIND_FILE,$(SRC)/,*.svg))

ALL_ESIGNORE_FILES	:=	$(call FIND_FILE,$(SRC)/,.es6ignore)
ESIGNORE_FOLDERS	:=	$(addsuffix %,$(dir $(ALL_ESIGNORE_FILES)))

# Transforms #
ES_FILES 			:=	$(filter-out $(ESIGNORE_FOLDERS),$(ALL_JS_FILES))
JS_FILES 			:=	$(filter $(ESIGNORE_FOLDERS),$(ALL_JS_FILES))
LESS_FILES			:=	$(ALL_LESS_FILES)
CSS_FILES			:=	$(ALL_CSS_FILES)
SVG_FILES			:=	$(ALL_SVG_FILES)

OUT_ES_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(ES_FILES:.js=.es.js))
OUT_JS_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(JS_FILES:.js=.o.js))
OUT_LESS_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(LESS_FILES:.less=.less.css))
OUT_CSS_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(CSS_FILES:.css=.o.css))
OUT_SVG_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(SVG_FILES:.svg=.min.svg))

OUT_FILES_SVG		:=	$(OUT_SVG_FILES)
OUT_FILES_CSS		:=	$(OUT_CSS_FILES) $(OUT_LESS_FILES)
OUT_FILES_JS		:=	$(OUT_JS_FILES) $(OUT_ES_FILES)
OUT_FILES			:=	$(OUT_FILES_SVG) $(OUT_FILES_CSS) $(OUT_FILES_JS)
DEP_FILES			:=	$(addsuffix .dep,$(OUT_ES_FILES) $(OUT_LESS_FILES))
OUT_FOLDERS			:=	$(sort $(dir $(OUT_FILES) $(BUILD_FOLDER)/))

TARGET_FILES_SVG		:=	$(TARGET_FOLDER)/all.min.svg
TARGET_FILES_CSS		:=	$(TARGET_FOLDER)/all.min.css
TARGET_FILES_JS		:=	$(TARGET_FOLDER)/all.min.js
ifdef DEBUG
TARGET_FILES_CSS		+=	$(TARGET_FOLDER)/all.debug.css
TARGET_FILES_JS		+=	$(TARGET_FOLDER)/all.debug.js
endif # DEBUG
TARGET_FILES		:=	$(TARGET_FILES_SVG) $(TARGET_FILES_CSS) $(TARGET_FILES_JS)


# Tools #

# Ecmascript Linter: http://eslint.org/
ESLINT_ARGS			:=	--config src/config/eslint.config.json
ESLINT				=	$(NODEJS)/eslint/bin/eslint.js $(1) $(ESLINT_ARGS)
# ES Compiler: https://buble.surge.sh/guide/
BUBLE_ARGS			:=	--no modules --jsx h --objectAssign Object.assign
#ifdef SOURCEMAPS
#BUBLE_ARGS			+=	-m inline
#endif # SOURCEMAPS
BUBLE				=	$(NODEJS)/buble/bin/buble $(BUBLE_ARGS) -i $(1) -o $(2)
# ES Include/Require Resolver: http://rollupjs.org/guide/
ROLLUP_ARGS			:=	-c src/config/rollup.config.js
ifdef SOURCEMAPS
ROLLUP_ARGS			+=	-m inline
endif # SOURCEMAPS
ROLLUP				=	$(NODEJS)/rollup/bin/rollup $(ROLLUP_ARGS) $(1) > $(2)
# JS Preprocessor: https://github.com/moisesbaez/preprocess-cli-tool
JS_PP_DEBUG			=	$(NODEJS)/preprocess-cli-tool/bin/preprocess.js -f $(1) -d $(2) -c '{"DEBUG": true}' -t js
JS_PP_RELEASE		=	$(NODEJS)/preprocess-cli-tool/bin/preprocess.js -f $(1) -d $(2) -t js
# JS Minifier: https://github.com/mishoo/UglifyJS2
MINIFY_JS_RESERVED	:=	VERSION_STRING,STATIC_DOMAIN
MINIFY_JS_ARGS		:=	--compress --mangle -r "$(MINIFY_JS_RESERVED)"
MINIFY_JS			=	$(NODEJS)/uglify-js/bin/uglifyjs $(MINIFY_JS_ARGS) -o $(2) -- $(1)

# CSS Compiler: http://lesscss.org/
LESS_COMMON			:=	--global-var='STATIC_DOMAIN=$(STATIC_DOMAIN)' --include-path=$(MAIN_FOLDER)
LESS_ARGS			:=	--autoprefix
LESS_DEP			=	$(NODEJS)/less/bin/lessc $(LESS_COMMON) --depends $(1) $(2)>$(2).dep
LESS				=	$(NODEJS)/less/bin/lessc $(LESS_COMMON) $(LESS_ARGS) $(1) $(2)
# CSS Minifier: https://github.com/jakubpawlowicz/clean-css/
MINIFY_CSS			=	cat $(1) | $(NODEJS)/clean-css-cli/bin/cleancss -o $(2)
# CSS Linter: http://stylelint.io/
STYLELINT_ARGS			:=	--syntax less --config src/config/.stylelintrc --config-basedir ../../
STYLELINT				=	$(NODEJS)/stylelint/bin/stylelint.js $(1) $(STYLELINT_ARGS)

# SVG "Compiler", same as the minifier: https://github.com/svg/svgo
SVGO_ARGS			:=	-q --disable=removeTitle --disable=removeDimensions --disable=removeViewBox
SVGO				=	$(NODEJS)/svgo/bin/svgo $(SVGO_ARGS) -i $(1) -o $(2)
# Mike's SVG Sprite Packer: https://github.com/povrazor/svg-sprite-tools
SVG_PACK			=	src/tools/svg-sprite-pack $(1) > $(2)
# SVG Minifier: https://github.com/svg/svgo
MINIFY_SVG_ARGS		:=	--multipass --disable=cleanupIDs -q
MINIFY_SVG			=	$(NODEJS)/svgo/bin/svgo $(MINIFY_SVG_ARGS) -i $(1) -o $(2)

# Remove Empty Directories
RM_EMPTY_DIRS		=	find $(1) -type d -empty -delete 2>/dev/null |true

# Get size in bytes (compress and uncompressed)
SIZE				=	cat $(1) | wc -c
GZIP_SIZE			=	gzip -c $(1) | wc -c

COL_OFF				=	\e[0m
COL_RED				=	\e[91m
COL_GREEN			=	\e[92m
COL_YELLOW			=	\e[93m
COL_BLUE			=	\e[94m
COL_PURPLE			=	\e[95m
COL_CYAN			=	\e[96m
COL_WHITE			=	\e[97m

# Rules #<commit_msg>can now disable makefile color<commit_after>-include config.mk	# Create and use this file to override any of 'Settings' #

# Settings #
SRC					?=	src
OUT					?=	.output
.BUILD				?=	.build
NODEJS				?=	node_modules

# Use 'TARGET=public-ludumdare.com' if you want to build a specific build (such as public-ludumdare.com) #
ifneq ($(strip $(TARGET)),)
THE_MAKEFILES			:=	$(SRC)/$(subst /,,$(TARGET))/Makefile
endif # BUILD

# if JOBS are specified in config.mk, then use that to start a parallel build
ifdef JOBS
ifndef MAIN_FOLDER
$(info [*] Running with $(JOBS) JOBS)
endif # MAIN_FOLDER
JOBS				:=	-j $(JOBS)
endif # JOBS

ifndef MAIN_FOLDER
ifdef DEBUG
$(info [*] Debug output enabled)
endif # DEBUG
endif # MAIN_FOLDER

ifndef MAIN_FOLDER
ifdef SOURCEMAPS
$(info [*] Source Maps enabled)
endif # SOURCEMAPS
endif # MAIN_FOLDER

# TODO: REMOVE THIS
STATIC_DOMAIN		?=	static.jammer.work

# Copy un-minified files
ifdef WINDOWS_HOST
ifndef MAIN_FOLDER
$(info [*] Running on WINDOWS_HOST)
endif # MAIN_FOLDER
endif # WINDOWS_HOST

# Include Folders (modified by recursive scripts) #
ifdef INCLUDE_FOLDERS
INCLUDE_FOLDERS		+=	src/compat/
endif # INCLUDE_FOLDERS
INCLUDE_FOLDERS		?=	$(SRC)/
BUILD_FOLDER		:=	$(OUT)/$(.BUILD)/$(subst /,,$(TARGET))

# Functions (must use '=', and not ':=') #
REMOVE_UNDERSCORE	=	$(foreach v,$(1),$(if $(findstring /_,$(v)),,$(v)))
INCLUDE_INCLUDES	=	$(filter $(addsuffix %,$(dir $(INCLUDE_FOLDERS))),$(1))
FIND_FILE			=	$(call REMOVE_UNDERSCORE,$(call INCLUDE_INCLUDES,$(shell find $(1) -name '$(2)')))
# NOTE: My standard build tree rule is to ignore any file/folder prefixed with an underscore #

# Files #
ALL_JS_FILES		:=	$(filter-out %.min.js,$(call FIND_FILE,$(SRC)/,*.js))
ALL_LESS_FILES		:=	$(filter-out %.min.less,$(call FIND_FILE,$(SRC)/,*.less))
ALL_CSS_FILES		:=	$(filter-out %.min.css,$(call FIND_FILE,$(SRC)/,*.css))
ALL_SVG_FILES		:=	$(filter-out %.min.svg,$(call FIND_FILE,$(SRC)/,*.svg))

ALL_ESIGNORE_FILES	:=	$(call FIND_FILE,$(SRC)/,.es6ignore)
ESIGNORE_FOLDERS	:=	$(addsuffix %,$(dir $(ALL_ESIGNORE_FILES)))

# Transforms #
ES_FILES 			:=	$(filter-out $(ESIGNORE_FOLDERS),$(ALL_JS_FILES))
JS_FILES 			:=	$(filter $(ESIGNORE_FOLDERS),$(ALL_JS_FILES))
LESS_FILES			:=	$(ALL_LESS_FILES)
CSS_FILES			:=	$(ALL_CSS_FILES)
SVG_FILES			:=	$(ALL_SVG_FILES)

OUT_ES_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(ES_FILES:.js=.es.js))
OUT_JS_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(JS_FILES:.js=.o.js))
OUT_LESS_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(LESS_FILES:.less=.less.css))
OUT_CSS_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(CSS_FILES:.css=.o.css))
OUT_SVG_FILES		:=	$(subst $(SRC)/,$(OUT)/,$(SVG_FILES:.svg=.min.svg))

OUT_FILES_SVG		:=	$(OUT_SVG_FILES)
OUT_FILES_CSS		:=	$(OUT_CSS_FILES) $(OUT_LESS_FILES)
OUT_FILES_JS		:=	$(OUT_JS_FILES) $(OUT_ES_FILES)
OUT_FILES			:=	$(OUT_FILES_SVG) $(OUT_FILES_CSS) $(OUT_FILES_JS)
DEP_FILES			:=	$(addsuffix .dep,$(OUT_ES_FILES) $(OUT_LESS_FILES))
OUT_FOLDERS			:=	$(sort $(dir $(OUT_FILES) $(BUILD_FOLDER)/))

TARGET_FILES_SVG		:=	$(TARGET_FOLDER)/all.min.svg
TARGET_FILES_CSS		:=	$(TARGET_FOLDER)/all.min.css
TARGET_FILES_JS		:=	$(TARGET_FOLDER)/all.min.js
ifdef DEBUG
TARGET_FILES_CSS		+=	$(TARGET_FOLDER)/all.debug.css
TARGET_FILES_JS		+=	$(TARGET_FOLDER)/all.debug.js
endif # DEBUG
TARGET_FILES		:=	$(TARGET_FILES_SVG) $(TARGET_FILES_CSS) $(TARGET_FILES_JS)


# Tools #

# Ecmascript Linter: http://eslint.org/
ESLINT_ARGS			:=	--config src/config/eslint.config.json
ESLINT				=	$(NODEJS)/eslint/bin/eslint.js $(1) $(ESLINT_ARGS)
# ES Compiler: https://buble.surge.sh/guide/
BUBLE_ARGS			:=	--no modules --jsx h --objectAssign Object.assign
#ifdef SOURCEMAPS
#BUBLE_ARGS			+=	-m inline
#endif # SOURCEMAPS
BUBLE				=	$(NODEJS)/buble/bin/buble $(BUBLE_ARGS) -i $(1) -o $(2)
# ES Include/Require Resolver: http://rollupjs.org/guide/
ROLLUP_ARGS			:=	-c src/config/rollup.config.js
ifdef SOURCEMAPS
ROLLUP_ARGS			+=	-m inline
endif # SOURCEMAPS
ROLLUP				=	$(NODEJS)/rollup/bin/rollup $(ROLLUP_ARGS) $(1) > $(2)
# JS Preprocessor: https://github.com/moisesbaez/preprocess-cli-tool
JS_PP_DEBUG			=	$(NODEJS)/preprocess-cli-tool/bin/preprocess.js -f $(1) -d $(2) -c '{"DEBUG": true}' -t js
JS_PP_RELEASE		=	$(NODEJS)/preprocess-cli-tool/bin/preprocess.js -f $(1) -d $(2) -t js
# JS Minifier: https://github.com/mishoo/UglifyJS2
MINIFY_JS_RESERVED	:=	VERSION_STRING,STATIC_DOMAIN
MINIFY_JS_ARGS		:=	--compress --mangle -r "$(MINIFY_JS_RESERVED)"
MINIFY_JS			=	$(NODEJS)/uglify-js/bin/uglifyjs $(MINIFY_JS_ARGS) -o $(2) -- $(1)

# CSS Compiler: http://lesscss.org/
LESS_COMMON			:=	--global-var='STATIC_DOMAIN=$(STATIC_DOMAIN)' --include-path=$(MAIN_FOLDER)
LESS_ARGS			:=	--autoprefix
LESS_DEP			=	$(NODEJS)/less/bin/lessc $(LESS_COMMON) --depends $(1) $(2)>$(2).dep
LESS				=	$(NODEJS)/less/bin/lessc $(LESS_COMMON) $(LESS_ARGS) $(1) $(2)
# CSS Minifier: https://github.com/jakubpawlowicz/clean-css/
MINIFY_CSS			=	cat $(1) | $(NODEJS)/clean-css-cli/bin/cleancss -o $(2)
# CSS Linter: http://stylelint.io/
STYLELINT_ARGS			:=	--syntax less --config src/config/.stylelintrc --config-basedir ../../
STYLELINT				=	$(NODEJS)/stylelint/bin/stylelint.js $(1) $(STYLELINT_ARGS)

# SVG "Compiler", same as the minifier: https://github.com/svg/svgo
SVGO_ARGS			:=	-q --disable=removeTitle --disable=removeDimensions --disable=removeViewBox
SVGO				=	$(NODEJS)/svgo/bin/svgo $(SVGO_ARGS) -i $(1) -o $(2)
# Mike's SVG Sprite Packer: https://github.com/povrazor/svg-sprite-tools
SVG_PACK			=	src/tools/svg-sprite-pack $(1) > $(2)
# SVG Minifier: https://github.com/svg/svgo
MINIFY_SVG_ARGS		:=	--multipass --disable=cleanupIDs -q
MINIFY_SVG			=	$(NODEJS)/svgo/bin/svgo $(MINIFY_SVG_ARGS) -i $(1) -o $(2)

# Remove Empty Directories
RM_EMPTY_DIRS		=	find $(1) -type d -empty -delete 2>/dev/null |true

# Get size in bytes (compress and uncompressed)
SIZE				=	cat $(1) | wc -c
GZIP_SIZE			=	gzip -c $(1) | wc -c

ifneq ($(NOCOLOR),1)
COL_OFF				=	\e[0m
COL_RED				=	\e[91m
COL_GREEN			=	\e[92m
COL_YELLOW			=	\e[93m
COL_BLUE			=	\e[94m
COL_PURPLE			=	\e[95m
COL_CYAN			=	\e[96m
COL_WHITE			=	\e[97m
endif

# Rules #
{'fraction_non_alphanumeric': 0.18362282878411912, 'fraction_numerical': 0.008354011579818032, 'mean_word_length': 4.56163753449862, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 14, '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': '6007038', 'n_tokens_mistral': 5616, 'n_tokens_neox': 5163, 'n_words': 977}