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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-06-23 09:29:22 -07:00
parent 0faa2948b5
commit ce60297bda

View File

@ -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=\