chiark / gitweb /
Fix bundle sources
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 22:10:16 +0000 (23:10 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 22:10:16 +0000 (23:10 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Makefile
src/bin/daemon-otter.rs

index 9418812485359a142a46aec10629d5d3c9ead68b..aaddbfc368a793effea6281a17d52f4c7287560d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -43,8 +43,9 @@ CARGO = $(NAILING_CARGO)
 BUILD_SUBDIR ?= ../Build
 TARGET_DIR = $(BUILD_SUBDIR)/$(notdir $(PWD))/target
 
+NAILING_CARGO_JUST_RUN ?= $(NAILING_CARGO) --just-run -q ---
 BUNDLE_SOURCES_CMD ?= $(NAILING_CARGO) --- $(BUNDLE_SOURCES)
-USVG_CMD ?= $(NAILING_CARGO) --just-run -q --- $(USVG)
+USVG_CMD ?= $(NAILING_CARGO_JUST_RUN) $(USVG)
 WASM_PACK_CMD ?= $(NAILING_CARGO) --linkfarm=git --- $(WASM_PACK)
 
 endif # Cargo.nail
@@ -64,6 +65,7 @@ $(shell echo >&2 'Makefile: lp: Using program $4 from $(BUILD_SUBDIR)/$2')
 $1 := $(abspath $(BUILD_SUBDIR)/$2/target/$3/$4)
 $(abspath $(BUILD_SUBDIR)/$2/target/$3/$4):; cd ../$2 && $$(CARGO) build $(call cr,$3)
 )
+bundled-sources:: bundled-sources/$2
 endef
 
 $(eval $(call lp,BUNDLE_SOURCES,bundle-sources,debug,bundle-rust-sources))
@@ -144,11 +146,18 @@ stamp/wasm-pack: stamp/cargo.wasm-release
 
 #---------- bundle-sources ----------
 
-bundled-sources: $(TARGET_DIR)/bundled-sources
-$(TARGET_DIR)/bundled-sources: $(BUNDLE_SOURCES)
-       $(BUNDLE_SOURCES_CMD) --output $(abspath $@)
+bundled-sources:: bundled-sources/otter
+
+bundled-sources/%: $(BUNDLE_SOURCES)
+       set -e; d=$(abspath $(TARGET_DIR)/bundled-sources); \
+       $(NAILING_CARGO_JUST_RUN) mkdir -p $$d; \
+       $(if $(filter-out otter,$*), cd ../$*;) \
+       $(BUNDLE_SOURCES_CMD) --output $$d/$*
+
+.PHONY: bundled-sources/%
+
+bundled-sources::
        @echo Bundled sources.
-.PHONY: bundle-sources $(TARGET_DIR)/bundled-sources
 
 #---------- svg processing ----------
 
index 6d3c91ab16dd0d91dc11b5f96f6e2b28030f35aa..3df9167ee07459373fb0965e74d5b74ff63568bc 100644 (file)
@@ -112,9 +112,9 @@ fn main() {
   flexi_logger::Logger::with(c.log.clone()).start()?;
 
   let bundled_sources = &c.bundled_sources;
-  fs::metadata(format!("{}/index.html", bundled_sources))
+  fs::metadata(format!("{}/", bundled_sources))
     .with_context(||bundled_sources.clone())
-    .context("check bundled-sources directory's index.html")?;
+    .context("check bundled-sources directory")?;
 
   shapelib::load()?;