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 # Generated executable files
25 # Source files which exist outside the tools/imls directory
26 EXT_OBJ_FILES-y += lib/crc32.o
27 EXT_OBJ_FILES-y += lib/md5.o
28 EXT_OBJ_FILES-y += lib/sha1.o
29 EXT_OBJ_FILES-y += common/image.o
31 # Source files located in the tools/imls directory
34 # Flattened device tree objects
35 LIBFDT_OBJ_FILES-y += fdt.o
36 LIBFDT_OBJ_FILES-y += fdt_ro.o
37 LIBFDT_OBJ_FILES-y += fdt_rw.o
38 LIBFDT_OBJ_FILES-y += fdt_strerror.o
39 LIBFDT_OBJ_FILES-y += fdt_wip.o
41 # now $(obj) is defined
42 SRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
43 SRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
44 SRCS += $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
45 BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y)))
46 LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
49 # Compile for a hosted environment on the target
50 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
52 HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \
53 -idirafter $(OBJTREE)/include2 \
54 -idirafter $(OBJTREE)/include \
55 -I $(SRCTREE)/lib/libfdt \
57 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES
59 ifeq ($(MTD_VERSION),old)
60 HOSTCPPFLAGS += -DMTD_OLD
65 $(obj)imls: $(obj)imls.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
66 $(obj)sha1.o $(LIBFDT_OBJS)
67 $(CC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
70 # Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
71 $(obj)image.o: $(SRCTREE)/common/image.c
72 $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
74 $(obj)imls.o: $(SRCTREE)/tools/imls/imls.c
75 $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
77 # Some of the tool objects need to be accessed from outside the tools/imls directory
78 $(obj)%.o: $(SRCTREE)/common/%.c
79 $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
81 $(obj)%.o: $(SRCTREE)/lib/%.c
82 $(CC) -g $(HOSTCFLAGS) -c -o $@ $<
84 $(obj)%.o: $(SRCTREE)/lib/libfdt/%.c
85 $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
90 #########################################################################
92 # defines $(obj).depend target
93 include $(SRCTREE)/rules.mk
95 sinclude $(obj).depend
97 #########################################################################