Skip to content

Commit

Permalink
Makefile: Tweaked linker command line
Browse files Browse the repository at this point in the history
This way shared library gets correctly linked with its dependencies
  • Loading branch information
monich committed Aug 30, 2019
1 parent 8ede3b6 commit a0632c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -73,8 +73,7 @@ INCLUDES = -I$(INCLUDE_DIR) -I$(GEN_DIR)
BASE_FLAGS = -fPIC $(CFLAGS)
FULL_CFLAGS = $(BASE_FLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
$(shell pkg-config --cflags $(PKGS))
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIB_SONAME) \
$(shell pkg-config --libs $(PKGS))
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname -Wl,$(LIB_SONAME)
DEBUG_FLAGS = -g
RELEASE_FLAGS =

Expand Down Expand Up @@ -104,6 +103,7 @@ RELEASE_OBJS = \
$(GEN_SRC:%.c=$(RELEASE_BUILD_DIR)/%.o) \
$(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
GEN_FILES = $(GEN_SRC:%=$(GEN_DIR)/%)
LIBS = $(shell pkg-config --libs $(PKGS))
.PRECIOUS: $(GEN_FILES)

#
Expand Down Expand Up @@ -171,10 +171,10 @@ $(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@

$(DEBUG_LIB): $(DEBUG_OBJS)
$(LD) $(DEBUG_LDFLAGS) $^ -o $@
$(LD) $(DEBUG_LDFLAGS) -o $@ $^ $(LIBS)

$(RELEASE_LIB): $(RELEASE_OBJS)
$(LD) $(RELEASE_LDFLAGS) $^ -o $@
$(LD) $(RELEASE_LDFLAGS) -o $@ $^ $(LIBS)
ifeq ($(KEEP_SYMBOLS),0)
strip $@
endif
Expand Down

0 comments on commit a0632c6

Please sign in to comment.