Commit ce60297b authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

build: move -lrt to a new SYS_LIBS variable



On some platforms, librt may be a static library, so linker command line
order matters.  Create a new Makefile variable, SYS_LIBS, which is added
to the end of all link commands and move -lrt there.

Change-Id: Ie28ebd91a255097bf33cbcf9f0f74f7177a0b142
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 0faa2948
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -105,7 +105,9 @@ LDFLAGS += -fsanitize=address
endif

COMMON_CFLAGS += -pthread
LDFLAGS += -pthread -lrt
LDFLAGS += -pthread

SYS_LIBS += -lrt

MAKEFLAGS += --no-print-directory

@@ -127,11 +129,11 @@ COMPILE_CXX=\
# Link $(OBJS) and $(LIBS) into $@ (app)
LINK_C=\
	$(Q)echo "  LINK $S/$@"; \
	$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)
	$(CC) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(SYS_LIBS)

LINK_CXX=\
	$(Q)echo "  LINK $S/$@"; \
	$(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)
	$(CXX) -o $@ $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $(SYS_LIBS)

# Archive $(OBJS) into $@ (.a)
LIB_C=\