Skip to content

Commit

Permalink
Makefile: Allow custom extensions for exports and spec flags (#15099)
Browse files Browse the repository at this point in the history
This allows to add custom exports or spec flags from CLI arguments or `Makefile.local`.

For example `make std_spec EXPORTS=-Dpreview_mt SPEC_FLAGS=--tag=~slow`.
  • Loading branch information
straight-shoota authored Nov 26, 2024
1 parent 558ce7b commit 5aa1204
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SOURCES := $(shell find src -name '*.cr')
SPEC_SOURCES := $(shell find spec -name '*.cr')
override FLAGS += -D strict_multi_assign -D preview_overload_order $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )$(if $(target),--cross-compile --target $(target) )$(if $(interpreter),,-Dwithout_interpreter )
SPEC_WARNINGS_OFF := --exclude-warnings spec/std --exclude-warnings spec/compiler --exclude-warnings spec/primitives
SPEC_FLAGS := $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )$(if $(order),--order=$(order) )
override SPEC_FLAGS += $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )$(if $(order),--order=$(order) )
CRYSTAL_CONFIG_LIBRARY_PATH := '$$ORIGIN/../lib/crystal'
CRYSTAL_CONFIG_BUILD_COMMIT ?= $(shell git rev-parse --short HEAD 2> /dev/null)
CRYSTAL_CONFIG_PATH := '$$ORIGIN/../share/crystal/src'
Expand All @@ -53,11 +53,11 @@ check_lld := command -v ld.lld >/dev/null && case "$$(uname -s)" in MINGW32*|MIN
ifeq ($(shell $(check_lld)),1)
EXPORT_CC ?= CC="$(CC) -fuse-ld=lld"
endif
EXPORTS := \
override EXPORTS += \
CRYSTAL_CONFIG_BUILD_COMMIT="$(CRYSTAL_CONFIG_BUILD_COMMIT)" \
CRYSTAL_CONFIG_PATH=$(CRYSTAL_CONFIG_PATH) \
SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)"
EXPORTS_BUILD := \
override EXPORTS_BUILD += \
$(EXPORT_CC) \
CRYSTAL_CONFIG_LIBRARY_PATH=$(CRYSTAL_CONFIG_LIBRARY_PATH)
SHELL = sh
Expand Down

0 comments on commit 5aa1204

Please sign in to comment.