Просмотр исходного кода

Use Cargo workspaces to keep builds under same target directory.

Speedup and saving storage.
parazyd 4 лет назад
Родитель
Сommit
c1ac5bfb5f
2 измененных файлов с 20 добавлено и 6 удалено
  1. 11 0
      Cargo.toml
  2. 9 6
      Makefile

+ 11 - 0
Cargo.toml

@@ -11,7 +11,18 @@ edition = "2021"
 [lib]
 [lib]
 name = "darkfi"
 name = "darkfi"
 
 
+[workspace]
+members = [
+    "bin/cashierd",
+    "bin/darkfid",
+    "bin/drk",
+    "bin/gatewayd",
+    "bin/ircd",
+    #"bin/map",
+]
+
 [dependencies]
 [dependencies]
+# Hard dependencies
 log = "0.4.14"
 log = "0.4.14"
 thiserror = "1.0.30"
 thiserror = "1.0.30"
 
 

+ 9 - 6
Makefile

@@ -12,6 +12,8 @@ BINS = drk darkfid gatewayd
 # Common dependencies which should force the binaries to be rebuilt
 # Common dependencies which should force the binaries to be rebuilt
 BINDEPS = \
 BINDEPS = \
 	Cargo.toml \
 	Cargo.toml \
+	$(shell find bin/*/src -type f) \
+	$(shell find bin -type f -name Cargo.toml) \
 	$(shell find src -type f) \
 	$(shell find src -type f) \
 	$(shell find sql -type f) \
 	$(shell find sql -type f) \
 	$(shell find contrib/token -type f)
 	$(shell find contrib/token -type f)
@@ -19,20 +21,21 @@ BINDEPS = \
 all: $(BINS)
 all: $(BINS)
 
 
 $(BINS): $(BINDEPS)
 $(BINS): $(BINDEPS)
-	$(MAKE) -C bin/$@
-	cp -f bin/$@/$@ $@
+	$(CARGO) build --all-features --release --package $@
+	cp -f target/release/$@ $@
 
 
 check:
 check:
-	$(CARGO) hack check --release --feature-powerset --no-dev-deps
+	$(CARGO) hack check --release --feature-powerset --all
 
 
 fix:
 fix:
-	$(CARGO) clippy --release --all-features --fix --allow-dirty
+	$(CARGO) clippy --release --all-features --fix --allow-dirty --all
 
 
 clippy:
 clippy:
-	$(CARGO) clippy --release --all-features
+	$(CARGO) clippy --release --all-features --all
 
 
 test:
 test:
-	$(CARGO) test --release --all-features
+	$(CARGO) test --release --all-features --all
+	$(CARGO) run --release --features=node --example tx
 
 
 clean:
 clean:
 	rm -f $(BINS)
 	rm -f $(BINS)