mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-03 16:30:29 +00:00
Makefile: ensure linked output directory exists
Building in RAM is faster and reduces wear on storage devices. This can be achieved by symlinking the output directory to a tmpfs location: ln -s /tmp/cosmopolitan/o o ln -s $XDG_RUNTIME_DIR/cosmopolitan/o o In most Linux distributions, there is a tmpfs mounted at /tmp. Distributions using systemd also provide a tmpfs mounted at /run with private directories for every user at /run/user/$UID. The XDG_RUNTIME_DIR environment variable usually points to this directory. These file systems are ephemeral: the whole tree is lost when it is unmounted. This may cause build errors if the link points to a directory that no longer exists. It is therefore necessary to ensure its existence.
This commit is contained in:
parent
5e069a64d4
commit
c6807ca55b
1 changed files with 9 additions and 0 deletions
9
Makefile
9
Makefile
|
@ -70,6 +70,15 @@ GNUMAKEFLAGS += --output-sync
|
|||
.FEATURES: output-sync
|
||||
.PHONY: all o bins check test depend tags
|
||||
|
||||
# If the output directory is a symbolic link, make sure the target directory exists.
|
||||
# This makes it easy to build on tmpfs:
|
||||
#
|
||||
# ln -s /tmp/cosmopolitan/o o
|
||||
# ln -s $XDG_RUNTIME_DIR/cosmopolitan/o o
|
||||
#
|
||||
output_directory_link := $(shell readlink o)
|
||||
$(if $(output_directory_link),$(shell mkdir -p $(output_directory_link)))
|
||||
|
||||
all: o
|
||||
o: o/$(MODE)/ape \
|
||||
o/$(MODE)/dsp \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue