-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
38 lines (31 loc) · 978 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef CRYSTAL_BIN
# CRYSTAL_BIN := $(shell which crystal)
#endif
CRYSTAL_BIN := $(shell which crystal)
VERSION := $(shell cat VERSION)
OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH := $(shell uname -m)
ifeq ($(OS),linux)
CRFLAGS := --link-flags "-static -L/opt/crystal/embedded/lib"
endif
ifeq ($(OS),darwin)
CRFLAGS := --link-flags "-L."
endif
# Builds an unoptimized binary.
all:
$(CRYSTAL_BIN) build -o bin/carbon src/command.cr
# Builds an optimized static binary ready for distribution.
#
# On OS X the binary is only partially static (it depends on the system's
# dylib), but libyaml should be bundled, unless the linker can find
# libyaml.dylib
release:
if [ "$(OS)" = "darwin" ] ; then \
cp /usr/local/lib/libyaml.a . ;\
chmod 644 libyaml.a ;\
export LIBRARY_PATH= ;\
fi
$(CRYSTAL_BIN) build --release -o bin/carbon src/command.cr $(CRFLAGS)
gzip -c bin/carbon > carbon-$(VERSION)_$(OS)_$(ARCH).gz
clean:
rm -rf .crystal bin/carbon