Skip to content
Browse files

Makefile: set proper link order for libraries

'-Wl,--as-needed' enforces libraries to go in proper dependency order:

    $ x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--hash-style=gnu `pkg-config xmms2-client --libs` `pkg-config libcurl --libs` src/xmms2-scrobbler.o src/list.o src/queue.o src/strbuf.o src/md5.o src/submission.o -o bin/xmms2-scrobbler
    src/xmms2-scrobbler.o: In function `save_profile_submissions_queue':
    xmms2-scrobbler.c:(.text+0x281): undefined reference to `xmmsc_userconfdir_get'
    src/xmms2-scrobbler.o: In function `load_config':
    xmms2-scrobbler.c:(.text+0x3e2): undefined reference to `xmmsc_userconfdir_get'
    src/xmms2-scrobbler.o: In function `maybe_submit_to_profile':
    xmms2-scrobbler.c:(.text+0x7e3): undefined reference to `xmmsc_medialib_get_info'
    xmms2-scrobbler.c:(.text+0x7f7): undefined reference to `xmmsc_result_notifier_set'

This commit puts library list after output binary ('-o $@') as '--as-needed'
starts external library tracking from there.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information...
1 parent 262ea5e commit b758e1d412cd7ab5abb21a39f8d7141efecc8841 @trofi committed Mar 3, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 Makefile
View
2 Makefile
@@ -36,7 +36,7 @@ install: $(BINARY)
install -m 755 $(BINARY) $(DESTDIR)$(PREFIX)/bin
$(BINARY): $(OBJECTS) bin
- $(QUIET_LINK)$(CC) $(OBJECTS) $(LDFLAGS) $(XMMS_LDFLAGS) $(CURL_LDFLAGS) -o $@ $(LIBS)
+ $(QUIET_LINK)$(CC) $(OBJECTS) -o $@ $(LDFLAGS) $(XMMS_LDFLAGS) $(CURL_LDFLAGS) $(LIBS)
src/%.o : src/%.c
$(QUIET_CC)$(CC) $(CFLAGS) $(XMMS_CFLAGS) $(CURL_CFLAGS) $(ENDIAN_CFLAGS) -o $@ -c $<

0 comments on commit b758e1d

Please sign in to comment.
Something went wrong with that request. Please try again.