1#! make -f
2#----------------------------------------------------------------------------
3# Project:  TwlSDK - root
4# File:     Makefile
5#
6# Copyright 2007-2008 Nintendo.  All rights reserved.
7#
8# These coded instructions, statements, and computer programs contain
9# proprietary information of Nintendo of America Inc. and/or Nintendo
10# Company Ltd., and are protected by Federal copyright law.  They may
11# not be disclosed to third parties or copied or duplicated in any form,
12# in whole or in part, without the prior written consent of Nintendo.
13#
14# $Date:: 2008-09-18#$
15# $Rev: 8574 $
16# $Author: okubata_ryoma $
17#----------------------------------------------------------------------------
18
19include		$(TWLSDK_ROOT)/build/buildtools/commondefs
20
21
22#----------------------------------------------------------------------------
23
24SUBDIRS 	= build
25
26
27#----------------------------------------------------------------------------
28
29include		$(TWLSDK_ROOT)/build/buildtools/modulerules
30
31
32#----------------------------------------------------------------------------
33.PHONY:		setup
34
35setup:
36	+$(MAKE) -C build/buildsetup/libcxx
37
38#----------------------------------------------------------------------------
39.PHONY:	do-copyright
40
41SDKDIR_BUILD	= build
42SDKDIR_INCLUDE	= include
43SDKCOPYRIGHT	= $(TWL_TOOLSDIR)/bin/sdkindent.copyright
44
45do-copyright:
46	@echo ===== COPYRIGHT STAGE =====
47	/bin/find $(SDKDIR_BUILD)   -type f \
48		-name '*' ! -name '*.yy.c' ! -name '*.yy.patched.c' ! -regex ".*\/\.svn\/.*" \
49		-size -128k -print \
50		-mtime -`/bin/date +%j` \
51		\! -exec grep -q 'Copyright [0-9 -]*2008' {} \; \
52		-exec $(SDKCOPYRIGHT) {} \;
53	/bin/find $(SDKDIR_INCLUDE) -type f \
54		-name '*' ! -name '*.yy.c' ! -name '*.yy.patched.c' ! -regex ".*\/\.svn\/.*" \
55		-size -128k -print \
56		-mtime -`/bin/date +%j` \
57		\! -exec grep -q 'Copyright [0-9 -]*2008' {} \; \
58		-exec $(SDKCOPYRIGHT) {} \;
59#----------------------------------------------------------------------------
60.PHONY:	check_code check_lang_en check_copyright_date_2008
61
62CHECKEES	= build include
63
64check_code: check_lang_en
65
66#
67#  Check backslash code for language EN
68#	Inverse result code of grep (e.g. grep returns 1 if not found)
69#	 -> Error if grep finds 0x5c(\) on 2nd byte of 16bit-wide
70#           Japanese kanji code at the end of line
71#
72CHECK_EXCLUDES	= *.txt *.o *.a *.d *.map *.elf Entries* Repository Root
73
74check_lang_en:
75	@echo --- $@ ---
76	-@(! grep -I -n -r $(patsubst %, --exclude='%',$(CHECK_EXCLUDES)) '[^[:space:] -~]\\[^ -~]\?$$' $(CHECKEES))
77
78#
79#  Check Copyright date for 2008
80#
81check_copyright_date_2008:
82	@echo --- $@ ---
83	-@for dir in $(CHECKEES); do \
84	    /bin/find $$dir \
85		\! \( -type d \( -name '_*' -o \
86				 -name \.svn  -o \
87				 -exec /bin/test -e {}/_ \; \) -prune \) \
88		-type f \
89		\! -name '*.exe' \! -name '*.[dao]' \! -name '*.sbin' \
90		\! -name '*.nlf' \! -name '*.nef'   \! -name '*.xMAP' \
91		-mtime -`/bin/date +%j` \
92		-exec grep -q 'Copyright [0-9 ,-]* Nintendo' {} \; \
93		\! -exec grep -q 'Copyright [0-9 ,-]*2008' {} \; \
94		-printf "Error: Copyright Date: %p\n"; \
95	done
96
97#===== End of Makefile =====
98