tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/Makefile (about)

     1  
     2  clean:
     3  	@rm -rf build
     4  
     5  FMT_PATHS = ./
     6  
     7  fmt-check:
     8  	@unformatted=$$(gofmt -l $(FMT_PATHS)); [ -z "$$unformatted" ] && exit 0; echo "Unformatted:"; for fn in $$unformatted; do echo "  $$fn"; done; exit 1
     9  
    10  XTENSA ?= 1
    11  smoke-test:
    12  	@mkdir -p build
    13  	@go run ./smoketest.go -xtensa=$(XTENSA) smoketest.sh
    14  
    15  
    16  # rwildcard is a recursive version of $(wildcard) 
    17  # https://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
    18  rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
    19  # Recursively find all *_test.go files from cwd & reduce to unique dir names
    20  HAS_TESTS = $(sort $(dir $(call rwildcard,,*_test.go)))
    21  # Exclude anything we explicitly don't want to test for whatever reason
    22  EXCLUDE_TESTS = image
    23  TESTS = $(filter-out $(addsuffix /%,$(EXCLUDE_TESTS)),$(HAS_TESTS))
    24  
    25  unit-test:
    26  	@go test -v $(addprefix ./,$(TESTS))
    27  
    28  test: clean fmt-check unit-test smoke-test