blob: 27892f74d096b56c8440c898e0af73e876b8cf4e [file] [log] [blame]
wdenk6aff3112002-12-17 01:51:00 +00001#
Marian Balakowiczf9328632006-09-01 19:49:50 +02002# (C) Copyright 2002-2006
wdenk6aff3112002-12-17 01:51:00 +00003# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
Wolfgang Denk1a459662013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
wdenk6aff3112002-12-17 01:51:00 +00006#
7
Marian Balakowiczf9328632006-09-01 19:49:50 +02008include $(TOPDIR)/config.mk
wdenk6aff3112002-12-17 01:51:00 +00009
Andreas Bießmanndca61f02011-10-17 22:11:12 +000010HOSTSRCS := $(SRCTREE)/lib/crc32.c fw_env.c fw_env_main.c
Joe Hershberger30fd4fad2012-12-11 22:16:32 -060011HOSTSRCS += $(SRCTREE)/lib/ctype.c $(SRCTREE)/lib/linux_string.c
12HOSTSRCS += $(SRCTREE)/common/env_attr.c $(SRCTREE)/common/env_flags.c
Tom Rinie3c52f22012-12-20 07:30:27 -070013HEADERS := fw_env.h $(OBJTREE)/include/config.h
wdenk6aff3112002-12-17 01:51:00 +000014
Daniel Hobi02bd4752010-11-10 14:11:21 +010015# Compile for a hosted environment on the target
16HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \
Masahiro Yamadabb02c532013-11-01 10:28:45 +090017 -idirafter $(SRCTREE)/arch/$(ARCH)/include \
Wolfgang Denk844f07d2010-11-27 23:30:56 +010018 -idirafter $(OBJTREE)/include \
Joe Hershberger30fd4fad2012-12-11 22:16:32 -060019 -idirafter $(SRCTREE)/tools/env \
Joe Hershberger497f2052012-10-03 09:38:46 +000020 -DUSE_HOSTCC \
21 -DTEXT_BASE=$(TEXT_BASE)
Marian Balakowiczf9328632006-09-01 19:49:50 +020022
Markus Klotzbücher6de66b32007-11-27 10:23:20 +010023ifeq ($(MTD_VERSION),old)
Daniel Hobi02bd4752010-11-10 14:11:21 +010024HOSTCPPFLAGS += -DMTD_OLD
Markus Klotzbücher6de66b32007-11-27 10:23:20 +010025endif
26
Marian Balakowiczf9328632006-09-01 19:49:50 +020027all: $(obj)fw_printenv
28
Daniel Hobi02bd4752010-11-10 14:11:21 +010029# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
30$(obj)fw_printenv: $(HOSTSRCS) $(HEADERS)
31 $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS)
Loïc Minier3648ff22012-03-11 16:43:02 +010032 $(HOSTSTRIP) $@
wdenk6aff3112002-12-17 01:51:00 +000033
34clean:
Andreas Bießmanndca61f02011-10-17 22:11:12 +000035 rm -f $(obj)fw_printenv
wdenk6aff3112002-12-17 01:51:00 +000036
37#########################################################################
38
Marian Balakowiczf9328632006-09-01 19:49:50 +020039include $(TOPDIR)/rules.mk
wdenk6aff3112002-12-17 01:51:00 +000040
Marian Balakowiczf9328632006-09-01 19:49:50 +020041sinclude $(obj).depend
wdenk6aff3112002-12-17 01:51:00 +000042
43#########################################################################