2 # (C) Copyright 2009 Marco Stornelli <marco.stornelli@gmail.com>
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 2 of
7 # the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 include $(TOPDIR)/config.mk
22 HOSTCFLAGS = -Wall -pedantic
24 # Generated executable files
27 # Source files which exist outside the tools/imls directory
28 EXT_OBJ_FILES-y += lib_generic/crc32.o
29 EXT_OBJ_FILES-y += lib_generic/md5.o
30 EXT_OBJ_FILES-y += lib_generic/sha1.o
31 EXT_OBJ_FILES-y += common/image.o
33 # Source files located in the tools/imls directory
36 # Flattened device tree objects
37 LIBFDT_OBJ_FILES-y += fdt.o
38 LIBFDT_OBJ_FILES-y += fdt_ro.o
39 LIBFDT_OBJ_FILES-y += fdt_rw.o
40 LIBFDT_OBJ_FILES-y += fdt_strerror.o
41 LIBFDT_OBJ_FILES-y += fdt_wip.o
43 # now $(obj) is defined
44 SRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
45 SRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
46 SRCS += $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
47 BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y)))
48 LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
51 # Use native tools and options
52 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
54 CPPFLAGS = -idirafter $(SRCTREE)/include \
55 -idirafter $(OBJTREE)/include2 \
56 -idirafter $(OBJTREE)/include \
57 -I $(SRCTREE)/libfdt \
59 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES
60 CFLAGS = $(HOSTCFLAGS) $(CPPFLAGS) -O
62 # No -pedantic switch to avoid libfdt compilation warnings
63 FIT_CFLAGS = -Wall $(CPPFLAGS) -O
65 CC = $(CROSS_COMPILER)gcc
66 STRIP = $(CROSS_COMPILER)strip
68 ifeq ($(MTD_VERSION),old)
74 $(obj)imls: $(obj)imls.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
75 $(obj)sha1.o $(LIBFDT_OBJS)
76 $(CC) $(CFLAGS) -o $@ $^
79 # Some files complain if compiled with -pedantic, use FIT_CFLAGS
80 $(obj)image.o: $(SRCTREE)/common/image.c
81 $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
84 $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
86 # Some of the tool objects need to be accessed from outside the tools/imls directory
87 $(obj)%.o: $(SRCTREE)/common/%.c
88 $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
90 $(obj)%.o: $(SRCTREE)/lib_generic/%.c
91 $(CC) -g $(CFLAGS) -c -o $@ $<
93 $(obj)%.o: $(SRCTREE)/libfdt/%.c
94 $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
99 #########################################################################
101 # defines $(obj).depend target
102 include $(SRCTREE)/rules.mk
104 sinclude $(obj).depend
106 #########################################################################