############################################################################### # Top level makefile for build system # # Copyright (C) Nintendo. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # ############################################################################### MODULE_DEPTH := . BUILD_MAKE_PATH := $(MODULE_DEPTH)/build/make include $(BUILD_MAKE_PATH)/commondefs.mk # Recognized targets called by meta-build .PHONY: default headers install clean clobber # Parallel build by default (make fast -> make default) include $(BUILD_MAKE_PATH)/target_fast.mk default: install include build/make/commondefs.mk include build/make/ghs_version_check.mk include build/make/multi_session_check.mk ############################################################################### # # help # ############################################################################### .PHONY: help help: @echo "------------------------------------------------------------------"; \ echo "Usage:"; \ echo ""; \ echo " To build"; \ echo " make - build debug version"; \ echo " make NDEBUG=TRUE - build non-debug version"; \ echo " make default - build in serial (without parallel jobs) with compiler+linker output"; \ echo " make clean - remove object and dependency files"; \ echo " make clobber - return to checkout state"; \ echo " export CAFE_MAKE_JOBS= - set maximum number of parallel jobs"; \ echo ""; \ echo " To make subset"; \ echo " make -j headers - pass 1 (export headers)"; \ echo " make -j install - pass 2 (install binaries)"; \ echo " make -j install_ - install binaries for immediate subdirectory"; \ ############################################################################### # # directories # ############################################################################### FILE_EXISTS = $(notdir $(wildcard demo)) MAKE_DIRS_HEADERS := lib ifeq ($(FILE_EXISTS),) MAKE_DIRS_INSTALL := lib else MAKE_DIRS_INSTALL := lib demo endif ############################################################################### # # headers # # First pass: Iterate across all modules to install global header files at system/src # ################################################################################ MAKE_HEADERS_DIRS_TARGET := $(addprefix headers_,$(MAKE_DIRS_HEADERS)) .PHONY: $(MAKE_HEADERS_DIRS_TARGET) $(MAKE_HEADERS_DIRS_TARGET): $(_@)$(MAKE) -C $(subst headers_,,$@) headers headers: $(MAKE_HEADERS_DIRS_TARGET) ############################################################################### # # install # # Second pass: Iterates across all modules to install libraries and binaries # ############################################################################### MAKE_INSTALL_DIRS_TARGET := $(addprefix install_,$(MAKE_DIRS_INSTALL)) .PHONY: $(MAKE_INSTALL_DIRS_TARGET) $(MAKE_INSTALL_DIRS_TARGET): $(_@)$(MAKE) -C $(subst install_,,$@) install install: $(MAKE_INSTALL_DIRS_TARGET) ############################################################################### # # install dependencies # ############################################################################### # Ensure that headers are done before install anything ifeq ($(FILE_EXISTS),) install install_lib: headers else install install_lib install_demo: headers # Ensure lib is done before demo install_demo: install_lib endif ############################################################################### # # clean # # Simple deletion of most object and dependency files # ############################################################################### clean_obj: @echo "------------------------------------------------------------------"; \ echo "Cleaning obj" rm -Rf $(OBJ_ROOT) clean: clean_obj ############################################################################### # # clobber # # Simple deletion of most generated stuff # ############################################################################### clobber: call_cafestop clean_obj ############################################################################### # # clobber explicit modules # # Recurse into specified directories to do extra cleaning # ############################################################################### MAKE_DIRS_CLOBBER := $(MAKE_DIRS_INSTALL) MAKE_CLOBBER_DIRS_TARGET := $(addprefix clobber_,$(MAKE_DIRS_CLOBBER)) .PHONY: $(MAKE_CLOBBER_DIRS_TARGET) $(MAKE_CLOBBER_DIRS_TARGET): $(_@)$(MAKE) -C $(subst clobber_,,$@) clobber clobber: $(MAKE_CLOBBER_DIRS_TARGET) ############################################################################### # # call_cafestop # # Release FSEmul's and PCFSServer's file locks in CAFE_CONTENT_DIR if FSEmul is still running # ############################################################################### call_cafestop: @if [ -f "$(CAFE_ROOT)/system/bin/tool/cafestop" -a -n "`ps | grep FSEmul`" ]; then \ echo "------------------------------------------------------------------"; \ echo "Calling cafestop to release file locks..."; \ $(CAFE_ROOT)/system/bin/tool/cafestop; \ fi