]> git.ipfire.org Git - people/ms/u-boot.git/blob - tools/imls/Makefile
0caa397b20df30cf8f3c6706909cb3aa59354766
[people/ms/u-boot.git] / tools / imls / Makefile
1 #
2 # (C) Copyright 2009 Marco Stornelli <marco.stornelli@gmail.com>
3 #
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.
8 #
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.
13 #
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,
17 # MA 02111-1307 USA
18 #
19
20 include $(TOPDIR)/config.mk
21
22 # Generated executable files
23 BIN_FILES-y += imls
24
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
30
31 # Source files located in the tools/imls directory
32 OBJ_FILES-y += imls.o
33
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
40
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))
47
48 #
49 # Compile for a hosted environment on the target
50 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
51 #
52 HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \
53 -idirafter $(OBJTREE)/include2 \
54 -idirafter $(OBJTREE)/include \
55 -I $(SRCTREE)/lib/libfdt \
56 -I $(SRCTREE)/tools \
57 -DUSE_HOSTCC -D__KERNEL_STRICT_NAMES
58
59 ifeq ($(MTD_VERSION),old)
60 HOSTCPPFLAGS += -DMTD_OLD
61 endif
62
63 all: $(BINS)
64
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 $@ $^
68 $(STRIP) $@
69
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 $@ $<
73
74 $(obj)imls.o: $(SRCTREE)/tools/imls/imls.c
75 $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
76
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 $@ $<
80
81 $(obj)%.o: $(SRCTREE)/lib/%.c
82 $(CC) -g $(HOSTCFLAGS) -c -o $@ $<
83
84 $(obj)%.o: $(SRCTREE)/lib/libfdt/%.c
85 $(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
86
87 clean:
88 rm -rf *.o imls
89
90 #########################################################################
91
92 # defines $(obj).depend target
93 include $(SRCTREE)/rules.mk
94
95 sinclude $(obj).depend
96
97 #########################################################################