1#! make -f
2#---------------------------------------------------------------------------
3#  Project:  TwlSDK - tools - bin2obj
4#  File:     Makefile
5#
6#  Copyright 2005-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: 8573 $
16#  $Author: okubata_ryoma $
17#---------------------------------------------------------------------------
18TARGET_PLATFORM	 = NITRO TWL
19
20include $(TWLSDK_ROOT)/build/buildtools/commondefs
21
22TARGETS			 = bin2obj.exe
23
24SOURCES			 = bin2obj.c	\
25				   cookargs.c	\
26				   section.c	\
27				   object.c		\
28				   output.c		\
29				   version.c
30
31OBJECTS			 = $(SOURCES:.c=.o)
32HEADERS			 = $(filter-out version.h,$(wildcard *.h))
33
34INSTALL_DIR		 = $(TWL_INSTALL_TOOLSDIR)/bin
35INSTALL_TARGETS	 = $(TARGETS)
36
37LDIRT_CLEAN		 = $(OBJECTS) $(TARGETS) version.c
38
39include $(TWLSDK_ROOT)/build/buildtools/modulerules.x86
40
41#----------------------------------------------------------------------------
42#  build
43#----------------------------------------------------------------------------
44do-build:		$(TARGETS)
45
46$(TARGETS):		$(OBJECTS)
47			$(CC_X86) $+ -o $@
48
49bin2obj.o:		bin2obj.c bin2obj.h
50cookargs.o:		cookargs.c bin2obj.h version.c
51section.o:		section.c bin2obj.h
52object.o:		object.c bin2obj.h
53output.o:		output.c bin2obj.h
54bin2obj.h:		elf.h object.h types.h
55
56version.c:		$(filter-out version.c,$(SOURCES)) $(HEADERS) $(MAKEFILE)
57			@for i in $^ ;			\
58			do				\
59				date -r $$i +'const unsigned long SDK_DATE_OF_LATEST_FILE=%Y%m%dUL;'; \
60			done | sort | tail -1 > $@
61#
62