Skip to content

Commit

Permalink
Merge pull request #479 from crystal-ameba/makefile-massage
Browse files Browse the repository at this point in the history
Give the `Makefile` a subtle massage
  • Loading branch information
Sija authored Oct 11, 2024
2 parents 73bf2d2 + a7675f5 commit 3d4d84e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ all:

## 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
DESTDIR ?= ## Install destination dir
PREFIX ?= /usr/local ## Install path prefix
BINDIR ?= $(DESTDIR)$(PREFIX)/bin

# The crystal command to use
Expand All @@ -29,7 +31,6 @@ SHARD_BIN ?= ../../bin
CRFLAGS ?= -Dpreview_mt

SRC_SOURCES := $(shell find src -name '*.cr' 2>/dev/null)
DOC_SOURCE := src/cli.cr

.PHONY: all
all: build
Expand All @@ -43,10 +44,10 @@ $(BUILD_TARGET): $(SRC_SOURCES)

docs: ## Generate API docs
docs: $(SRC_SOURCES)
$(CRYSTAL_BIN) docs -o docs $(DOC_SOURCE)
$(CRYSTAL_BIN) docs

.PHONY: lint
lint: ## Run ameba on ameba's code base
lint: ## Run ameba on its own code base
lint: $(BUILD_TARGET)
$(BUILD_TARGET)

Expand All @@ -56,9 +57,10 @@ spec:
$(CRYSTAL_BIN) spec

.PHONY: clean
clean: ## Remove application binary
clean: ## Remove application binary and API docs
clean:
@rm -f "$(BUILD_TARGET)" "$(BUILD_TARGET).dwarf"
@rm -rf docs

.PHONY: install
install: ## Install application binary into $DESTDIR
Expand All @@ -68,15 +70,14 @@ install: $(BUILD_TARGET)
.PHONY: bin
bin: build
mkdir -p $(SHARD_BIN)
cp $(BUILD_TARGET) $(SHARD_BIN)
cp "$(BUILD_TARGET)" $(SHARD_BIN)

.PHONY: test
test: ## Run the spec suite and linter
test: spec lint

.PHONY: help
help: ## Show this help
@echo
@printf '\033[34mtargets:\033[0m\n'
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) |\
sort |\
Expand Down

0 comments on commit 3d4d84e

Please sign in to comment.