Improve dependencies on build tools

This commit is contained in:
Ron Williams 2023-03-06 12:41:45 -08:00
parent c3170d09f2
commit 374e37d5b9
5 changed files with 36 additions and 17 deletions

View file

@ -54,6 +54,9 @@ repo: $(BUILD)/repo.tag
# Podman build recipes and vars
include mk/podman.mk
# Disk Imaging and Cookbook tools
include mk/fstools.mk
# Cross compiler recipes
include mk/prefix.mk

View file

@ -63,6 +63,8 @@ INSTALLER+=--cookbook=cookbook
REPO_TAG=$(BUILD)/repo.tag
endif
FSTOOLS_TAG=build/fstools.tag
## Cross compiler variables
AR=$(TARGET)-gcc-ar
AS=$(TARGET)-as

View file

@ -1,4 +1,4 @@
$(BUILD)/harddrive.img: $(REPO_TAG)
$(BUILD)/harddrive.img: $(FSTOOLS_TAG) $(REPO_TAG)
mkdir -p $(BUILD)
rm -rf $@ $@.partial
-$(FUMOUNT) /tmp/redox_installer || true
@ -6,7 +6,7 @@ $(BUILD)/harddrive.img: $(REPO_TAG)
$(INSTALLER) -c $(FILESYSTEM_CONFIG) $@.partial
mv $@.partial $@
$(BUILD)/livedisk.iso: $(REPO_TAG)
$(BUILD)/livedisk.iso: $(FSTOOLS_TAG) $(REPO_TAG)
mkdir -p $(BUILD)
rm -rf $@ $@.partial
-$(FUMOUNT) /tmp/redox_installer || true
@ -14,9 +14,8 @@ $(BUILD)/livedisk.iso: $(REPO_TAG)
$(INSTALLER) -c $(FILESYSTEM_CONFIG) --live $@.partial
mv $@.partial $@
$(BUILD)/filesystem.img: $(REPO_TAG)
$(BUILD)/filesystem.img: $(FSTOOLS_TAG) $(REPO_TAG)
mkdir -p $(BUILD)
$(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release
-$(FUMOUNT) $(BUILD)/filesystem/ || true
rm -rf $@ $@.partial $(BUILD)/filesystem/
-$(FUMOUNT) /tmp/redox_installer || true
@ -32,16 +31,14 @@ $(BUILD)/filesystem.img: $(REPO_TAG)
rm -rf $(BUILD)/filesystem/
mv $@.partial $@
mount: FORCE
mount: $(FSTOOLS_TAG) FORCE
mkdir -p $(BUILD)/filesystem/
$(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs
redoxfs/target/release/redoxfs $(BUILD)/harddrive.img $(BUILD)/filesystem/
sleep 2
pgrep redoxfs
mount_extra: FORCE
mount_extra: $(FSTOOLS_TAG) FORCE
mkdir -p $(BUILD)/filesystem/
$(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs
redoxfs/target/release/redoxfs $(BUILD)/extra.img $(BUILD)/filesystem/
sleep 2
pgrep redoxfs

21
mk/fstools.mk Normal file
View file

@ -0,0 +1,21 @@
fstools: $(FSTOOLS_TAG)
$(FSTOOLS_TAG): cookbook installer redoxfs $(CONTAINER_TAG)
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) $(MAKE) $@
else
$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
$(HOST_CARGO) build --manifest-path redoxfs/Cargo.toml --release --bin redoxfs
touch $@
endif
fstools_clean: FORCE $(CONTAINER_TAG)
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) $(MAKE) $@
else
$(HOST_CARGO) clean --manifest-path cookbook/Cargo.toml
$(HOST_CARGO) clean --manifest-path installer/Cargo.toml
$(HOST_CARGO) clean --manifest-path redoxfs/Cargo.toml
rm -f $(FSTOOLS_TAG)
endif

View file

@ -1,9 +1,7 @@
$(BUILD)/fetch.tag: cookbook installer prefix $(FILESYSTEM_CONFIG) $(CONTAINER_TAG)
$(BUILD)/fetch.tag: prefix $(FSTOOLS_TAG) $(FILESYSTEM_CONFIG) $(CONTAINER_TAG)
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) $(MAKE) $@
else
$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
cd cookbook && \
./fetch.sh "$${PACKAGES}"
@ -11,12 +9,10 @@ else
touch $@
endif
$(BUILD)/repo.tag: $(BUILD)/fetch.tag $(CONTAINER_TAG)
$(BUILD)/repo.tag: $(BUILD)/fetch.tag $(FSTOOLS_TAG) $(CONTAINER_TAG)
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) $(MAKE) $@
else
$(HOST_CARGO) build --manifest-path cookbook/Cargo.toml --release
$(HOST_CARGO) build --manifest-path installer/Cargo.toml --release
export PATH="$(PREFIX_PATH):$$PATH" && \
PACKAGES="$$($(INSTALLER) --list-packages -c $(FILESYSTEM_CONFIG))" && \
cd cookbook && \
@ -28,7 +24,7 @@ else
endif
# Invoke clean.sh for a single target
c.%: FORCE
c.%: $(FSTOOLS_TAG) FORCE
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) $(MAKE) $@
else
@ -38,7 +34,7 @@ else
endif
# Invoke fetch.sh for a single target
f.%: FORCE
f.%: $(FSTOOLS_TAG) FORCE
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) $(MAKE) $@
else
@ -48,7 +44,7 @@ else
endif
# Invoke repo.sh for a single target
r.%: FORCE
r.%: $(FSTOOLS_TAG) FORCE
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) $(MAKE) $@
else