Skip to content

Commit

Permalink
Don't hardwire path to $OUT in when linking against shared library.
Browse files Browse the repository at this point in the history
Use pattern magic to change $(OUT)/libmupdf.so into -L$(OUT) -lmupdf.
  • Loading branch information
ccxvii committed Nov 6, 2020
1 parent 8e1ae3a commit 7e6d92e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ TAGS_CMD = $(QUIET_TAGS) ctags -R --c-kinds=+p --exclude=platform/python --exclu
WINDRES_CMD = $(QUIET_WINDRES) $(MKTGTDIR) ; $(WINDRES) $< $@
OBJCOPY_CMD = $(QUIET_OBJCOPY) $(MKTGTDIR) ; $(LD) -r -b binary -z noexecstack -o $@ $<

ifeq ($(shared),yes)
LINK_CMD = $(QUIET_LINK) $(MKTGTDIR) ; $(CC) $(LDFLAGS) -o $@ \
$(filter-out %.$(SO),$^) \
$(sort $(patsubst %,-L%,$(dir $(filter %.$(SO),$^)))) \
$(patsubst lib%.$(SO),-l%,$(notdir $(filter %.$(SO),$^))) \
$(LIBS)
endif

# --- Rules ---

$(OUT)/%.a :
Expand Down

0 comments on commit 7e6d92e

Please sign in to comment.