Skip to content

Commit

Permalink
Add convenient makefile arguments for packaging (#414)
Browse files Browse the repository at this point in the history
* Allow make all FLAGS="--no-debug --release" 

When packaging shards is usually compiled with --no-debug and --release. This change will allow using the makefile in those scripts.

Otherwise we need to manually use the crystal build or CRYSTAL_OPTS env var

* Add release debug static makefile arguments

Same as the ones found in crystal-lang/crystal
  • Loading branch information
Brian J. Cardiff committed Jun 25, 2020
1 parent 3b7d490 commit ee6d18f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
.POSIX:

release ?= ## Compile in release mode
debug ?= ## Add symbolic debug info
static ?= ## Enable static linking

CRYSTAL ?= crystal
SHARDS ?= shards
override FLAGS += $(if $(release),--release )$(if $(debug),-d )$(if $(static),--static )

SHARDS_SOURCES = $(shell find src -name '*.cr')
MOLINILLO_SOURCES = $(shell find lib/molinillo -name '*.cr' 2> /dev/null)
SOURCES = $(SHARDS_SOURCES) $(MOLINILLO_SOURCES)
Expand All @@ -23,7 +29,7 @@ clean: phony

bin/shards: $(SOURCES) $(TEMPLATES) lib
@mkdir -p bin
$(CRYSTAL) build src/shards.cr -o bin/shards
$(CRYSTAL) build $(FLAGS) src/shards.cr -o bin/shards

install: bin/shards phony
$(INSTALL) -m 0755 -d "$(BINDIR)" "$(MANDIR)/man1" "$(MANDIR)/man5"
Expand Down

0 comments on commit ee6d18f

Please sign in to comment.