vpath %.c $(SRC_DIR)
vpath %.h $(SRC_DIR)
vpath %.S $(SRC_DIR)
+vpath %.asm $(SRC_DIR)
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
BUILD_ROOT_REL = .
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
$(CC) $(CFLAGS) -DTEST -c -o $$@ $$^
+$(SUBDIR)i386/%.o: $(SUBDIR)i386/%.asm
+ $(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
+
+$(SUBDIR)i386/%.d: $(SUBDIR)i386/%.asm
+ $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$(@:%.d=%.o) $$< > $$@
+
clean::
rm -f $(TESTS) $(addprefix $(SUBDIR),$(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
$(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
EOF
}
+check_yasm(){
+ log check_yasm "$@"
+ echo "$1" > $TMPS
+ log_file $TMPS
+ shift 1
+ check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
+}
+
check_ld(){
log check_ld "$@"
check_cc || return
termios_h
threads
winsock2_h
+ yasm
"
CMDLINE_SELECT="
# toolchain
cc="gcc"
+yasmexe="yasm"
ar="ar"
nm="nm"
ranlib="ranlib"
strip="strip"
asmalign_pot="unknown"
ln_s="ln -sf"
+objformat="elf"
# machine
arch=`uname -m`
set >> $logfile
cc="${cross_prefix}${cc}"
+yasmexe="${cross_prefix}${yasmexe}"
ar="${cross_prefix}${ar}"
nm="${cross_prefix}${nm}"
ranlib="${cross_prefix}${ranlib}"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
FFSERVERLDFLAGS=-Wl,-bind_at_load
+ objformat="macho"
;;
mingw32*)
target_os=mingw32
install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
+ objformat="win32"
;;
cygwin*)
target_os=cygwin
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
SHFLAGS='-shared -Wl,--enable-auto-image-base'
+ objformat="win32"
;;
*-dos|freedos|opendos)
disable ffplay ffserver vhook
disable $INDEV_LIST $OUTDEV_LIST
network_extralibs="-lsocket"
EXESUF=".exe"
+ objformat="win32"
;;
linux)
enable dv1394
enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
check_asm bswap '"bswap %%eax" ::: "%eax"'
+
+ YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
+ enabled x86_64 && append YASMFLAGS "-m amd64"
+ enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
+ case "$objformat" in
+ elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
+ *) append YASMFLAGS "-DPREFIX" ;;
+ esac
+ check_yasm "pabsw xmm0, xmm0" && enable yasm
fi
# check for assembler specific support
echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
echo "CC=$cc" >> config.mak
+echo "YASM=$yasmexe" >> config.mak
echo "AR=$ar" >> config.mak
echo "RANLIB=$ranlib" >> config.mak
echo "LN_S=$ln_s" >> config.mak
echo "LDFLAGS=$LDFLAGS" >> config.mak
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
echo "SHFLAGS=$SHFLAGS" >> config.mak
+echo "YASMFLAGS=$YASMFLAGS" >> config.mak
echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak