diff --git a/crystal/makefile b/crystal/makefile new file mode 100644 index 0000000..9862085 --- /dev/null +++ b/crystal/makefile @@ -0,0 +1,29 @@ +# The following shows how to use a library that is not installed. +# Usage example: make LIBPATH=/tmp/libipc/zig-out/lib/ build run + +LIBPATH ?= +LD_LIBRARY_PATH=LD_LIBRARY_PATH=$(LIBPATH) +CRYSTAL_LIBRARY_PATH=CRYSTAL_LIBRARY_PATH=$(LIBPATH) +CRYSTAL_BUILD_OPTIONS ?= +CRYSTAL_BUILD_OPTIONS += $(CRYSTAL_STATIC_BUILD) + +LIBIPC_RUNDIR ?= /tmp/libipc-run + +all: build +build: build-pongd build-pong +run: run-pongd + +include ../mk/makefile.utils + +build-pongd: + $(CRYSTAL_LIBRARY_PATH) shards build pongd $(CRYSTAL_BUILD_OPTIONS) + +run-pongd: + rm $(LIBIPC_RUNDIR)/pong 2>/dev/null || true + $(LD_LIBRARY_PATH) ./bin/pongd + +build-pong: + $(CRYSTAL_LIBRARY_PATH) shards build pong $(CRYSTAL_BUILD_OPTIONS) + +run-pong: + $(LD_LIBRARY_PATH) ./bin/pong diff --git a/mk/makefile.static-build b/mk/makefile.static-build index 85d696f..e9d7bf7 100644 --- a/mk/makefile.static-build +++ b/mk/makefile.static-build @@ -1,5 +1,6 @@ ifdef STATIC STATIC_BUILD ?= -static +CRYSTAL_STATIC_BUILD ?= --static endif # For interactive completion in the shell.