Skip to content

Commit

Permalink
improve examples build
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2thomas committed Sep 27, 2022
1 parent 9b5dd61 commit 9e72b20
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.PHONY: test race cover robeaux examples test_with_coverage fmt_check
# include also examples in other than ./examples folder
ALL_EXAMPLES := $(shell grep -l -r --include "*.go" 'build example' ./)
# prevent examples with joystick (sdl2) and gocv (opencv) dependencies
EXAMPLES := $(shell grep -L 'joystick' $$(grep -L 'gocv' $(ALL_EXAMPLES)))

.PHONY: test race cover robeaux test_with_coverage fmt_check examples $(EXAMPLES)

# opencv platform currently skipped to prevent install of preconditions
including_except := $(shell go list ./... | grep -v platforms/opencv)
Expand Down Expand Up @@ -37,9 +42,7 @@ endif
rm -rf node_modules/ ; \
go fmt ./robeaux/robeaux.go ; \

EXAMPLES := $(shell ls examples/*.go | sed -e 's/examples\///')
examples: $(EXAMPLES)

examples:
for example in $(EXAMPLES) ; do \
go build -o /tmp/$$example examples/$$example ; \
done ; \
$(EXAMPLES):
go build -o /tmp/gobot_examples/$@ ./$@

0 comments on commit 9e72b20

Please sign in to comment.