Browse Source

Build: fix race condition in parallel make for ports framework

Splits the unversioned library symlink creation into an independent target
and enforces modules_all to explicitly depend on the compiled binary object
(LIB_SOLINK). This eliminates linker failures during concurrent -j builds.
master v0.1
Sergey Kiselev 3 months ago
parent
commit
4df42e1823
  1. 6
      Makefile

6
Makefile

@ -17,7 +17,7 @@ LDFLAGS+= -shared -lcam -Wl,-soname,$(LIB_NAME).$(SHLIB_MAJOR)
LIB_SRCS= src/libbsdiskinfo.c
CLI_SRCS= src/cli.c
TARGETS= $(LIB_SOLINK)
TARGETS= $(LIB_SOLINK) $(LIB_NAME)
.ifndef WITHOUT_CLI
TARGETS+= $(CLI_NAME)
@ -29,13 +29,15 @@ all: $(TARGETS) modules_all
$(LIB_SOLINK): $(LIB_SRCS)
$(CC) $(CFLAGS) $(LIB_SRCS) $(LDFLAGS) -o $(LIB_SOLINK)
ln -sf $(LIB_SOLINK) $(LIB_SONAME)
$(LIB_NAME): $(LIB_SOLINK)
ln -sf $(LIB_SOLINK) $(LIB_NAME)
$(CLI_NAME): $(CLI_SRCS) $(LIB_SOLINK)
$(CC) $(CFLAGS) $(CLI_SRCS) -L. -lbsdiskinfo -lcam -Wl,-rpath,. -o $(CLI_NAME)
# Conditional compilation path for sub-modules
modules_all: $(LIB_NAME)
modules_all: $(LIB_SOLINK) $(LIB_NAME)
.ifndef WITHOUT_LUA
@if [ -d modules/lua ]; then \
cd modules/lua && $(MAKE) LUA_VER=$(LUA_VER); \

Loading…
Cancel
Save