github.com/anchore/syft@v1.38.2/syft/file/cataloger/executable/test-fixtures/elf/Makefile (about) 1 BIN=./bin 2 TOOL_IMAGE=localhost/syft-bin-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 verify 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 # for selfrando... 22 # docker buildx build --platform linux/amd64 -t $(TOOL_IMAGE) . 23 24 tools: 25 @(docker inspect $(TOOL_IMAGE) > /dev/null && make tools-check) || (docker build -t $(TOOL_IMAGE) . && sha256sum Dockerfile > Dockerfile.sha256) 26 27 build: tools 28 mkdir -p $(BIN) 29 docker run -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make 30 31 verify: tools 32 @rm -f $(VERIFY_FILE) 33 docker run -i -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) make verify > $(VERIFY_FILE) 34 @python ./differ expected_verify $(VERIFY_FILE) 35 36 debug: 37 docker run -i --rm -v $(shell pwd):/mount -w /mount/project $(TOOL_IMAGE) bash 38 39 # requirement 3: we always need to recalculate the fingerprint based on source regardless of any existing fingerprint 40 .PHONY: $(FINGERPRINT_FILE) 41 $(FINGERPRINT_FILE): 42 @find project Dockerfile Makefile -type f -exec sha256sum {} \; | sort -k2 > $(FINGERPRINT_FILE) 43 @#cat $(FINGERPRINT_FILE) | sha256sum | awk '{print $$1}' 44 45 # requirement 4: 'clean' goal to remove all generated test fixtures 46 clean: 47 rm -rf $(BIN) Dockerfile.sha256 $(VERIFY_FILE) $(FINGERPRINT_FILE) 48 49 .PHONY: tools tools-check build verify debug clean