-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (45 loc) · 1.61 KB
/
Makefile
File metadata and controls
53 lines (45 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
all: test fmt vet build
.PHONY: test
test:
go test -count=1 ./...
vet:
go vet ./...
fmt:
go list -f '{{.Dir}}' ./... | grep -v /vendor/ | xargs -L1 gofmt -l
test -z $$(go list -f '{{.Dir}}' ./... | grep -v /vendor/ | xargs -L1 gofmt -l)
lint:
go list ./... | grep -v /vendor/ | xargs -L1 revive -set_exit_status
# go list ./... | grep -v /vendor/ | xargs -L1 golint -set_exit_status
install-lint-revive:
go install github.com/mgechev/revive@latest
.PHONY: build
build:
go build -o bin/pathtracer ./cmd/pathtracer
.PHONY: build_scene
build_scene:
@if [ -z "$(SCENE_NAME)" ]; then \
echo "You need to set SCENE_NAME parameter with a scene name before calling make."; \
exit 2; \
else \
if [ -d "./cmd/scene/$(SCENE_NAME)" ]; then \
echo "Making target for scene $(SCENE_NAME)"; \
go build -o bin/$(SCENE_NAME) ./cmd/scene/$(SCENE_NAME); \
elif [ -d "./cmd/scene/test/$(SCENE_NAME)" ]; then \
echo "Making target for test scene $(SCENE_NAME)"; \
go build -o bin/$(SCENE_NAME) ./cmd/scene/test/$(SCENE_NAME); \
elif [ -d "./cmd/scene/test/object/$(SCENE_NAME)" ]; then \
echo "Making target for test scene object $(SCENE_NAME)"; \
go build -o bin/$(SCENE_NAME) ./cmd/scene/test/object/$(SCENE_NAME); \
else \
echo "Could not find any scene nor test scene directory for $(SCENE_NAME)"; \
exit 2; \
fi \
fi
.PHONY: build_scenes
build_scenes:
@find ./cmd/scene -name main.go -print0 | while IFS= read -r -d '' file; do \
dir=$$(dirname "$$file"); \
scene_name=$$(basename "$$dir"); \
echo "Building scene $$scene_name from $$dir"; \
go build -o bin/$$scene_name $$dir; \
done