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