1#! make -f
2#----------------------------------------------------------------------------
3# Project:  RVLDWC - Library - build - buildtools
4# File:     modulerules.VC
5#
6#  Copyright 2005 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# $Revision: 1.6 $
15#----------------------------------------------------------------------------
16
17ifndef RVLDWC_MODULERULES_VC_
18RVLDWC_MODULERULES_VC_ = TRUE
19
20
21#----------------------------------------------------------------------------
22#  MAKE TARGETS
23#----------------------------------------------------------------------------
24
25.PHONY:	default build do-build install do-install clean clobber
26
27BUILDCMDS = default build
28
29
30.PHONY: $(TARGETS)
31
32$(TARGETS):
33	@rm -f $(VC_LOGFILE)
34	-$(DEVENV) $(SOLUTION) $(BUILD_OPT) $(RVLDWC_BUILDNAME) /out $(VC_LOGFILE) $(RVLDWC_STDOUT)
35ifdef RVLDWC_STDOUT
36	@gawk -f $(RVLDWC_BUILDTOOLSDIR)/script/vclogcvtr.awk $(VC_LOGFILE)
37endif
38
39
40#----------------------------------------------------------------------------
41
42define MAKE_SUBDIR
43		$(foreach DIR, $(SUBDIRS), $(REMAKE) -C $(DIR) $@ $(AND)) true
44endef
45
46define ECHO_CURDIR
47		echo ""
48		echo "==== $(CURDIR)";
49endef
50
51
52#----------------------------------------------------------------------------
53#  install_files
54#----------------------------------------------------------------------------
55define install_files
56		@$(INSTALL) -d $(INSTALL_DIR)
57		@$(foreach FILE, $(INSTALL_TARGETS), \
58			echo "  install: $(FILE) -> $(INSTALL_DIR)" $(AND) \
59			$(INSTALL) $(FILE) $(INSTALL_DIR) $(AND)) true
60endef
61
62
63#----------------------------------------------------------------------------
64#  make build
65#----------------------------------------------------------------------------
66
67build:
68		@$(MAKE_SUBDIR)
69		@$(ECHO_CURDIR)
70		@+$(REMAKE) do-build
71ifdef	INSTALL_TARGETS
72ifndef	INSTALL_IGNORE
73		$(call install_files)
74		@$(REMAKE) do-install
75endif
76endif
77
78
79#----------------------------------------------------------------------------
80#  make install
81#----------------------------------------------------------------------------
82
83install:
84		@$(MAKE_SUBDIR)
85		@$(ECHO_CURDIR)
86ifdef	INSTALL_TARGETS
87ifndef	INSTALL_IGNORE
88		$(call install_files)
89		@$(REMAKE) do-install
90endif
91endif
92
93
94#----------------------------------------------------------------------------
95#  make full
96#----------------------------------------------------------------------------
97
98define makefull
99	@echo [[[ make full $(1) $(CURDIR) ]]]
100	@+unset RVLDWC_TOOL_DEBUG RVLDWC_TOOL_RELEASE; \
101	$(foreach a,RELEASE DEBUG, \
102		$(REMAKE) RVLDWC_TOOL_$a=TRUE $(1) $(AND) \
103	) true
104endef
105
106full:
107	$(call makefull,build)
108
109full-install:
110	$(call makefull,install)
111
112
113#----------------------------------------------------------------------------
114#  make clean
115#----------------------------------------------------------------------------
116
117clean:
118		@$(MAKE_SUBDIR)
119		@$(ECHO_CURDIR)
120ifdef	SOLUTION
121		$(DEVENV) $(SOLUTION) /clean $(RVLDWC_BUILDNAME)
122		-$(RM) $(CLEAN_DIRS)
123endif
124
125
126#----------------------------------------------------------------------------
127#  make clobber
128#----------------------------------------------------------------------------
129
130clobber:
131		@$(MAKE_SUBDIR)
132		@$(ECHO_CURDIR)
133ifdef	SOLUTION
134		$(DEVENV) $(SOLUTION) /clean Debug
135		$(DEVENV) $(SOLUTION) /clean Release
136ifneq	($(CLOBBER_INSTALLED),)
137		-$(RM) $(CLOBBER_INSTALLED)
138endif
139		-$(RM) $(CLOBBER_DIRS)
140endif
141
142
143endif	# RVLDWC_MODULERULES_VC_
144#----- End of modulerules -----
145