1#! make -f
2#---------------------------------------------------------------------------
3#  Project:  NitroSDK - tools - makelcf
4#  File:     Makefile
5#
6#  Copyright 2003-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#  $Log: Makefile,v $
15#  Revision 1.8  2004/10/03 09:41:52  yasu
16#  Fix for make clobber
17#
18#  Revision 1.7  2004/09/02 12:46:11  yasu
19#  Add dependancies
20#
21#  Revision 1.6  2004/08/05 02:20:22  yasu
22#  Expand scanner buffer size
23#
24#  Revision 1.5  2004/07/15 05:20:53  yasu
25#  Support showing version number at help screen
26#
27#  Revision 1.4  2004/03/26 05:07:11  yasu
28#  support variables like as -DNAME=VALUE
29#
30#  Revision 1.3  2004/02/05 07:09:03  yasu
31#  change SDK prefix iris -> nitro
32#
33#  Revision 1.2  2004/01/18 06:32:26  nishida_kenji
34#  small fix in dependency
35#
36#  Revision 1.1  2004/01/05 02:32:59  yasu
37#  Initial version
38#
39#  $NoKeywords: $
40#---------------------------------------------------------------------------
41
42TARGET_PLATFORM    =   NITRO
43
44include	$(TWLSDK_ROOT)/build/buildtools/commondefs
45
46TARGETS		= makelcf.exe
47
48SOURCES_C	= makelcf.c defval.c misc.c container.c createlcf.c version.c
49
50SOURCES		= $(SOURCES_C) spec.l spec.y tlcf.l tlcf.y
51
52OBJECTS		= $(SOURCES_C:.c=.o)			\
53			  spec.tab.o spec.yy.patched.o	\
54			  tlcf.tab.o tlcf.yy.o
55
56HEADERS		= defval.h makelcf.h misc.h
57
58INSTALL_DIR     = $(TWL_INSTALL_TOOLSDIR)/bin
59INSTALL_TARGETS	= $(TARGETS)
60
61LDIRT_CLEAN	= $(OBJECTS) $(TARGETS) version.c					\
62			  spec.tab.c spec.tab.h spec.yy.c spec.yy.patched.c \
63			  tlcf.tab.c tlcf.tab.h tlcf.yy.c
64
65MACROS	+=	-DSDK_NITRO
66
67include	$(TWLSDK_ROOT)/build/buildtools/modulerules.x86
68
69#----------------------------------------------------------------------------
70#  build
71#----------------------------------------------------------------------------
72do-build:		$(TARGETS)
73
74$(TARGETS):		$(OBJECTS)
75			$(CC_X86) $+ -o $@
76
77makelcf.o:			makelcf.c makelcf.h version.c
78container.o:		container.c makelcf.h
79createlcf.o:		createlcf.c makelcf.h tlcf.tab.c
80defval.o:			defval.c misc.h defval.h makelcf.h
81misc.o:				misc.c misc.h defval.h makelcf.h
82
83spec.tab.o:			spec.tab.c makelcf.h
84spec.yy.patched.o:	spec.yy.patched.c spec.tab.c makelcf.h
85spec.yy.c:			spec.l spec.tab.c
86spec.tab.c:         spec.y
87tlcf.yy.o:			tlcf.yy.c tlcf.tab.c makelcf.h
88tlcf.yy.c:			tlcf.l
89tlcf.tab.c:       	tlcf.y
90
91spec.yy.patched.o:	WARNING	+= -Wno-unused-label -Wno-unused-function
92
93spec.yy.patched.c:	spec.yy.c
94			sed 's/^#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (1024*1024)/' $< > $@
95
96version.c:		$(filter-out version.c,$(SOURCES)) $(HEADERS) $(MAKEFILE)
97			@for i in $^ ;				\
98			do							\
99				date -r $$i +'const unsigned long SDK_DATE_OF_LATEST_FILE=%Y%m%dUL;';	\
100			done | sort | tail -1 > $@
101