2024-01-14 12:26:42 +00:00
|
|
|
.POSIX:
|
|
|
|
all:
|
|
|
|
|
|
|
|
# Recipes
|
|
|
|
|
|
|
|
## Build ameba
|
|
|
|
## $ make
|
|
|
|
## Run tests
|
|
|
|
## $ make test
|
|
|
|
## Install ameba
|
|
|
|
## $ sudo make install
|
|
|
|
|
|
|
|
-include Makefile.local # for optional local options
|
|
|
|
|
|
|
|
BUILD_TARGET ::= bin/ameba
|
|
|
|
|
|
|
|
DESTDIR ?= ## Install destination dir
|
|
|
|
PREFIX ?= /usr/local## Install path prefix
|
|
|
|
BINDIR ?= $(DESTDIR)$(PREFIX)/bin
|
|
|
|
|
|
|
|
# The crystal command to use
|
2021-04-04 18:16:41 +00:00
|
|
|
CRYSTAL_BIN ?= crystal
|
2024-01-14 12:26:42 +00:00
|
|
|
# The shards command to use
|
2021-04-04 18:16:41 +00:00
|
|
|
SHARDS_BIN ?= shards
|
2024-01-14 12:26:42 +00:00
|
|
|
# The install command to use
|
|
|
|
INSTALL_BIN ?= /usr/bin/install
|
|
|
|
|
2017-11-16 08:18:11 +00:00
|
|
|
SHARD_BIN ?= ../../bin
|
2022-05-03 18:35:24 +00:00
|
|
|
CRFLAGS ?= -Dpreview_mt
|
2017-11-01 15:21:41 +00:00
|
|
|
|
2024-01-14 12:26:42 +00:00
|
|
|
SRC_SOURCES ::= $(shell find src -name '*.cr' 2>/dev/null)
|
|
|
|
DOC_SOURCE ::= src/**
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: build
|
|
|
|
|
2023-01-02 18:06:33 +00:00
|
|
|
.PHONY: build
|
2024-01-14 12:26:42 +00:00
|
|
|
build: ## Build the application binary
|
|
|
|
build: $(BUILD_TARGET)
|
|
|
|
|
|
|
|
$(BUILD_TARGET): $(SRC_SOURCES)
|
2018-04-13 17:33:37 +00:00
|
|
|
$(SHARDS_BIN) build $(CRFLAGS)
|
2023-01-02 18:06:33 +00:00
|
|
|
|
2024-01-14 12:26:42 +00:00
|
|
|
docs: ## Generate API docs
|
|
|
|
docs: $(SRC_SOURCES)
|
|
|
|
$(CRYSTAL_BIN) docs -o docs $(DOC_SOURCE)
|
|
|
|
|
2023-01-02 18:06:33 +00:00
|
|
|
.PHONY: lint
|
2024-01-14 12:26:42 +00:00
|
|
|
lint: ## Run ameba on ameba's code base
|
|
|
|
lint: $(BUILD_TARGET)
|
|
|
|
$(BUILD_TARGET)
|
2023-01-02 18:06:33 +00:00
|
|
|
|
|
|
|
.PHONY: spec
|
2024-01-14 12:26:42 +00:00
|
|
|
spec: ## Run the spec suite
|
2023-01-02 18:06:33 +00:00
|
|
|
spec:
|
|
|
|
$(CRYSTAL_BIN) spec
|
|
|
|
|
|
|
|
.PHONY: clean
|
2024-01-14 12:26:42 +00:00
|
|
|
clean: ## Remove application binary
|
2017-11-01 15:21:41 +00:00
|
|
|
clean:
|
2024-01-14 12:26:42 +00:00
|
|
|
@rm -f "$(BUILD_TARGET)" "$(BUILD_TARGET).dwarf"
|
2023-01-02 18:06:33 +00:00
|
|
|
|
|
|
|
.PHONY: install
|
2024-01-14 12:26:42 +00:00
|
|
|
install: ## Install application binary into $DESTDIR
|
|
|
|
install: $(BUILD_TARGET)
|
|
|
|
$(INSTALL_BIN) -m 0755 "$(BUILD_TARGET)" "$(BINDIR)/ameba"
|
2023-01-02 18:06:33 +00:00
|
|
|
|
|
|
|
.PHONY: bin
|
2017-11-16 08:18:11 +00:00
|
|
|
bin: build
|
|
|
|
mkdir -p $(SHARD_BIN)
|
2024-01-14 12:26:42 +00:00
|
|
|
cp $(BUILD_TARGET) $(SHARD_BIN)
|
2023-01-02 18:06:33 +00:00
|
|
|
|
|
|
|
.PHONY: test
|
2024-01-14 12:26:42 +00:00
|
|
|
test: ## Run the spec suite and linter
|
2023-01-02 18:06:33 +00:00
|
|
|
test: spec lint
|
2024-01-14 12:26:42 +00:00
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
help: ## Show this help
|
|
|
|
@echo
|
|
|
|
@printf '\033[34mtargets:\033[0m\n'
|
|
|
|
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) |\
|
|
|
|
sort |\
|
|
|
|
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
|
|
|
|
@echo
|
|
|
|
@printf '\033[34moptional variables:\033[0m\n'
|
|
|
|
@grep -hE '^[a-zA-Z_-]+ \?=.*?## .*$$' $(MAKEFILE_LIST) |\
|
|
|
|
sort |\
|
|
|
|
awk 'BEGIN {FS = " \\?=.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
|
|
|
|
@echo
|
|
|
|
@printf '\033[34mrecipes:\033[0m\n'
|
|
|
|
@grep -hE '^##.*$$' $(MAKEFILE_LIST) |\
|
|
|
|
awk 'BEGIN {FS = "## "}; /^## [a-zA-Z_-]/ {printf " \033[36m%s\033[0m\n", $$2}; /^## / {printf " %s\n", $$2}'
|