1###############################################################################
2# vim:ts=4:sw=4:noexpandtab
3# Makefile for any library
4#
5# Copyright (C) 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# This makefile must set the relative depth to the build directory
16# using only "..", without a trailing slash
17
18ifeq ($(WIN64),TRUE)
19WIN64_BIN_PATH=$(CAFE_ROOT)/system/bin/win64
20GFD_DLL=$(WIN64_BIN_PATH)/gfd.dll
21TEXUTILS_DLL=$(WIN64_BIN_PATH)/texUtils.dll
22TEXCONV2_EXE=$(WIN64_BIN_PATH)/TexConv2.exe
23else
24WIN32_BIN_PATH=$(CAFE_ROOT)/system/bin/win32
25GFD_DLL=$(WIN32_BIN_PATH)/gfd.dll
26TEXUTILS_DLL=$(WIN32_BIN_PATH)/texUtils.dll
27TEXCONV2_EXE=$(WIN32_BIN_PATH)/TexConv2.exe
28endif
29
30
31DATA_DEST_ROOT=$(shell cygpath -u $(CAFE_ROOT))/data/disc/content/assets/textures
32DATA_DEST_DIR=$(DATA_DEST_ROOT)/$(ASSET_SUBDIR)/$(PLATFORM)
33
34# commondefs.mk must be included near the top so that all common variables
35# will be defined before their use.
36
37include $(BUILD_MAKE_PATH)/commondefs.mk
38include $(BUILD_MAKE_PATH)/commondefs.cos.mk
39
40.PHONY: default
41
42default: texture
43install: texture
44
45###############################################################################
46#
47# For textures
48#
49###############################################################################
50
51.PHONY: clobber clean clean_texture
52
53clobber: clean_texture
54clean: clobber
55
56clean_texture:
57	$(_@)echo "------------------------------------------------------------------" ; \
58	echo "Cleaning textures"
59	rm -Rf $(DATA_DEST_ROOT)/$(ASSET_SUBDIR)
60
61# Note: dependency is between destination subdirectory and source .sh file
62#       (and the texture converter)
63# To force update for a particular texture set, touch the associated .sh file
64
65$(DATA_DEST_DIR)/%: %.sh $(TEXCONV2_EXE) $(TEXUTILS_DLL) $(GFD_DLL)
66	$(_@)rm -Rf $(DATA_DEST_DIR)/$* ;
67	$(_@)mkdir -p $(DATA_DEST_DIR)/$* ;
68	$(_@)sed --in-place -e 's/\r\n/\n/' ./$*.sh &> /dev/null;
69	./$*.sh $(shell cygpath -m $(DATA_DEST_DIR))/$* "$(GTX_OPTIONS)";
70
71$(TEXCONV2_EXE): $(ATI_BIN)
72	make -C $(CAFE_ROOT)/system/src/tool/gfx/projects/TexConv2
73
74# Note: GTX_OPTIONS are set up in commondefs.mk based on PLATFORM_GPU definition
75
76.PHONY: texture print_texture
77
78print_texture:
79	$(call MOD_RULES_PHASE, "Converting/Installing $(MODULE_PATH_FROM_SRC)")
80
81texture: print_texture $(patsubst %.sh,$(DATA_DEST_DIR)/%,$(CONVERTER_SCRIPTS))
82
83#======== End of makefile ========#
84
85