Factorize makefile
This commit is contained in:
parent
207b417c3d
commit
ff62ecae0c
2 changed files with 25 additions and 7 deletions
16
Makefile
16
Makefile
|
@ -1,13 +1,15 @@
|
||||||
|
|
||||||
|
BINARIES=hodler
|
||||||
|
hodler_FILES=$(wildcard src/*.cr src/**/*.cr)
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
build: bin/hodler
|
build: ## Build binaries
|
||||||
|
|
||||||
bin/hodler: $(wildcard src/*.cr)
|
clean: ## Clean binaries
|
||||||
shards build hodler
|
|
||||||
|
|
||||||
completion: bin/hodler
|
.PHONY: clean build all
|
||||||
$< --completion --development
|
|
||||||
|
## Add targets for crystal
|
||||||
|
include tasks/crystal.mk
|
||||||
|
|
||||||
clean:
|
|
||||||
rm bin/hodler
|
|
||||||
|
|
16
tasks/crystal.mk
Normal file
16
tasks/crystal.mk
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
define BINARY_template
|
||||||
|
ALL_FILES += $($(1)_FILES)
|
||||||
|
|
||||||
|
build: build-$(1)
|
||||||
|
build-$(1): bin/$(1)
|
||||||
|
|
||||||
|
bin/$(1): $($(1)_FILES)
|
||||||
|
shards build $(1)
|
||||||
|
|
||||||
|
clean: clean-$(1)
|
||||||
|
clean-$(1):
|
||||||
|
rm -f bin/$(1)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach binary,$(BINARIES),$(eval $(call BINARY_template,$(binary))))
|
Loading…
Reference in a new issue