# C compiler flags.  This is traditionally called CFLAGS in makefiles.
# Historically also available as %%{optflags}, and %%build sets the
# environment variable RPM_OPT_FLAGS to this value.
%build_cflags %{optflags}

# C++ compiler flags.  This is traditionally called CXXFLAGS in makefiles.
%build_cxxflags %{optflags}

# C++ compiler flags.  This is traditionally called CXXFLAGS in makefiles.
%build_cxxflags %{optflags}

# Fortran compiler flags.  Makefiles use both FFLAGS and FCFLAGS as
# the corresponding variable names.
%build_fflags %{optflags} %{?_fmoddir:-I%{_fmoddir}}

# Link editor flags.  This is usually called LDFLAGS in makefiles.
#%build_ldflags -Wl,-z,relro %{?_lto_cflags}

# Expands to shell code to seot the compiler/linker environment
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
# not been set already.
%set_build_flags \
  CFLAGS="${CFLAGS:-%{?build_cflags}}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%{?build_cxxflags}}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%{?build_fflags}}" ; export FFLAGS ; \
  FCFLAGS="${FCFLAGS:-%{?build_fflags}}" ; export FCFLAGS ; \
  LDFLAGS="${LDFLAGS:-%{?build_ldflags}}" ; export LDFLAGS

%_smp_build_ncpus %([ -z "$RPM_BUILD_NCPUS" ] \\\
 	&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
        ncpus_max=%{?_smp_ncpus_max}; \\\
        if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
        echo "$RPM_BUILD_NCPUS";)


# ---- VPATH default settings

# directory where CMakeLists.txt/meson.build/etc. are placed
%_vpath_srcdir .

# directory (doesn't need to exist) where all generated build files will be placed
%_vpath_builddir %_target_platform

%ldconfig /sbin/ldconfig
%ldconfig_post(n:) %{?ldconfig:%post -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_postun(n:) %{?ldconfig:%postun -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_scriptlets(n:) %{?ldconfig:\
%ldconfig_post %{?*} %{-n:-n %{-n*}}\
%ldconfig_postun %{?*} %{-n:-n %{-n*}}\
}
