1###############################################################################
2#
3# publish system update partition
4#
5# Copyright 2011 Nintendo.  All rights reserved.
6#
7# These coded instructions, statements, and computer programs contain
8# proprietary information of Nintendo of America Inc. and/or Nintendo
9# Company Ltd., and are protected by Federal copyright law.  They may
10# not be disclosed to third parties or copied or duplicated in any form,
11# in whole or in part, without the prior written consent of Nintendo.
12#
13###############################################################################
14
15# figure out proper depth automatically
16MODULE_DEPTH    := $(shell pwd | sed -e "s:$(CAFE_ROOT)/system/src/::" -e "s:[^/]\+:..:g")
17BUILD_MAKE_PATH := $(MODULE_DEPTH)/build/make
18
19include $(BUILD_MAKE_PATH)/commondefs.mk
20
21# Recognized targets called by meta-build
22.PHONY: default clean clobber
23
24# Default target
25default: publish
26
27###############################################################################
28#
29#  defines
30#
31###############################################################################
32PUBLISH_ES_TITLE   := $(CAFE_ROOT)/system/bin/tool/publishTitle.sh
33
34ifndef TITLE_SOURCE_DIR
35$(error Please specify TITLE_SOURCE_DIR)
36endif
37ifndef TITLE_DEST_DIR
38$(error Please specify TITLE_DEST_DIR)
39endif
40
41ifeq ($(GROUP_ACCESS), TRUE)
42ARGS_PUBLISH := -r
43endif
44
45###############################################################################
46#
47#  clean
48#
49###############################################################################
50
51clean:
52	$(_@)echo "------------------------------------------------------------------" ; \
53	 echo "Clobbering published title packages"
54	rm -Rf $(TITLE_DEST_DIR)
55
56###############################################################################
57#
58#  clobber
59#
60###############################################################################
61
62clobber: clean
63
64###############################################################################
65#
66#  publish
67#
68###############################################################################
69
70publish: $(TITLE_DEST_DIR)
71
72$(TITLE_DEST_DIR): $(TITLE_SOURCE_DIR)
73	$(_@)echo "------------------------------------------------------------------" ; \
74	 echo ">> Publishing $(notdir $@) from $< directory"
75	$(_@)if [ ! -d "$</code" -o ! -d "$</content" -o ! -d "$</meta" ] ; then \
76	     echo "$(notdir $@) is not built"; \
77		 exit 3; \
78	 fi
79	$(_@)mkdir -p $@
80	$(PUBLISH_ES_TITLE) $(ARGS_PUBLISH) -b 1 -c $</code -d $</content -m $</meta -o $@ &> /dev/null
81
82###############################################################################
83#
84#  publish dependencies
85#
86###############################################################################
87
88# Can be called from a parallelized build.  Force serialization until tools can parallelize
89# This rule always applies to the entire makefile. Dependencies are ignored.
90.NOTPARALLEL:
91