CC=g++
CHAKRALIB=ChakraCore/out/Test/lib/libChakraCoreStatic.a

CFLAGS=-lstdc++ -std=c++11 -IChakraCore/lib/Jsrt

UNAME__S := $(shell uname -s)
ifeq ($(UNAME__S),Linux)
ICU4C=ChakraCore/deps/thirdparty/icu/lib
ICULIB=$(ICU4C)/libicui18n.a $(ICU4C)/libicuuc.a $(ICU4C)/libicudata.a

sheetjs.ch: sheetjs.ch.cpp
	clang++ $< $(CFLAGS) $(CHAKRALIB) $(ICULIB) -lm -ldl -Wno-c++11-compat-deprecated-writable-strings -Wno-deprecated-declarations -Wno-unknown-warning-option -o $@

endif
ifeq ($(UNAME__S),Darwin)
ICU4C=/usr/local/opt/icu4c/lib
ICULIB=$(ICU4C)/libicudata.a $(ICU4C)/libicuuc.a $(ICU4C)/libicui18n.a

sheetjs.ch: sheetjs.ch.cpp
	g++ $< $(CFLAGS) -Wl,-force_load $(CHAKRALIB) $(ICULIB) -framework CoreFoundation -framework Security -lm -ldl -Wno-c++11-compat-deprecated-writable-strings -Wno-deprecated-declarations -Wno-unknown-warning-option -o $@

endif

.PHONY: clean
clean:
	rm sheetjs.ch
