Update makefile to build everything
This commit is contained in:
parent
6074569076
commit
ce816628f5
2
.gitignore
vendored
2
.gitignore
vendored
@ -19,4 +19,4 @@ Cargo.lock
|
||||
#Cargo.lock
|
||||
|
||||
# Built packages
|
||||
/tars
|
||||
/release
|
14
Cargo.toml
14
Cargo.toml
@ -89,11 +89,6 @@ assets = [
|
||||
"/usr/local/bin/protomask-clat",
|
||||
"755",
|
||||
],
|
||||
[
|
||||
"target/release/protomask-6over4",
|
||||
"/usr/local/bin/protomask-6over4",
|
||||
"755",
|
||||
],
|
||||
[
|
||||
"config/protomask.json",
|
||||
"/etc/protomask/protomask.json",
|
||||
@ -117,3 +112,12 @@ systemd-units = [
|
||||
{ unit-name = "protomask-service", enable = false },
|
||||
{ unit-name = "protomask-clat-service", enable = false },
|
||||
]
|
||||
|
||||
[package.metadata.generate-rpm]
|
||||
assets = [
|
||||
{ source = "target/release/protomask", dest = "/usr/local/bin/protomask", mode = "755"},
|
||||
{ source = "target/release/protomask-clat", dest = "/usr/local/bin/protomask-clat", mode = "755"},
|
||||
{ source = "config/protomask.json", dest = "/etc/protomask/protomask.json", mode = "644"},
|
||||
{ source = "config/protomask-clat.json", dest = "/etc/protomask/protomask-clat.json", mode = "644"},
|
||||
{ source = "README.md", dest = "/usr/share/doc/protomask/README.md", mode = "644"},
|
||||
]
|
62
Makefile
62
Makefile
@ -1,19 +1,71 @@
|
||||
# All sources used to build the protomask binary
|
||||
SRC = Cargo.toml $(shell find src/ -type f -name '*.rs')
|
||||
CONFIGS = $(shell find config/ -type f -name '*.json')
|
||||
DEBIAN_SCRIPTS = $(shell find debian/ -type f)
|
||||
|
||||
# Used to auto-version things
|
||||
CRATE_VERSION = $(shell sed -n -r "s/^version = \"([0-9\.]+)\"/\1/p" Cargo.toml)
|
||||
|
||||
all: target/x86_64-unknown-linux-musl/release/protomask target/aarch64-unknown-linux-musl/release/protomask target/x86_64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_amd64.deb target/aarch64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_arm64.deb
|
||||
.PHONY: all release clean
|
||||
all: release
|
||||
|
||||
target/x86_64-unknown-linux-musl/release/protomask: $(SRC)
|
||||
cross build --target x86_64-unknown-linux-musl --release
|
||||
cross build --target x86_64-unknown-linux-musl --release --bin protomask
|
||||
|
||||
target/x86_64-unknown-linux-musl/release/protomask-clat: $(SRC)
|
||||
cross build --target x86_64-unknown-linux-musl --release --bin protomask-clat
|
||||
|
||||
target/aarch64-unknown-linux-musl/release/protomask: $(SRC)
|
||||
cross build --target aarch64-unknown-linux-musl --release
|
||||
|
||||
target/x86_64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_amd64.deb: target/x86_64-unknown-linux-musl/release/protomask
|
||||
target/x86_64-unknown-linux-musl/release/protomask-clat: $(SRC)
|
||||
cross build --target x86_64-unknown-linux-musl --release --bin protomask-clat
|
||||
|
||||
target/protomask.tar.gz: target/x86_64-unknown-linux-musl/release/protomask \
|
||||
target/x86_64-unknown-linux-musl/release/protomask-clat \
|
||||
target/aarch64-unknown-linux-musl/release/protomask \
|
||||
target/aarch64-unknown-linux-musl/release/protomask-clat \
|
||||
$(CONFIGS)
|
||||
mkdir -p target/protomask_tar_temp/{bin,config}
|
||||
mkdir -p target/protomask_tar_temp/bin/{x86_64,aarch64}
|
||||
cp target/x86_64-unknown-linux-musl/release/protomask target/protomask_tar_temp/bin/x86_64/protomask
|
||||
cp target/x86_64-unknown-linux-musl/release/protomask-clat target/protomask_tar_temp/bin/x86_64/protomask-clat
|
||||
cp target/aarch64-unknown-linux-musl/release/protomask target/protomask_tar_temp/bin/aarch64/protomask
|
||||
cp target/aarch64-unknown-linux-musl/release/protomask-clat target/protomask_tar_temp/bin/aarch64/protomask-clat
|
||||
cp config/*.json target/protomask_tar_temp/config/
|
||||
tar -czf target/protomask.tar.gz -C target/protomask_tar_temp .
|
||||
rm -rf target/protomask_tar_temp
|
||||
|
||||
target/x86_64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_amd64.deb: target/x86_64-unknown-linux-musl/release/protomask \
|
||||
target/x86_64-unknown-linux-musl/release/protomask-clat \
|
||||
$(CONFIGS) \
|
||||
$(DEBIAN_SCRIPTS)
|
||||
cargo deb --target x86_64-unknown-linux-musl --no-build
|
||||
|
||||
target/aarch64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_arm64.deb: target/aarch64-unknown-linux-musl/release/protomask
|
||||
cargo deb --target aarch64-unknown-linux-musl --no-build
|
||||
target/aarch64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_arm64.deb: target/aarch64-unknown-linux-musl/release/protomask \
|
||||
target/aarch64-unknown-linux-musl/release/protomask-clat \
|
||||
$(CONFIGS) \
|
||||
$(DEBIAN_SCRIPTS)
|
||||
cargo deb --target aarch64-unknown-linux-musl --no-build
|
||||
|
||||
target/x86_64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.x86_64.rpm: target/x86_64-unknown-linux-musl/release/protomask \
|
||||
target/x86_64-unknown-linux-musl/release/protomask-clat \
|
||||
$(CONFIGS)
|
||||
cargo generate-rpm --target x86_64-unknown-linux-musl
|
||||
|
||||
target/aarch64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.aarch64.rpm: target/aarch64-unknown-linux-musl/release/protomask \
|
||||
target/aarch64-unknown-linux-musl/release/protomask-clat \
|
||||
$(CONFIGS)
|
||||
cargo generate-rpm --target aarch64-unknown-linux-musl
|
||||
|
||||
release: target/protomask.tar.gz \
|
||||
target/x86_64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_amd64.deb \
|
||||
target/aarch64-unknown-linux-musl/debian/protomask_${CRATE_VERSION}_arm64.deb \
|
||||
target/x86_64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.x86_64.rpm \
|
||||
target/aarch64-unknown-linux-musl/generate-rpm/protomask-${CRATE_VERSION}-1.aarch64.rpm
|
||||
mkdir -p release
|
||||
cp $^ release/
|
||||
|
||||
clean:
|
||||
rm -rf release
|
||||
cargo clean
|
Loading…
x
Reference in New Issue
Block a user