2005-05-17 22:05:45 +00:00
2013-05-04 10:40:05 +00:00
#windows is special as always, but we don't support itanium, and microsoft don't support anything else (not even arm with the nt win32 api)
i f e q ( $( FTE_TARGET ) , w i n 3 2 )
PLUG_NATIVE_EXT = x86.dll
PLUG_LDFLAGS = -Lavplug/lib32 -L../engine/libs/mingw-libs -lzlib
e n d i f
i f e q ( $( FTE_TARGET ) , w i n 6 4 )
PLUG_NATIVE_EXT = amd.dll
PLUG_LDFLAGS = -Lavplug/lib64 -L../engine/libs/mingw64-libs -lz -Wl,--support-old-code
e n d i f
PLUG_LDFLAGS ?= -L/usr/local/lib -Wl,-R/usr/local/lib -lz
i f n e q ( $( PLUG_NATIVE_EXT ) , )
#if we're on windows, we'll put our windows-specific hacks here.
PLUG_DEFFILE = plugin.def
PLUG_CFLAGS =
$(OUT_DIR)/fteplug_avplug$(PLUG_NATIVE_EXT) : avplug /libavformat /avformat .h
e n d i f
2013-11-21 23:02:28 +00:00
#cygwin uses dll naming.
i f e q ( $( FTE_TARGET ) , c y g w i n )
i f e q ( $( BITS ) , 6 4 )
PLUG_DEFFILE = plugin.def
PLUG_NATIVE_EXT = amd.dll
e n d i f
i f n e q ( $( BITS ) , 6 4 )
PLUG_DEFFILE = plugin.def
PLUG_NATIVE_EXT = x86.dll
e n d i f
e n d i f
2013-05-04 10:40:05 +00:00
#if they're not on windows, we'll try asking the compiler directly
#the check to see if its already set is to avoid asking msvc, which would probably break things.
i f e q ( $( PLUG_NATIVE_EXT ) , )
2013-11-24 16:45:47 +00:00
LIBRESOLV = -lresolv
2013-05-04 10:40:05 +00:00
i f n e q ( $( shell echo |$ ( CC ) -E -dM -|grep __amd 64__ ) , )
PLUG_NATIVE_EXT = amd.so
e n d i f
i f n e q ( $( shell echo |$ ( CC ) -E -dM -|grep __i 386__ ) , )
PLUG_NATIVE_EXT = x86.so
e n d i f
i f n e q ( $( shell echo |$ ( CC ) -E -dM -|grep __arm__ ) , )
PLUG_NATIVE_EXT = arm.so
e n d i f
i f n e q ( $( shell echo |$ ( CC ) -E -dM -|grep __ppc__ ) , )
PLUG_NATIVE_EXT = ppc.so
e n d i f
e n d i f
#fallback
PLUG_NATIVE_EXT ?= unk.so
PLUG_DEFFILE ?=
2013-06-23 18:43:59 +00:00
PLUG_CFLAGS ?= -fPIC -Wl,--no-undefined -Bsymbolic
2013-05-04 10:40:05 +00:00
PLUG_LDFLAGS ?=
2007-10-05 09:59:27 +00:00
all : ezscript hud irc
2005-05-17 22:05:45 +00:00
2007-10-05 09:59:27 +00:00
clean : ezscript -clean hud -clean irc -clean
2013-05-04 10:40:05 +00:00
.PHONY : all ezscript hud irc native distclean clean
2005-05-17 22:05:45 +00:00
help :
@-echo make a subdirectory
2007-10-05 09:59:27 +00:00
ezscript :
$( MAKE) -C ezscript
ezscript-clean :
$( MAKE) clean -C ezscript
2005-05-17 22:05:45 +00:00
hud :
$( MAKE) -C hud
2007-10-05 09:59:27 +00:00
hud-clean :
$( MAKE) clean -C hud
2005-05-17 22:05:45 +00:00
irc :
2005-06-15 15:04:34 +00:00
$( MAKE) -C irc
2005-05-17 22:05:45 +00:00
2007-10-05 09:59:27 +00:00
irc-clean :
$( MAKE) clean -C irc
2013-05-04 10:40:05 +00:00
#small script to download+install avformat for windows cross compiles.
#linux users are expected to have the library installed locally already. If your version is too old or missing, run the following command to install it (to /usr/local), then delete the gz and directory.
#wget http://ffmpeg.org/releases/ffmpeg-1.2.tar.gz && cd tar xvfz ffmpeg-1.2.tar.gz && cd ffmpeg-1.2/ && ./configure --disable-yasm --enable-shared && make && sudo make install
#we use ffmpeg's version for some reason, as opposed to libav. not sure what the differences are meant to be, but libav seemed to have non-depricated functions defined, docs that say to use them, and these functions missing.
AV7Z_VER = ffmpeg-1.2
AV7Z_W32 = $( AV7Z_VER) -win32-dev.7z
AV7Z_URL32 = http://ffmpeg.zeranoe.com/builds/win32/dev/$( AV7Z_W32)
AV7Z_PRE32 = $( AV7Z_VER) -win32-dev/
AV7Z_W64 = $( AV7Z_VER) -win64-dev.7z
AV7Z_URL64 = http://ffmpeg.zeranoe.com/builds/win64/dev/$( AV7Z_W64)
AV7Z_PRE64 = $( AV7Z_VER) -win64-dev/
avplug/libavformat/avformat.h :
wget $( AV7Z_URL32)
mkdir -p avplug/libavformat && cd avplug/libavformat && 7z e -y ../../$( AV7Z_W32) $( AV7Z_PRE32) include/libavformat/ && cd -
mkdir -p avplug/libavcodec && cd avplug/libavcodec && 7z e -y ../../$( AV7Z_W32) $( AV7Z_PRE32) include/libavcodec/ && cd -
mkdir -p avplug/libavutil && cd avplug/libavutil && 7z e -y ../../$( AV7Z_W32) $( AV7Z_PRE32) include/libavutil/ && cd -
mkdir -p avplug/libswscale && cd avplug/libswscale && 7z e -y ../../$( AV7Z_W32) $( AV7Z_PRE32) include/libswscale/ && cd -
mkdir -p avplug/lib32 && cd avplug/lib32 && 7z e -y ../../$( AV7Z_W32) $( AV7Z_PRE32) lib/avformat.lib $( AV7Z_PRE32) lib/avcodec.lib $( AV7Z_PRE32) lib/avutil.lib $( AV7Z_PRE32) lib/swscale.lib && cd -
rm $( AV7Z_W32)
wget $( AV7Z_URL64)
mkdir -p avplug/lib64 && cd avplug/lib64 && 7z e -y ../../$( AV7Z_W64) $( AV7Z_PRE64) lib/avformat.lib $( AV7Z_PRE64) lib/avcodec.lib $( AV7Z_PRE64) lib/avutil.lib $( AV7Z_PRE64) lib/swscale.lib && cd -
rm $( AV7Z_W64)
distclean :
rm avplug/libavformat/avformat.h
2013-06-23 18:43:59 +00:00
$(OUT_DIR)/fteplug_avplug$(PLUG_NATIVE_EXT) : avplug /avencode .c avplug /avdecode .c plugin .c qvm_api .c
$( CC) $( BASE_CFLAGS) $( CFLAGS) -DFTEPLUGIN -s -o $( OUT_DIR) /fteplug_avplug$( PLUG_NATIVE_EXT) -shared $( PLUG_CFLAGS) -Iavplug/msvc_lib $^ $( PLUG_DEFFILE) $( PLUG_LDFLAGS) -lavcodec -lavformat -lavutil -lswscale
2013-11-24 16:35:52 +00:00
#native: $(OUT_DIR)/fteplug_avplug$(PLUG_NATIVE_EXT)
2013-05-04 10:40:05 +00:00
$(OUT_DIR)/fteplug_mpq$(PLUG_NATIVE_EXT) : mpq /fs_mpq .c mpq /blast .c plugin .c qvm_api .c
2013-06-23 18:43:59 +00:00
$( CC) $( BASE_CFLAGS) $( CFLAGS) -DFTEPLUGIN -o $( OUT_DIR) /fteplug_mpq$( PLUG_NATIVE_EXT) -shared $( PLUG_CFLAGS) -Impq $^ $( PLUG_DEFFILE) $( PLUG_LDFLAGS)
2013-05-04 10:40:05 +00:00
native : $( OUT_DIR ) /fteplug_mpq $( PLUG_NATIVE_EXT )
2013-11-21 23:02:28 +00:00
$(OUT_DIR)/fteplug_xmpp$(PLUG_NATIVE_EXT) : jabber /jabberclient .c jabber /jingle .c jabber /sift .c jabber /xml .c plugin .c qvm_api .c ../engine /common /sha 1.c emailnot /md 5.c
2013-11-24 16:45:47 +00:00
$( CC) $( BASE_CFLAGS) $( CFLAGS) -DFTEPLUGIN -o $( OUT_DIR) /fteplug_xmpp$( PLUG_NATIVE_EXT) -shared $( PLUG_CFLAGS) -Ijabber $^ $( PLUG_DEFFILE) $( PLUG_LDFLAGS) $( LIBRESOLV)
2013-06-23 18:43:59 +00:00
native : $( OUT_DIR ) /fteplug_xmpp $( PLUG_NATIVE_EXT )
2013-05-04 10:40:05 +00:00
native :