44
44
ZSTDFLAGS := -6
45
45
endif
46
46
47
+ # Source files used for make targets, evaluated on use.
48
+ GO_SRC_FILES = $(shell find . -not \( -path './.git/* ' -o -path './build/* ' -o -path './vendor/* ' -o -path './.coderv2/* ' -o -path './site/node_modules/* ' -o -path './site/out/* ' \) -type f -name '*.go')
49
+ # All the shell files in the repo, excluding ignored files.
50
+ SHELL_SRC_FILES = $(shell find . -not \( -path './.git/* ' -o -path './build/* ' -o -path './vendor/* ' -o -path './.coderv2/* ' -o -path './site/node_modules/* ' -o -path './site/out/* ' \) -type f -name '*.sh')
51
+
47
52
# All ${OS}_${ARCH} combos we build for. Windows binaries have the .exe suffix.
48
53
OS_ARCHES := \
49
54
linux_amd64 linux_arm64 linux_armv7 \
@@ -171,7 +176,7 @@ endef
171
176
# You should probably use the non-version targets above instead if you're
172
177
# calling this manually.
173
178
$(CODER_ALL_BINARIES ) : go.mod go.sum \
174
- $(shell find . -not -path './vendor/ * ' -type f -name ' * .go' ) \
179
+ $(GO_SRC_FILES ) \
175
180
$(shell find ./examples/templates)
176
181
177
182
$(get-mode-os-arch-ext)
@@ -333,7 +338,7 @@ build/coder_helm_$(VERSION).tgz:
333
338
--version " $( VERSION) " \
334
339
--output " $@ "
335
340
336
- site/out/index.html : $(shell find ./site -not -path './site/node_modules/* ' -type f -name '* .tsx') $( shell find ./site -not -path './site/node_modules/ * ' -type f - name '* .ts') site/package.json
341
+ site/out/index.html : site/package.json $(shell find ./site -not -path './site/node_modules/* ' -type f \( -name '* .ts' -o - name '* .tsx' \) )
337
342
./scripts/yarn_install.sh
338
343
cd site
339
344
yarn build
@@ -364,13 +369,13 @@ fmt/terraform: $(wildcard *.tf)
364
369
terraform fmt -recursive
365
370
.PHONY : fmt/terraform
366
371
367
- fmt/shfmt : $(shell shfmt -f . )
372
+ fmt/shfmt : $(SHELL_SRC_FILES )
368
373
echo " --- shfmt"
369
374
# Only do diff check in CI, errors on diff.
370
375
ifdef CI
371
- shfmt -d $(shell shfmt -f . )
376
+ shfmt -d $(SHELL_SRC_FILES )
372
377
else
373
- shfmt -w $(shell shfmt -f . )
378
+ shfmt -w $(SHELL_SRC_FILES )
374
379
endif
375
380
.PHONY : fmt/shfmt
376
381
@@ -383,9 +388,9 @@ lint/go:
383
388
.PHONY : lint/go
384
389
385
390
# Use shfmt to determine the shell files, takes editorconfig into consideration.
386
- lint/shellcheck : $(shell shfmt -f . )
391
+ lint/shellcheck : $(SHELL_SRC_FILES )
387
392
echo " --- shellcheck"
388
- shellcheck --external-sources $(shell shfmt -f . )
393
+ shellcheck --external-sources $(SHELL_SRC_FILES )
389
394
.PHONY : lint/shellcheck
390
395
391
396
# all gen targets should be added here and to gen/mark-fresh
@@ -446,8 +451,7 @@ site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find codersdk
446
451
update-golden-files : cli/testdata/.gen-golden
447
452
.PHONY : update-golden-files
448
453
449
- cli/testdata/.gen-golden : $(wildcard cli/testdata/* .golden) \
450
- $(shell find . -not -path './vendor/* ' -type f -name '* .go')
454
+ cli/testdata/.gen-golden : $(wildcard cli/testdata/* .golden) $(GO_SRC_FILES )
451
455
452
456
go test ./cli -run=TestCommandHelp -update
453
457
touch "$@"
0 commit comments