Commit 684b28e0 authored by Måns Rullgård's avatar Måns Rullgård
Browse files

Use LD for linking, default to same as CC

Originally committed as revision 19407 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 3198f618
......@@ -65,10 +65,10 @@ ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
$(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
tools/%$(EXESUF): tools/%.c
$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
$(LD) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
......@@ -304,8 +304,8 @@ tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
tests/%$(HOSTEXESUF): tests/%.c
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
tests/seek_test$(EXESUF): tests/seek_test.c $(FF_DEP_LIBS)
$(CC) $(FF_LDFLAGS) $(CFLAGS) -o $@ $< $(FF_EXTRALIBS)
tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
.PHONY: documentation *test regtest-* zlib-error alltools check config
......@@ -190,6 +190,7 @@ show_help(){
echo " --nm=NM use nm tool"
echo " --as=AS use assembler AS [$as_default]"
echo " --cc=CC use C compiler CC [$cc_default]"
echo " --ld=LD use linker LD"
echo " --host-cc=HOSTCC use host C compiler HOSTCC"
echo " --host-cflags=HCFLAGS use HCFLAGS when compiling for host"
echo " --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host"
......@@ -579,7 +580,7 @@ check_ld(){
for f; do
test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
done
check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
}
check_cppflags(){
......@@ -1000,6 +1001,7 @@ CMDLINE_SET="
host_ldflags
host_libs
host_os
ld
logfile
nm
source_path
......@@ -1485,7 +1487,8 @@ fi
test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
set_default as
: ${ld_default:=$cc}
set_default as ld
if test -n "$sysroot"; then
case "$cc_type" in
......@@ -2476,6 +2479,7 @@ echo "SRC_PATH_BARE=$source_path" >> config.mak
echo "BUILD_ROOT=\"$PWD\"" >> config.mak
echo "CC=$cc" >> config.mak
echo "AS=$as" >> config.mak
echo "LD=$ld" >> config.mak
echo "YASM=$yasmexe" >> config.mak
echo "AR=$ar" >> config.mak
echo "RANLIB=$ranlib" >> config.mak
......
......@@ -22,7 +22,7 @@ THIS_LIB := $(SUBDIR)$($(BUILD_SHARED:yes=S)LIBNAME)
define RULES
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
$(CC) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
$(SUBDIR)%-test.o: $(SUBDIR)%.c
$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
......@@ -54,7 +54,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
$(SLIB_CREATE_DEF_CMD)
$(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
$(SLIB_EXTRA_CMD)
ifdef SUBDIR
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment