The simplest thing to do is to see how AFNI makes one of its own programs, by doing something like
make 3dANOVA
Then "make" will echo to the screen the command lines it uses to compile and link the program. You can then duplicate that, substituting "3dtemp" for "3dANOVA". You might want to copy the compile lines from the screen into a file, then edit that file, then run it as a script (e.g., "source filename") when you need to recompile.
bob cox