@@ -128,8 +128,8 @@ CLANG_TARGET_PLATFORM?=$(TARGET_PLATFORM)
128128LLVM_STATIC_RELEASE_URL? =https://github.com/savi-lang/llvm-static/releases/download/20220112
129129$(eval $(call MAKE_VAR_CACHE_FOR,LLVM_STATIC_RELEASE_URL))
130130
131- # Specify where to download our pre-built LLVM/clang static libraries from.
132- # This needs to get bumped explicitly here when we do a new LLVM build.
131+ # Specify where to download our pre-built runtime bitcode from.
132+ # This needs to get bumped explicitly here when we do a new runtime build.
133133RUNTIME_BITCODE_RELEASE_URL? =https://github.com/savi-lang/runtime-bitcode/releases/download/20220105b
134134$(eval $(call MAKE_VAR_CACHE_FOR,RUNTIME_BITCODE_RELEASE_URL))
135135
@@ -139,6 +139,11 @@ $(eval $(call MAKE_VAR_CACHE_FOR,RUNTIME_BITCODE_RELEASE_URL))
139139LLVM_PATH? =$(BUILD ) /llvm-static
140140LLVM_CONFIG? =$(LLVM_PATH ) /bin/llvm-config
141141
142+ # Specify where to download the fswatch release source tarball from.
143+ # This needs to get bumped explicitly here to update to a different version.
144+ FSWATCH_RELEASE_URL? =https://github.com/emcrisostomo/fswatch/releases/download/1.16.0/fswatch-1.16.0.tar.gz
145+ $(eval $(call MAKE_VAR_CACHE_FOR,FSWATCH_RELEASE_URL))
146+
142147# Determine which flavor of the C++ standard library to link against.
143148# We choose libstdc++ on Linux, and libc++ on FreeBSD and MacOS.
144149ifneq (,$(findstring linux,$(TARGET_PLATFORM ) ) )
@@ -168,6 +173,21 @@ endif
168173# including the LLVM extensions C++ file we need to build and link.
169174CRYSTAL_PATH? =$(shell env $(shell crystal env) printenv CRYSTAL_PATH | rev | cut -d ':' -f 1 | rev)
170175
176+ # Download the fswatch library sourece code to build it.
177+ $(BUILD ) /fswatch : $(MAKE_VAR_CACHE ) /FSWATCH_RELEASE_URL
178+ rm -rf $@ -tmp
179+ mkdir -p $@ -tmp
180+ cd $@ -tmp && curl -L --fail -sS " ${FSWATCH_RELEASE_URL} " \
181+ | tar --strip-components=1 -xzvf -
182+ rm -rf $@
183+ mv $@ -tmp $@
184+ touch $@
185+
186+ # Build the static library for the fswatch library sourece code to build it.
187+ LIB_FSWATCH? =$(BUILD ) /fswatch/libfswatch/src/libfswatch/.libs/libfswatch.a
188+ $(LIB_FSWATCH ) : $(BUILD ) /fswatch
189+ cd $^ && ./configure && make
190+
171191# Download the runtime bitcode library we have built separately.
172192# See github.com/savi-lang/runtime-bitcode for more info.
173193lib/libsavi_runtime : $(MAKE_VAR_CACHE ) /RUNTIME_BITCODE_RELEASE_URL
@@ -260,11 +280,11 @@ $(BUILD)/savi-spec.o: spec/all.cr $(LLVM_PATH) $(shell find src lib spec -name '
260280
261281# Build the Savi compiler executable, by linking the above targets together.
262282# This variant of the target compiles in release mode.
263- $(BUILD ) /savi-release : $(BUILD ) /savi-release.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc lib/libsavi_runtime
283+ $(BUILD ) /savi-release : $(BUILD ) /savi-release.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc lib/libsavi_runtime $( LIB_FSWATCH )
264284 mkdir -p ` dirname $@ `
265285 ${CLANG} -O3 -o $@ -flto=thin -fPIC \
266286 $(BUILD ) /savi-release.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc \
267- ${CRYSTAL_RT_LIBS} \
287+ ${CRYSTAL_RT_LIBS} $( LIB_FSWATCH ) \
268288 -target $(CLANG_TARGET_PLATFORM ) \
269289 ` sh -c ' ls $(LLVM_PATH)/lib/libclang*.a' ` \
270290 ` sh -c ' ls $(LLVM_PATH)/lib/liblld*.a' ` \
@@ -273,11 +293,11 @@ $(BUILD)/savi-release: $(BUILD)/savi-release.o $(BUILD)/llvm_ext.bc $(BUILD)/llv
273293
274294# Build the Savi compiler executable, by linking the above targets together.
275295# This variant of the target compiles in debug mode.
276- $(BUILD ) /savi-debug : $(BUILD ) /savi-debug.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc lib/libsavi_runtime
296+ $(BUILD ) /savi-debug : $(BUILD ) /savi-debug.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc lib/libsavi_runtime $( LIB_FSWATCH )
277297 mkdir -p ` dirname $@ `
278298 ${CLANG} -O0 -o $@ -flto=thin -fPIC \
279299 $(BUILD ) /savi-debug.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc \
280- ${CRYSTAL_RT_LIBS} \
300+ ${CRYSTAL_RT_LIBS} $( LIB_FSWATCH ) \
281301 -target $(CLANG_TARGET_PLATFORM ) \
282302 ` sh -c ' ls $(LLVM_PATH)/lib/libclang*.a' ` \
283303 ` sh -c ' ls $(LLVM_PATH)/lib/liblld*.a' ` \
@@ -287,11 +307,11 @@ $(BUILD)/savi-debug: $(BUILD)/savi-debug.o $(BUILD)/llvm_ext.bc $(BUILD)/llvm_ex
287307
288308# Build the Savi specs executable, by linking the above targets together.
289309# This variant of the target will be used when running tests.
290- $(BUILD ) /savi-spec : $(BUILD ) /savi-spec.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc lib/libsavi_runtime
310+ $(BUILD ) /savi-spec : $(BUILD ) /savi-spec.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc lib/libsavi_runtime $( LIB_FSWATCH )
291311 mkdir -p ` dirname $@ `
292312 ${CLANG} -O0 -o $@ -flto=thin -fPIC \
293313 $(BUILD ) /savi-spec.o $(BUILD ) /llvm_ext.bc $(BUILD ) /llvm_ext_for_savi.bc \
294- ${CRYSTAL_RT_LIBS} \
314+ ${CRYSTAL_RT_LIBS} $( LIB_FSWATCH ) \
295315 -target $(CLANG_TARGET_PLATFORM ) \
296316 ` sh -c ' ls $(LLVM_PATH)/lib/libclang*.a' ` \
297317 ` sh -c ' ls $(LLVM_PATH)/lib/liblld*.a' ` \
0 commit comments