Oracle:How to determine the size of available shared memory of operating system while setting MEMORY_TARGET parameter for oracle instance?
You should go for the solution that fulfills your requirements.

Both shmall and /dev/shm are configurable, so first you should to configure them, and after that, you can set MEMORY_TARGET. The default value (on Oracle Linux 7) of shmall is 4 TB, which is irrelevant for most systems. The default size of /dev/shm is 50% of the physical memory.

If you use the default settings, following /dev/shm for sizing can be a viable option, but it may be suboptimal ("Unused memory is wasted memory").

To make things more complicated, MEMORY_TARGET includes PGA, which is not shared memory.

Also, my personal opinion/practice: whenever I can, I use ASMM (sga_target/sga_max_size + pga_aggreate_target) instead of AMM (memory_target/memory_max_size). Especially since hugepages works with ASMM, but not with AMM.