# This file is taken from gcc-11 package in its-pointless repo.
# Android 5 requires position-independent executables, so we use the
#   %{!S:X}     Substitutes X, if the -S switch is not given to GCC"
# construct (see https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html for full reference)
# to add -fPIE and -pie flags as appropriate.
#
# this first changes Oz calls that only clang has into Os and also removes
# Werror=unguarded-availability-new this arg is in llvm-config. 
# may add -Wstring-conversion  -Wcovered-switch-default to specs in future

*cc1:
+ %{Oz:-Os}  %>Oz %>Werror=unguarded-availability-new %{static-openmp:-fopenmp} %>static-openmp  

*cc1_options:
+ %{!fpie: %{!fPIE: %{!fpic: %{!fPIC: %{!fno-pic:-fPIC}}}}} %{!fno-common:-fcommon} 

*cc1plus:
+ -I/data/data/com.termux/files/usr/include/c++/v1  %{!fpie: %{!fPIE: %{!fpic: %{!fPIC: %{!fno-pic:-fPIC}}}}} %{!frtti: %{!fno-rtti: -frtti}} 

*link:
+ -L/data/data/com.termux/files/usr/lib/gcc/arm-linux-androideabi/12.5.0 -L/data/data/com.termux/files/usr/lib   %{!nopie: %{!static: %{!shared: %{!nostdlib: %{!nostartfiles: %{!fno-PIE: %{!fno-pie: -pie}}}}}}} --enable-new-dtags --eh-frame-hdr  -rpath=/data/data/com.termux/files/usr/lib

*cc1:
+ -I/data/data/com.termux/files/usr/include/arm-linux-androideabi -I/data/data/com.termux/files/usr/include 

*link_gomp: -lgomp %{static: -ldl } 
