自動化のための nmake 入門講座 - ディレクトリ階層を扱う方法 補足

本編はこちら
http://www.objectclub.jp/community/memorial/homepage3.nifty.com/masarl/article/nmake/subdirs.html

//-------------------------------------------------
//以下サンプル

フォルダ構成を

Root
 + SubDir
  + MagoDirA
  + MagoDirB

とした場合

■subdirs.mak

subdirs:$(SUBDIRS_PRE_TARGET) $(SUBDIRS) $(SUBDIRS_POST_TARGET)
!if "$(SUBDIRS)" != ""
$(SUBDIRS):subdirs.mak.force-build
 cd $@
 nmake /fpc-cam.mak /$(MAKEFLAGS) subdirs
 cd ..
subdirs.mak.force-build:
!endif

■common.mak

message:
 $(MAKE) -fpc-cam.mak /$(MAKEFLAGS) subdirs SUBDIRS_PRE_TARGET=message-self

message-self:
 echo $(MESSAGE)

!include 

■makefile

# project Makefile

ROOT_DIR = .

SUBDIRS = SubDir
MESSAGE = This is project Makefile.

!include $(ROOT_DIR)\common.mak

■SubDir\makefile

ROOT_DIR = ..
SUBDIRS = MagoDirA MagoDirB

MESSAGE = This is project Sub/Makefile.

!include $(ROOT_DIR)\common.mak

■SubDir\MagoDirA\makefile

ROOT_DIR = ..\..

MESSAGE = This is project Sub/MagoDirA/Makefile.

!include $(ROOT_DIR)\common.mak

■SubDir\MagoDirB\makefile

ROOT_DIR = ..\..

MESSAGE = This is project Sub/MagoDirB/Makefile.

!include $(ROOT_DIR)\common.mak