1############################################################################### 2# Top level makefile for build system 3# 4# Copyright (C) Nintendo. All rights reserved. 5# 6# These coded instructions, statements, and computer programs contain 7# proprietary information of Nintendo of America Inc. and/or Nintendo 8# Company Ltd., and are protected by Federal copyright law. They may 9# not be disclosed to third parties or copied or duplicated in any form, 10# in whole or in part, without the prior written consent of Nintendo. 11# 12############################################################################### 13 14MODULE_DEPTH := . 15BUILD_MAKE_PATH := $(MODULE_DEPTH)/build/make 16 17include $(BUILD_MAKE_PATH)/commondefs.mk 18 19# Recognized targets called by meta-build 20.PHONY: default headers install clean clobber 21 22# Parallel build by default (make fast -> make default) 23include $(BUILD_MAKE_PATH)/target_fast.mk 24 25default: install 26 27include build/make/commondefs.mk 28include build/make/ghs_version_check.mk 29include build/make/multi_session_check.mk 30 31############################################################################### 32# 33# help 34# 35############################################################################### 36 37.PHONY: help 38 39help: 40 @echo "------------------------------------------------------------------"; \ 41 echo "Usage:"; \ 42 echo ""; \ 43 echo " To build"; \ 44 echo " make - build debug version"; \ 45 echo " make NDEBUG=TRUE - build non-debug version"; \ 46 echo " make default - build in serial (without parallel jobs) with compiler+linker output"; \ 47 echo " make clean - remove object and dependency files"; \ 48 echo " make clobber - return to checkout state"; \ 49 echo " export CAFE_MAKE_JOBS=<n> - set maximum number of parallel jobs"; \ 50 echo ""; \ 51 echo " To make subset"; \ 52 echo " make -j <n> headers - pass 1 (export headers)"; \ 53 echo " make -j <n> install - pass 2 (install binaries)"; \ 54 echo " make -j <n> install_<dir> - install binaries for immediate subdirectory"; \ 55 56############################################################################### 57# 58# directories 59# 60############################################################################### 61 62FILE_EXISTS = $(notdir $(wildcard demo)) 63 64MAKE_DIRS_HEADERS := lib 65ifeq ($(FILE_EXISTS),) 66MAKE_DIRS_INSTALL := lib 67else 68MAKE_DIRS_INSTALL := lib demo 69endif 70 71############################################################################### 72# 73# headers 74# 75# First pass: Iterate across all modules to install global header files at system/src 76# 77################################################################################ 78 79MAKE_HEADERS_DIRS_TARGET := $(addprefix headers_,$(MAKE_DIRS_HEADERS)) 80 81.PHONY: $(MAKE_HEADERS_DIRS_TARGET) 82 83$(MAKE_HEADERS_DIRS_TARGET): 84 $(_@)$(MAKE) -C $(subst headers_,,$@) headers 85 86headers: $(MAKE_HEADERS_DIRS_TARGET) 87 88############################################################################### 89# 90# install 91# 92# Second pass: Iterates across all modules to install libraries and binaries 93# 94############################################################################### 95 96MAKE_INSTALL_DIRS_TARGET := $(addprefix install_,$(MAKE_DIRS_INSTALL)) 97 98.PHONY: $(MAKE_INSTALL_DIRS_TARGET) 99 100$(MAKE_INSTALL_DIRS_TARGET): 101 $(_@)$(MAKE) -C $(subst install_,,$@) install 102 103install: $(MAKE_INSTALL_DIRS_TARGET) 104 105############################################################################### 106# 107# install dependencies 108# 109############################################################################### 110 111# Ensure that headers are done before install anything 112ifeq ($(FILE_EXISTS),) 113install install_lib: headers 114else 115install install_lib install_demo: headers 116 117# Ensure lib is done before demo 118install_demo: install_lib 119endif 120 121############################################################################### 122# 123# clean 124# 125# Simple deletion of most object and dependency files 126# 127############################################################################### 128 129clean_obj: 130 @echo "------------------------------------------------------------------"; \ 131 echo "Cleaning obj" 132 rm -Rf $(OBJ_ROOT) 133 134clean: clean_obj 135 136############################################################################### 137# 138# clobber 139# 140# Simple deletion of most generated stuff 141# 142############################################################################### 143 144clobber: call_cafestop clean_obj 145 146############################################################################### 147# 148# clobber explicit modules 149# 150# Recurse into specified directories to do extra cleaning 151# 152############################################################################### 153 154MAKE_DIRS_CLOBBER := $(MAKE_DIRS_INSTALL) 155 156MAKE_CLOBBER_DIRS_TARGET := $(addprefix clobber_,$(MAKE_DIRS_CLOBBER)) 157 158.PHONY: $(MAKE_CLOBBER_DIRS_TARGET) 159 160$(MAKE_CLOBBER_DIRS_TARGET): 161 $(_@)$(MAKE) -C $(subst clobber_,,$@) clobber 162 163clobber: $(MAKE_CLOBBER_DIRS_TARGET) 164 165############################################################################### 166# 167# call_cafestop 168# 169# Release FSEmul's and PCFSServer's file locks in CAFE_CONTENT_DIR if FSEmul is still running 170# 171############################################################################### 172 173call_cafestop: 174 @if [ -f "$(CAFE_ROOT)/system/bin/tool/cafestop" -a -n "`ps | grep FSEmul`" ]; then \ 175 echo "------------------------------------------------------------------"; \ 176 echo "Calling cafestop to release file locks..."; \ 177 $(CAFE_ROOT)/system/bin/tool/cafestop; \ 178 fi 179 180