export ANDROID_ROOT=/usr/local/android-ndk-r6b/platforms/android-9/
export ANDROID_TOOLCHAIN=/usr/local/android-ndk-r6b/toolchains/
export PATH=$ANDROID_TOOLCHAIN/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin:$ANDROID_TOOLCHAIN/x86-4.4.3/prebuilt/darwin-x86/bin:$PATH
cd src
cp config.h.android config.h
cp config.h.android ../config.h
export CC='arm-linux-androideabi-gcc ' 
export CROSS_COMPILE='arm-linux-androideabi-'
export CFLAGS='-I. -I.. -I$(ANDROID_ROOT)/arch-arm/usr/include -g -fPIC -DPIC -fno-strict-aliasing -D__ANDROID__ -DHAVE_CONFIG_H -DGIAC_GENERIC_CONSTANTS' 
export CXXFLAGS='-I. -I.. -I$(ANDROID_ROOT)/arch-arm/usr/include -I/usr/local/android-ndk-r6b/sources/cxx-stl/gnu-libstdc++/include/ -I/usr/local/android-ndk-r6b/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -g -fPIC -DPIC -fno-strict-aliasing -D__ANDROID__ -DHAVE_CONFIG_H -DGIAC_GENERIC_CONSTANTS'
export LDFLAGS=' -fPIC -L$(ANDROID_ROOT)/arch-arm/usr/lib -lm -lc -lgcc -lstdc++' 
export AR='arm-linux-androideabi-ar' 
export AS='arm-linux-androideabi-as'
export LD='arm-linux-androideabi-g++' 
export RANLIB='arm-linux-androideabi-ranlib'
export OBJDUMP='arm-linux-androideabi-objdump' 
export STRIP='arm-linux-androideabi-strip'
export NM='arm-linux-androideabi-nm' 
export CXX='arm-linux-androideabi-g++'
rm -f *.o
make -f Makefile.android libgiac.so libgiac.a
sudo mkdir $ANDROID_ROOT/arch-arm/usr/include/giac
sudo cp libgiac*.so libgiac.a $ANDROID_ROOT/arch-arm/usr/lib
sudo cp *.h $ANDROID_ROOT/arch-arm/usr/include/giac

export CC='i686-android-linux-gcc ' 
export CROSS_COMPILE='i686-android-linux-'
export CFLAGS='-I. -I.. -I$(ANDROID_ROOT)/arch-x86/usr/include -g -fPIC -DPIC -fno-strict-aliasing -D__ANDROID__ -DHAVE_CONFIG_H -DGIAC_GENERIC_CONSTANTS' 
export CXXFLAGS='-I. -I.. -I$(ANDROID_ROOT)/arch-x86/usr/include -I/usr/local/android-ndk-r6b/sources/cxx-stl/gnu-libstdc++/include/ -I/usr/local/android-ndk-r6b/sources/cxx-stl/gnu-libstdc++/libs/x86/include -g -fPIC -DPIC -fno-strict-aliasing -D__ANDROID__ -DHAVE_CONFIG_H -DGIAC_GENERIC_CONSTANTS'
export LDFLAGS=' -fPIC -L$(ANDROID_ROOT)/arch-x86/usr/lib -lm -lc -lgcc -lstdc++' 
export AR='i686-android-linux-ar' 
export AS='i686-android-linux-as'
export LD='i686-android-linux-g++' 
export RANLIB='i686-android-linux-ranlib'
export OBJDUMP='i686-android-linux-objdump' 
export STRIP='i686-android-linux-strip'
export NM='i686-android-linux-nm' 
export CXX='i686-android-linux-g++'
rm -f *.o
make -f Makefile.android libgiac.so libgiac.a
sudo mkdir $ANDROID_ROOT/arch-x86/usr/include/giac
sudo cp libgiac*.so libgiac.a $ANDROID_ROOT/arch-x86/usr/lib
sudo cp *.h $ANDROID_ROOT/arch-x86/usr/include/giac

