~ianmjones/snippetexpander

c22e22cde6cb78f6030d1e9db4f97a195e316a68 — Ian M. Jones 3 months ago 00d37ce
Clean up usage of .PHONY in Makefiles
M Makefile => Makefile +14 -2
@@ 6,45 6,57 @@ tgz_src = $(foreach binary,$(binaries),-C $(dir $(realpath $(binary))) $(notdir 
tgz := snippetpixie.tgz
site_tgz := site.tgz

.PHONY: all
all: target_dirs

.PHONY: all target_dirs $(target_dirs) tgz test test-verbose clean clean-all tidy update-deps

.PHONY: target_dirs
target_dirs: $(target_dirs)

.PHONY: $(target_dirs)
$(target_dirs):
	$(MAKE) -C $@

.PHONY: tgz
tgz: $(tgz)

.PHONY: $(tgz)
$(tgz): $(binaries)
	tar -czf $@ $(tgz_src)

.PHONY: $(binaries)
$(binaries): all

.PHONY: site-tgz
site-tgz: $(site_tgz)

.PHONY: $(site_tgz)
$(site_tgz): site/build
	tar -C site/build -cvz . > $@

site/build:
	$(MAKE) -C site

.PHONY: test
test:
	$(make_target_dirs)

.PHONY: test-verbose
test-verbose:
	$(make_target_dirs)

.PHONY: clean
clean:
	rm -f $(tgz) $(site_tgz)
	$(make_target_dirs)

.PHONY: clean-all
clean-all:
	$(make_target_dirs)

.PHONY: tidy
tidy:
	$(make_target_dirs)

.PHONY: update-deps
update-deps:
	$(make_target_dirs)

M cmd/snippetpixie/Makefile => cmd/snippetpixie/Makefile +8 -2
@@ 3,28 3,34 @@ OBJ := snippetpixie
GO_SRC := $(shell find . -type f -name "*.go") $(shell find ../../pkg/ -type f -name "*.go" ) $(shell find ../../internal/ -type f -name "*.go" )
GO_MOD := go.mod $(wildcard ../../pkg/*/go.mod) $(wildcard ../../internal/*/go.mod)

.PHONY: all
all: $(OBJ)

.PHONY: all test test-verbose clean clean-all tidy update-deps

.PHONY: $(OBJ)
$(OBJ): $(GO_SRC) $(GO_MOD)
	gofmt -w $(GO_SRC)
	go build -o $@ -ldflags="-s -w" .

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:
	rm -f $(OBJ)

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

M cmd/snippetpixied/Makefile => cmd/snippetpixied/Makefile +9 -2
@@ 3,31 3,38 @@ OBJ := snippetpixied
GO_SRC := $(shell find . -type f -name "*.go") $(shell find ../../pkg/ -type f -name "*.go" ) $(shell find ../../internal/ -type f -name "*.go" )
GO_MOD := go.mod $(wildcard ../../pkg/*/go.mod) $(wildcard ../../internal/*/go.mod)

.PHONY: all
all: $(OBJ)

.PHONY: all test test-verbose clean clean-all tidy update-deps run

.PHONY: $(OBJ)
$(OBJ): $(GO_SRC) $(GO_MOD)
	gofmt -w $(GO_SRC)
	go build -o $@ -ldflags="-s -w" .

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:
	rm -f $(OBJ)

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

.PHONY: run
run: $(OBJ)
	./$(OBJ)

M cmd/snippetpixiegui/Makefile => cmd/snippetpixiegui/Makefile +9 -2
@@ 10,36 10,43 @@ JSON_SRC := $(wildcard frontend/*.json) $(shell find frontend/src/ -type f -name
TS_SRC := $(wildcard frontend/*.ts) $(shell find frontend/src/ -type f -name "*.ts")
SVELTE_SRC := $(wildcard frontend/*.svelte) $(shell find frontend/src/ -type f -name "*.svelte")

.PHONY: all
all: $(OBJ)

.PHONY: all test test-verbose clean clean-all tidy update-deps run

.PHONY: $(OBJ)
$(OBJ): $(GO_SRC) $(GO_MOD) $(CSS_SRC) $(JS_SRC) $(JSON_SRC) $(TS_SRC) $(SVELTE_SRC)
	gofmt -w $(GO_SRC)
	wails generate module
	wails build

.PHONY: test
test:
	go test -tags test,dev

.PHONY: test-verbose
test-verbose:
	go test -tags test,dev -v

.PHONY: clean
clean:
	rm -f $(OBJ)

.PHONY: clean-all
clean-all: clean
	rm -rf build/bin
	rm -rf frontend/node_modules
	rm -rf frontend/wailsjs

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u
	cd frontend && npm update --save

.PHONY: run
run: $(OBJ)
	./$(OBJ)

M cmd/snippetpixiex/Makefile => cmd/snippetpixiex/Makefile +9 -2
@@ 3,25 3,32 @@ OBJ := snippetpixiex
VALA_SRC := $(shell find . -type f -name "*.vala")
VALA_ARGS := --pkg x11 --pkg ibus-1.0 --pkg gtk+-3.0 --pkg gobject-2.0 --pkg glib-2.0 --pkg gee-0.8 --pkg gdk-x11-3.0 --pkg atspi-2

.PHONY: all
all: $(OBJ)

.PHONY: all test test-verbose clean clean-all tidy update-deps run

.PHONY: $(OBJ)
$(OBJ): $(VALA_SRC)
	valac $(VALA_SRC) -o $@ $(VALA_ARGS)

.PHONY: test
test:

.PHONY: test-verbose
test-verbose:

.PHONY: clean
clean:
	rm -f $(OBJ)

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:

.PHONY: update-deps
update-deps:

.PHONY: run
run: $(OBJ)
	./$(OBJ)

M internal/export/Makefile => internal/export/Makefile +7 -2
@@ 1,20 1,25 @@
.PHONY: all
all:

.PHONY: all test test-verbose clean clean-all tidy update-deps

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

M internal/manager/Makefile => internal/manager/Makefile +7 -2
@@ 1,20 1,25 @@
.PHONY: all
all:

.PHONY: all test test-verbose clean clean-all tidy update-deps

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

M internal/paste/Makefile => internal/paste/Makefile +7 -2
@@ 1,20 1,25 @@
.PHONY: all
all:

.PHONY: all test test-verbose clean clean-all tidy update-deps

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

M internal/service/Makefile => internal/service/Makefile +7 -2
@@ 1,20 1,25 @@
.PHONY: all
all:

.PHONY: all test test-verbose clean clean-all tidy update-deps

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

M pkg/dbusservice/Makefile => pkg/dbusservice/Makefile +7 -2
@@ 1,20 1,25 @@
.PHONY: all
all:

.PHONY: all test test-verbose clean clean-all tidy update-deps

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

M pkg/snippet/Makefile => pkg/snippet/Makefile +7 -2
@@ 1,20 1,25 @@
.PHONY: all
all:

.PHONY: all test test-verbose clean clean-all tidy update-deps

.PHONY: test
test:
	go test

.PHONY: test-verbose
test-verbose:
	go test -v

.PHONY: clean
clean:

.PHONY: clean-all
clean-all: clean

.PHONY: tidy
tidy:
	go get
	go mod tidy

.PHONY: update-deps
update-deps:
	go get -t -u

M site/Makefile => site/Makefile +6 -2
@@ 2,26 2,30 @@ SRC := $(wildcard src/*.*) $(wildcard src/*/*.*)
STATIC := $(wildcard static/*.*) $(wildcard static/*/*.*)
CONFIG := $(wildcard *.json) $(wildcard *.config.js)

.PHONY: all
all: build

.PHONY: all test test-verbose clean clean-all tidy update-deps run

build: $(SRC) $(STATIC) node_modules
	npm run build

node_modules: $(CONFIG)
	npm install

.PHONY: clean
clean:
	rm -rf build

.PHONY: clean-all
clean-all: clean
	rm -rf node_modules .svelte-kit

.PHONY: tidy
tidy:

.PHONY: update-deps
update-deps:
	npm update --save

.PHONY: run
run: node_modules
	npm run dev