1#! make -f
2#---------------------------------------------------------------------------
3#  Project:  RevolutionSDK Extensions - tools - bmerge
4#  File:     Makefile
5#
6#  Copyright 2006,2007 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#  $Log: Makefile,v $
15#  Revision 1.3  2007/06/14 01:28:23  adachi_hiroaki
16#  Added support for "require"; reintegrated with chanscc.exe
17#
18#  Revision 1.2  2007/06/14 00:56:26  adachi_hiroaki
19#  Added support for the code as of 6/12
20#
21#  Revision 1.1  2007/06/08 09:28:10  adachi_hiroaki
22#  Added a build system for compiling NWC24 scripts.
23#  (VisualStudio is required, so builds are not performed automatically. The source also refers to the main tree.)
24#
25#  $NoKeywords: $
26#---------------------------------------------------------------------------
27
28.PHONY: all build install clobber clean
29
30all: build
31#install
32
33CC		= cl
34LD		= cl
35
36IPL_ROOT	= $(subst \,/,$(RVL_IPL_ROOT))
37
38TARGET		= chanscc
39HEADERS		=
40MAKEFILE	= $(firstword $(MAKEFILELIST))
41LDIRT_CLEAN	= $(OBJECTS) $(TARGETS)
42LINCLUDES	= -I$(IPL_ROOT)/ChannelScript/common -I$(IPL_ROOT)/ChannelScript/compiler
43LCFLAGS         = -D__STDC__ -RTCs -DCHANS_SUPPORT_FLOAT
44CHANS_ROOT	= $(IPL_ROOT)/ChannelScript
45
46
47vpath %.c $(CHANS_ROOT)/common
48vpath %   $(CHANS_ROOT)/compiler
49
50REVOLUTION_EXT_INSTALL_ROOT	?= $(REVOLUTION_EXT_ROOT)
51INSTALL_DIR    := $(shell cygpath -u $(REVOLUTION_EXT_INSTALL_ROOT))/X86/bin/NWC24
52
53#----------------------------------------------------------------------------
54#  build
55#----------------------------------------------------------------------------
56
57build:		$(TARGET)
58
59$(TARGET):	vm.obj chanscc.obj
60		$(LD) -Fe$(@) $(?)
61
62vm.obj: $(CHANS_ROOT)/common/vm.c
63		$(CC) -c $(LINCLUDES) $(LCFLAGS) $(<) -Fo$(@)
64chanscc.obj:	chanscc.c
65
66yacc.y: 	$(CHANS_ROOT)/compiler/yacc.y
67		install $(<) $(@)
68
69chanscc.c:	yacc.y
70		bison $(<) -o $(@)
71
72%.obj: %.c
73		$(CC) -c $(LINCLUDES) $(LCFLAGS) $(<) -Fo$(@)
74
75clean:
76		rm -f *.obj *.exe *.c *.y
77
78clobber: clean
79		rm -f $(INSTALL_DIR)/X86/bin/$(TARGET)
80
81install: build
82		install -Dp $(TARGET) $(INSTALL_DIR)
83		install -Dp $(CHANS_ROOT)/compiler/chanscc.kwh $(INSTALL_DIR)
84		install -Dp $(CHANS_ROOT)/compiler/chansccNF.kwh $(INSTALL_DIR)
85