github.com/anchore/syft@v1.38.2/syft/file/cataloger/executable/test-fixtures/shared-info/Makefile (about) 1 BIN=./bin 2 TOOL_IMAGE=localhost/syft-shared-info-build-tools:latest 3 VERIFY_FILE=actual_verify 4 FINGERPRINT_FILE=$(BIN).fingerprint 5 6 ifndef BIN 7 $(error BIN is not set) 8 endif 9 10 .DEFAULT_GOAL := fixtures 11 12 # requirement 1: 'fixtures' goal to generate any and all test fixtures 13 fixtures: build 14 15 # requirement 2: 'fingerprint' goal to determine if the fixture input that indicates any existing cache should be busted 16 fingerprint: $(FINGERPRINT_FILE) 17 18 tools-check: 19 @sha256sum -c Dockerfile.sha256 || (echo "Tools Dockerfile has changed" && exit 1) 20 21 tools: 22 @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) 23 24 build: tools 25 @mkdir -p $(BIN) 26 docker run --platform linux/amd64 -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make 27 28 debug: 29 docker run --platform linux/amd64 -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash 30 31 # requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint 32 .PHONY: $(FINGERPRINT_FILE) 33 $(FINGERPRINT_FILE): 34 @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) 35 @#cat $(FINGERPRINT_FILE) | sha256sum | awk '{print $$1}' 36 37 # requirement 4: 'clean' goal to remove all generated test fixtures 38 clean: 39 rm -rf $(BIN) Dockerfile.sha256 $(VERIFY_FILE) $(FINGERPRINT_FILE) 40 41 .PHONY: tools tools-check build debug clean