make -n でコマンドを実行せずにマクロを展開して表示させる

$ORACLE_HOME/rdbms/lib/ins_rdbms.mk を読んでいて、${マクロ名} や $(マクロ名) といったマクロがどう展開されるか読み解くのが面倒なので、make で生成したコマンドを実行せずに展開して表示できないのかなと思って、make の man を見てみたら、

-bash-3.00$ man make
(中略)
     -n              No execution mode. Prints commands, but does
                     not  execute them. Even lines beginning with
                     an @ are printed. However, if a command line
                     contains  a  reference to the $(MAKE) macro,
                     that line is always executed (see  the  dis-
                     cussion  of  MAKEFLAGS  in  ). When in POSIX
                     mode, lines beginning with a  "+"  are  exe-
                     cuted.

「-n」オプションというのでできそう。
試してみると、

-bash-3.00$ /usr/ccs/bin/make -n -f ins_rdbms.mk dnfs_on
if [ ! -f /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/libodm11.so.dummy ]; then \
cp /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/libodm11.so.dummy; \
fi
rm -f /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so; cp /u01/app/oracle/product/11.2.0/dbhome_1/lib/libnfsodm11.so /u01/app/oracle/product/11.2.0/dbhome_1/lib/libodm11.so

でた。これは便利。


使用した環境は以下の通り。

-bash-3.00$ uname -a
SunOS solaris101 5.10 Generic_142910-17 i86pc i386 i86pc
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production