os-helpers/Makefile
2025-09-03 11:54:24 -04:00

31 lines
545 B
Makefile

ROOT := $(shell pwd)
BIN_DIR := $(ROOT)/build/cmd
CMDS := $(notdir $(wildcard cmd/*))
BINS := $(addprefix $(BIN_DIR)/,$(CMDS))
INSTALL_DIR := $(HOME)/.local/bin
.PHONY: all clean install
# Default target: build all binaries
all: install
# Rule to build each binary
$(BIN_DIR)/%: cmd/%/*
@mkdir -p $(BIN_DIR)
go build -o $@ ./cmd/$*
install: $(BINS)
@mkdir -p $(INSTALL_DIR)
@for bin in $(BINS); do \
cp $$bin $(INSTALL_DIR)/; \
echo "Installed $$bin to $(INSTALL_DIR)"; \
done
# Clean build artifacts
clean:
rm -rf $(BIN_DIR)