I have no clue in gentoo but I guess emake is just a 'builder' which could invoke any command to build a package.
To build from our sources smth like this needs to be done
git clone git://git.debian.org/git/pkg-exppsy/afni.git
cd afni
QUILT_PATCHES=debian/patches quilt push -a # will apply all the patches under debian/patches, if no quilt do smth like
# cat debian/patches/series | while read p; do patch -p1 < debian/patches/$p; done
# to reverse the patches you could just git clean -dfx; git reset --hard or
# tac debian/patches/series | while read p; do patch -p1 -R < debian/patches/$p; done
at this point you should be able to configure and build AFNI with cmake happen you have all other build -dependencies installed. It should look like
mkdir build-custom; cd build-custom # to do out-of-source build, optional
cmake -DAFNI_SHOWOFF:STRING="=Gentoo-WhateverYouLikeToMention" \
-DBUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_SKIP_RPATH:BOOL=OFF \
-DCMAKE_INSTALL_RPATH:STRING="/usr/lib/afni/lib" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$LDFLAGS -Wl,--no-undefined" \
-DCMAKE_MODULE_LINKER_FLAGS:STRING="$LDFLAGS" \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="$LDFLAGS -Wl,--no-undefined" \
-DAFNI_BUILD_LOCAL_NIFTICLIBS:BOOL=OFF \
-DAFNI_BUILD_LOCAL_GIFTI:BOOL=OFF \
-DAFNI_BUILD_LOCAL_3DEDGE3:BOOL=ON \
-DAFNI_BUILD_WITH_LESSTIF2:BOOL=OFF \
-DAFNI_BUILD_TESTS:BOOL=ON \
-DAFNI_INSTALL_BIN_DIR:STRING=/lib/afni/bin \
-DAFNI_INSTALL_LIB_DIR:STRING=/lib/afni/lib \
-DAFNI_INSTALL_INCLUDE_DIR:STRING=/include/afni \
-DAFNI_INSTALL_PLUGIN_DIR:STRING=/lib/afni/plugins \
-DAFNI_INSTALL_SCRIPT_DIR:STRING=/share/afni/scripts \
-DAFNI_INSTALL_PICS_DIR:STRING=/share/afni/pics \
-DAFNI_INSTALL_POEMS_DIR:STRING=/share/afni/poems \
-DAFNI_INSTALL_HTML_DIR:STRING=/share/afni/html \
-DAFNI_INSTALL_ATLAS_DIR:STRING=/share/afni/atlases \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DAFNI_BUILD_CORELIBS_ONLY:BOOL=OFF ..
which configures the build and generates the Makefiles. Then you are ready to do the build with
make
now.
In Debian source package all above configuration/build rules are specified in debian/rules if you would like to discover more, and e.g.
fakeroot debian/rules install
would configure/build/and install binaries under subdirectories of debian/.
fakeroot debian/rules binary
command on Debian systems would generate binary packages (.deb)