Fix -j race on libsashidown.a; cst-agent-update keeps the install prefix

This commit is contained in:
WHC
2026-10-05 12:40:45 +08:00
parent ef63f6d612
commit c81df42f0b
2 changed files with 9 additions and 2 deletions
+8 -2
View File
@@ -103,7 +103,7 @@ TESTS = \
TEST_LIBS = -lm $(CURL_LIBS) $(PTHREAD_LIBS)
.PHONY: all clean check demo sashidown-lib cmake-gcc cmake-clang asan install uninstall
.PHONY: all clean check demo sashidown-lib FORCE cmake-gcc cmake-clang asan install uninstall
all: sashidown-lib cst-agent
@@ -116,9 +116,15 @@ cmake-clang:
cmake -B build-clang -DCMAKE_C_COMPILER=clang -DCST_BUILD_TUI=ON
cmake --build build-clang
sashidown-lib:
sashidown-lib: $(SD_DIR)/libsashidown.a
# The sub-make decides whether the archive is stale; FORCE only makes sure it
# is asked, and -j builds wait for it before linking.
$(SD_DIR)/libsashidown.a: FORCE
$(MAKE) -C $(SD_DIR) libsashidown.a
FORCE:
cst-agent: $(OBJ) $(SD_DIR)/libsashidown.a
$(CC) $(CFLAGS) -o $@ $(OBJ) $(LDFLAGS) $(LDLIBS)
+1
View File
@@ -99,6 +99,7 @@ main() {
run_make install PREFIX="$prefix" >/dev/null
cat >"$prefix/bin/cst-agent-update" <<EOF
#!$(command -v bash)
export CST_AGENT_PREFIX="\${CST_AGENT_PREFIX:-$prefix}"
exec bash "$dir/scripts/bootstrap_linux.sh" "$dir" "\$@"
EOF
chmod 0755 "$prefix/bin/cst-agent-update"