BUILD_DIR := ./build LICENSE := $(BUILD_DIR)/LICENSE.txt DATE := $(BUILD_DIR)/date.txt VERSION_FILE := $(BUILD_DIR)/version.txt ARTIFACTS_DIR := $(BUILD_DIR)/artifacts VERSION := $(shell git describe --dirty --always) TARGET_NAME := soundbox-$(VERSION) VERSIONED_DOC := $(ARTIFACTS_DIR)/$(TARGET_NAME)-documentation.pdf TARGET_DIR := $(ARTIFACTS_DIR)/$(TARGET_NAME) ARCHIVE := $(ARTIFACTS_DIR)/$(TARGET_NAME).tar.zst all: $(ARCHIVE) $(VERSIONED_DOC) $(LICENSE): cp LICENSE.txt $@ .PHONY: $(DATE) $(DATE): git show -s --format=%cs > $@ .PHONY: $(VERSION_FILE) $(VERSION_FILE): echo '$(VERSION)' > $@ $(ARCHIVE): $(TARGET_DIR) tar --zstd -cf $@ -C $(ARTIFACTS_DIR) $(TARGET_NAME) $(VERSIONED_DOC): doc install -Dm 644 $(BUILD_DIR)/doc/documentation.pdf $@ $(TARGET_DIR): debug rm -rf $@ mkdir -p $@ install -Dm 644 $(BUILD_DIR)/doc/documentation.pdf $@ install -Dm 644 $(BUILD_DIR)/mech/assembly.gcode $@ install -Dm 644 $(BUILD_DIR)/mech/assembly.stl $@ install -Dm 644 $(BUILD_DIR)/mech/production.gcode $@ install -Dm 644 $(BUILD_DIR)/mech/production.stl $@ install -Dm 644 $(BUILD_DIR)/mech/pcb_case/tolerance_tests.gcode $@ install -Dm 644 $(BUILD_DIR)/mech/pcb_case/tolerance_tests.stl $@ debug: doc mech .PHONY: clean clean: rm -rf $(BUILD_DIR) include doc/doc.mk include mech/mech.mk