Skip to content

Commit

Permalink
Give explicit static lib to get objects
Browse files Browse the repository at this point in the history
This prevent include twice symbols. For example libfoo.a uses libbar.a
and libproject.a uses libfoo.a. Before libproject when calling _lib*/*.o
used objects from libfoo and libbar with duplicated symbols.
  • Loading branch information
Lecrapouille committed May 3, 2024
1 parent 8fadcc9 commit e763ff6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile.footer
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ endif
$(Q)$(CC) $(DEPFLAGS) $(CCFLAGS) $(PKGCFG_CFLAGS) $(OPTIM_FLAGS) $(DEFINES) $(INCLUDES) -c $(abspath $<) -o $(abspath $(BUILD)/$@) $(COMPIL_FLAGS)
@$(POSTCOMPILE)

OBJS_FROM_THIRDPART_LIBS = $(addsuffix /*.o,$(addprefix _,$(basename $(notdir $(filter-out \,$(THIRDPART_LIBS))))))

###################################################
# Static library
#
Expand All @@ -86,7 +88,7 @@ endif
@$(call print-to,"Static lib","$(TARGET)","$(BUILD)/$@","$(VERSION)")
ifneq ($(THIRDPART_LIBS),)
@./$(M)/alib.sh $(BUILD) $(THIRDPART_LIBS)
$(Q)cd $(BUILD) && $(AR) $(ARFLAGS) $@ $(LIB_OBJS) $(THIRDPART_OBJS) _lib*/*.o && ranlib $@
$(Q)cd $(BUILD) && $(AR) $(ARFLAGS) $@ $(LIB_OBJS) $(THIRDPART_OBJS) $(OBJS_FROM_THIRDPART_LIBS) && ranlib $@
else
$(Q)cd $(BUILD) && $(AR) $(ARFLAGS) $@ $(LIB_OBJS) $(THIRDPART_OBJS) && ranlib $@
endif
Expand Down

0 comments on commit e763ff6

Please sign in to comment.