Preprocess arguments to rustc to workaround cargo
This commit is contained in:
parent
c885d11337
commit
dcd96e2b94
13
Makefile
13
Makefile
|
@ -336,19 +336,16 @@ initfs/bin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib
|
||||||
mkdir -p initfs/bin
|
mkdir -p initfs/bin
|
||||||
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
initfs/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
|
initfs/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
|
||||||
mkdir -p initfs/bin
|
mkdir -p initfs/bin
|
||||||
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
initfs/bin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib
|
initfs/bin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib
|
||||||
mkdir -p initfs/bin
|
mkdir -p initfs/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
$(BUILD)/initfs.rs: \
|
$(BUILD)/initfs.rs: \
|
||||||
initfs/bin/init \
|
initfs/bin/init \
|
||||||
|
@ -375,13 +372,11 @@ filesystem/sbin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/sbin
|
mkdir -p filesystem/sbin
|
||||||
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
|
filesystem/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/bin
|
mkdir -p filesystem/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/bin/sh: filesystem/bin/ion
|
filesystem/bin/sh: filesystem/bin/ion
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
@ -390,49 +385,41 @@ filesystem/bin/%: programs/binutils/Cargo.toml programs/binutils/src/bin/%.rs $(
|
||||||
mkdir -p filesystem/bin
|
mkdir -p filesystem/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/bin/%: programs/coreutils/Cargo.toml programs/coreutils/src/bin/%.rs $(BUILD)/libstd.rlib
|
filesystem/bin/%: programs/coreutils/Cargo.toml programs/coreutils/src/bin/%.rs $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/bin
|
mkdir -p filesystem/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/bin/%: programs/extrautils/Cargo.toml programs/extrautils/src/bin/%.rs $(BUILD)/libstd.rlib
|
filesystem/bin/%: programs/extrautils/Cargo.toml programs/extrautils/src/bin/%.rs $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/bin
|
mkdir -p filesystem/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/bin/%: programs/netutils/Cargo.toml programs/netutils/src/%/**.rs $(BUILD)/libstd.rlib
|
filesystem/bin/%: programs/netutils/Cargo.toml programs/netutils/src/%/**.rs $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/bin
|
mkdir -p filesystem/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/ui/bin/%: programs/orbutils/Cargo.toml programs/orbutils/src/%/**.rs $(BUILD)/libstd.rlib
|
filesystem/ui/bin/%: programs/orbutils/Cargo.toml programs/orbutils/src/%/**.rs $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/ui/bin
|
mkdir -p filesystem/ui/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/bin/%: programs/pkgutils/Cargo.toml programs/pkgutils/src/%/**.rs $(BUILD)/libstd.rlib
|
filesystem/bin/%: programs/pkgutils/Cargo.toml programs/pkgutils/src/%/**.rs $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/bin
|
mkdir -p filesystem/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/bin/%: programs/userutils/Cargo.toml programs/userutils/src/bin/%.rs $(BUILD)/libstd.rlib
|
filesystem/bin/%: programs/userutils/Cargo.toml programs/userutils/src/bin/%.rs $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/bin
|
mkdir -p filesystem/bin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
filesystem/sbin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib
|
filesystem/sbin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib
|
||||||
mkdir -p filesystem/sbin
|
mkdir -p filesystem/sbin
|
||||||
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
$(CARGO) rustc --manifest-path $< --bin $* $(CARGOFLAGS) -o $@
|
||||||
strip $@
|
strip $@
|
||||||
rm $@.d
|
|
||||||
|
|
||||||
drivers: \
|
drivers: \
|
||||||
filesystem/sbin/pcid \
|
filesystem/sbin/pcid \
|
||||||
|
|
21
krustc.sh
21
krustc.sh
|
@ -1,2 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
RUST_BACKTRACE=1 rustc -L build/kernel $*
|
have_o=false
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [[ "$arg" = "-o" ]]; then
|
||||||
|
have_o=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
args=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [[ $have_o = true && "$arg" =~ ^extra-filename= ]]; then
|
||||||
|
unset args[${#args[@]}-1]
|
||||||
|
elif [[ $have_o = true && "$arg" =~ ^--emit= ]]; then
|
||||||
|
args+=("--emit=link")
|
||||||
|
else
|
||||||
|
args+=("$arg")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
RUST_BACKTRACE=1 exec rustc -L build/kernel "${args[@]}"
|
||||||
|
|
21
rustc.sh
21
rustc.sh
|
@ -1,2 +1,21 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
RUST_BACKTRACE=1 rustc -L build/userspace $*
|
have_o=false
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [[ "$arg" = "-o" ]]; then
|
||||||
|
have_o=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
args=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [[ $have_o = true && "$arg" =~ ^extra-filename= ]]; then
|
||||||
|
unset args[${#args[@]}-1]
|
||||||
|
elif [[ $have_o = true && "$arg" =~ ^--emit= ]]; then
|
||||||
|
args+=("--emit=link")
|
||||||
|
else
|
||||||
|
args+=("$arg")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
RUST_BACKTRACE=1 exec rustc -L build/userspace "${args[@]}"
|
||||||
|
|
Loading…
Reference in a new issue