2009-04-28 17:04:02 +00:00
|
|
|
#
|
|
|
|
# (C) Copyright 2009 Marco Stornelli <marco.stornelli@gmail.com>
|
|
|
|
#
|
2013-07-08 07:37:19 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2009-04-28 17:04:02 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
include $(TOPDIR)/config.mk
|
|
|
|
|
|
|
|
# Generated executable files
|
|
|
|
BIN_FILES-y += imls
|
|
|
|
|
|
|
|
# Source files which exist outside the tools/imls directory
|
2010-04-13 03:28:05 +00:00
|
|
|
EXT_OBJ_FILES-y += lib/crc32.o
|
|
|
|
EXT_OBJ_FILES-y += lib/md5.o
|
|
|
|
EXT_OBJ_FILES-y += lib/sha1.o
|
2009-04-28 17:04:02 +00:00
|
|
|
EXT_OBJ_FILES-y += common/image.o
|
|
|
|
|
|
|
|
# Source files located in the tools/imls directory
|
|
|
|
OBJ_FILES-y += imls.o
|
|
|
|
|
|
|
|
# Flattened device tree objects
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_ro.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_rw.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_strerror.o
|
|
|
|
LIBFDT_OBJ_FILES-y += fdt_wip.o
|
|
|
|
|
|
|
|
# now $(obj) is defined
|
|
|
|
SRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
|
|
|
|
SRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
|
2010-04-13 03:28:06 +00:00
|
|
|
SRCS += $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
|
2009-04-28 17:04:02 +00:00
|
|
|
BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y)))
|
|
|
|
LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
|
|
|
|
|
|
|
|
#
|
2009-11-05 00:41:41 +00:00
|
|
|
# Compile for a hosted environment on the target
|
2009-04-28 17:04:02 +00:00
|
|
|
# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
|
|
|
|
#
|
2009-11-05 00:41:41 +00:00
|
|
|
HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \
|
2013-11-01 01:28:45 +00:00
|
|
|
-idirafter $(SRCTREE)/arch/$(ARCH)/include \
|
2009-04-28 17:04:02 +00:00
|
|
|
-idirafter $(OBJTREE)/include \
|
2013-10-04 15:43:24 +00:00
|
|
|
-I $(SRCTREE)/lib/libfdt \
|
2009-04-28 17:04:02 +00:00
|
|
|
-I $(SRCTREE)/tools \
|
|
|
|
-DUSE_HOSTCC -D__KERNEL_STRICT_NAMES
|
|
|
|
|
|
|
|
ifeq ($(MTD_VERSION),old)
|
2009-11-05 00:41:41 +00:00
|
|
|
HOSTCPPFLAGS += -DMTD_OLD
|
2009-04-28 17:04:02 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
all: $(BINS)
|
|
|
|
|
|
|
|
$(obj)imls: $(obj)imls.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
|
|
|
|
$(obj)sha1.o $(LIBFDT_OBJS)
|
2009-11-05 00:41:41 +00:00
|
|
|
$(CC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
|
2009-04-28 17:04:02 +00:00
|
|
|
$(STRIP) $@
|
|
|
|
|
2010-10-11 16:03:35 +00:00
|
|
|
# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
|
2009-04-28 17:04:02 +00:00
|
|
|
$(obj)image.o: $(SRCTREE)/common/image.c
|
2009-11-05 00:41:41 +00:00
|
|
|
$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
|
2009-04-28 17:04:02 +00:00
|
|
|
|
2009-11-05 00:41:41 +00:00
|
|
|
$(obj)imls.o: $(SRCTREE)/tools/imls/imls.c
|
|
|
|
$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
|
2009-04-28 17:04:02 +00:00
|
|
|
|
|
|
|
# Some of the tool objects need to be accessed from outside the tools/imls directory
|
|
|
|
$(obj)%.o: $(SRCTREE)/common/%.c
|
2009-11-05 00:41:41 +00:00
|
|
|
$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
|
2009-04-28 17:04:02 +00:00
|
|
|
|
2010-04-13 03:28:05 +00:00
|
|
|
$(obj)%.o: $(SRCTREE)/lib/%.c
|
2009-11-05 00:41:41 +00:00
|
|
|
$(CC) -g $(HOSTCFLAGS) -c -o $@ $<
|
2009-04-28 17:04:02 +00:00
|
|
|
|
2010-04-13 03:28:06 +00:00
|
|
|
$(obj)%.o: $(SRCTREE)/lib/libfdt/%.c
|
2009-11-05 00:41:41 +00:00
|
|
|
$(CC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
|
2009-04-28 17:04:02 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf *.o imls
|
|
|
|
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# defines $(obj).depend target
|
|
|
|
include $(SRCTREE)/rules.mk
|
|
|
|
|
|
|
|
sinclude $(obj).depend
|
|
|
|
|
|
|
|
#########################################################################
|