#******************************************************************************#
#* src/tools/Makefile                                                         *#
#*                                                                 2017/07/11 *#
#* Copyright (C) 2017 Mochi.                                                  *#
#******************************************************************************#
#******************************************************************************#
#* マクロ設定                                                                 *#
#******************************************************************************#
# ベースディレクトリsrc/からの相対パス
CUR_DIR  = tools

# サブディレクトリ
SUB_DIRS = makedisk \
           makeimg


#******************************************************************************#
#* 自動設定マクロ                                                             *#
#******************************************************************************#
# ベースディレクトリパス
BASE_DIR  = $(shell pwd | sed -e 's/\/src\/$(subst /,\/,$(CUR_DIR))//')
# 生成ファイル格納先ディレクトリパス
TOOLS_DIR  = $(BASE_DIR)/build/tools

#******************************************************************************#
#* phonyターゲット                                                            *#
#******************************************************************************#
# サブディレクトリも含めたコンパイル
.PHONY: all
all:
ifdef SUB_DIRS
	@for subdir in $(SUB_DIRS); \
	do \
	    $(MAKE) -C $$subdir all; \
	done
endif

# 全生成ファイルの削除
.PHONY: clean
clean:
ifdef SUB_DIRS
	@for subdir in $(SUB_DIRS); \
	do \
	    $(MAKE) -C $$subdir clean; \
	done
endif
	-rm -rf $(TOOLS_DIR)


#******************************************************************************#
