chiark / gitweb /
fix Makefile for bundle-sources
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Sep 2020 22:54:06 +0000 (23:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Sep 2020 22:54:06 +0000 (23:54 +0100)
Makefile

index 37f819ad07e3e4b211f475ee854c4ff59c41f556..9502d19936540b2f238c6c7499a06e4852b0bd00 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,20 +5,37 @@
 
 SHELL=/bin/bash
 
+default: debug
+
 CARGO ?= cargo
 CARGO_TARGET_DIR ?= target
 
-ifneq (,../Cargo.nail)
+ifneq (,$(wildcard(../Cargo.nail)))
 CARGO = nailing-cargo
-CARGO_TARGET_DIR = ../Build/target
+CARGO_TARGET_DIR = ../Build/$(notdir $(PWD))/target
+BUNDLE_SOURCES_DIR = ../bundle-sources
+BUNDLE_SOURCES = ../Build/bundle-sources/target/debug/bundle-rust-sources
+
+ifneq (,$(wildcard $(BUNDLE_SOURCES_DIR)))
+$(BUNDLE_SOURCES):
+       cd ../bundle-sources && $(CARGO) build
+.PHONY: $(BUNDLE_SOURCES)
+endif
 endif
 
-default: debug
-
-debug release:: %: $(CARGO_TARGET_DIR)/%/server templates/script.js
+debug release:: %: $(CARGO_TARGET_DIR)/%/server templates/script.js extra-%
        @echo Built $@.
+.PHONY: $(CARGO_TARGET_DIR)/debug/server
+.PHONY: $(CARGO_TARGET_DIR)/release/server
+
+extra-debug:
+extra-release: bundled-sources
 
-.PHONY: $(CARGO_TARGET_DIR)/%/server
+bundled-sources: $(CARGO_TARGET_DIR)/bundled-sources
+$(CARGO_TARGET_DIR)/bundled-sources: $(BUNDLE_SOURCES)
+       nailing-cargo --- $(abspath $(BUNDLE_SOURCES)) --output $(abspath $@)
+       @echo Bundled sources.
+.PHONY: bundle-sources $(CARGO_TARGET_DIR)/bundled-sources
 
 $(CARGO_TARGET_DIR)/debug/server:
        $(CARGO) build