tools/%$(EXESUF): tools/%.o
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
-tools/%.o: tools/%.c
+tools/%.o: tools/%.c | tools
$(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $<
+OBJDIRS += tools
+
-include $(wildcard tools/*.d)
VERSION_SH = $(SRC_PATH)/version.sh
include $(SRC_PATH)/doc/Makefile
include $(SRC_PATH)/tests/Makefile
+$(sort $(OBJDIRS)):
+ $(Q)mkdir -p $@
+
# Dummy rule to stop make trying to rebuild removed or renamed headers
%.h:
@:
$(HOSTPROGS): %$(HOSTEXESUF): %.o
$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
+$(OBJS): | $(dir $(OBJS))
+$(HOSTOBJS): | $(dir $(HOSTOBJS))
+$(TESTOBJS): | $(dir $(TESTOBJS))
+
+OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
+
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
}
cp_if_changed(){
- cmp -s "$1" "$2" &&
- echo "$2 is unchanged" ||
- cp -f "$1" "$2"
+ cmp -s "$1" "$2" && echo "$2 is unchanged" && return
+ mkdir -p "$(dirname $2)"
+ cp -f "$1" "$2"
}
# CONFIG_LIST contains configurable options, while HAVE_LIST is for
# find source path
if test -f configure; then
source_path=.
- disable source_path_used
else
source_path=$(cd $(dirname "$0"); pwd)
- enable source_path_used
echo "$source_path" | grep -q '[[:blank:]]' &&
die "Out of tree builds are impossible with whitespace in source path."
test -e "$source_path/config.h" &&
echo "Creating config.mak and config.h..."
-# build tree in object directory if source path is different from current one
-if enabled source_path_used; then
- DIRS="
- doc
- libavcodec
- libavcodec/$arch
- libavdevice
- libavfilter
- libavfilter/$arch
- libavformat
- libavutil
- libavutil/$arch
- libpostproc
- libswscale
- libswscale/$arch
- tests
- tools
- "
- map 'mkdir -p $v' $DIRS;
- $ln_s "$source_path/Makefile" .
-fi
+test -e Makefile || $ln_s "$source_path/Makefile" .
config_files="$TMPH config.mak"
libs=$4
requires=$5
enabled ${name#lib} || return 0
+mkdir -p $name
cat <<EOF > $name/$name.pc
prefix=$prefix
exec_prefix=\${prefix}