High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
use make’s dependency handling to speed-up rebuilds
Konrad Mohrfeldt89bfe74f5071
diff --git a/Makefile b/Makefileindex 36f140ab..12f52977 100644--- a/Makefile+++ b/Makefile@@ -3,6 +3,16 @@ VERSION := $(shell git describe --tags --abbrev=0)BUILDSTR := ${VERSION} (\#${LAST_COMMIT} $(shell date -u +"%Y-%m-%dT%H:%M:%S%z"))YARN ?= yarn+GOPATH ?= $(HOME)/go+STUFFBIN ?= $(GOPATH)/bin/stuffbin+FRONTEND_YARN_MODULES = frontend/node_modules+FRONTEND_DIST = frontend/dist+FRONTEND_DEPS = \+ $(FRONTEND_YARN_MODULES) \+ frontend/package.json \+ frontend/vue.config.js \+ frontend/babel.config.js \+ $(shell find frontend/fontello frontend/public frontend/src -type f)BIN := listmonkSTATIC := config.toml.sample \@@ -13,26 +23,32 @@ STATIC := config.toml.sample \frontend/dist/frontend:/frontend \i18n:/i18n-# Install dependencies for building.-.PHONY: deps-deps:+.PHONY: build+build: $(BIN)++$(STUFFBIN):go get -u github.com/knadh/stuffbin/...++$(FRONTEND_YARN_MODULES): frontend/package.json frontend/yarn.lockcd frontend && $(YARN) install+ touch --no-create $(FRONTEND_YARN_MODULES)# Build the backend to ./listmonk.-.PHONY: build-build:+$(BIN): $(shell find cmd -type f -name "*.go")CGO_ENABLED=0 go build -o ${BIN} -ldflags="-s -w -X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}'" cmd/*.go# Run the backend..PHONY: run-run: build+run: $(BIN)./${BIN}# Build the JS frontend into frontend/dist.-.PHONY: build-frontend-build-frontend:+$(FRONTEND_DIST): $(FRONTEND_DEPS)export VUE_APP_VERSION="${VERSION}" && cd frontend && $(YARN) build+ touch --no-create $(FRONTEND_DIST)++.PHONY: build-frontend+build-frontend: $(FRONTEND_DIST)# Run the JS frontend server in dev mode..PHONY: run-frontend@@ -47,14 +63,14 @@ test:# Bundle all static assets including the JS frontend into the ./listmonk binary# using stuffbin (installed with make deps)..PHONY: dist-dist: build build-frontend- stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}+dist: $(STUFFBIN) build build-frontend+ $(STUFFBIN) -a stuff -in ${BIN} -out ${BIN} ${STATIC}# pack-releases runns stuffbin packing on the given binary. This is used# in the .goreleaser post-build hook..PHONY: pack-bin-pack-bin:- stuffbin -a stuff -in ${BIN} -out ${BIN} ${STATIC}+pack-bin: $(STUFFBIN)+ $(STUFFBIN) -a stuff -in ${BIN} -out ${BIN} ${STATIC}# Use goreleaser to do a dry run producing local builds..PHONY: release-dry