blob: 27892f74d096b56c8440c898e0af73e876b8cf4e [file] [log] [blame]
wdenk34b613e2002-12-17 01:51:00 +00001#
Marian Balakowiczd62379d2006-09-01 19:49:50 +02002# (C) Copyright 2002-2006
wdenk34b613e2002-12-17 01:51:00 +00003# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
wdenk34b613e2002-12-17 01:51:00 +00006#
7
Marian Balakowiczd62379d2006-09-01 19:49:50 +02008include $(TOPDIR)/config.mk
wdenk34b613e2002-12-17 01:51:00 +00009
Andreas Bießmannb42e76b2011-10-17 22:11:12 +000010HOSTSRCS := $(SRCTREE)/lib/crc32.c fw_env.c fw_env_main.c
Joe Hershbergerdd7750a2012-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 Rinicfd1e542012-12-20 07:30:27 -070013HEADERS := fw_env.h $(OBJTREE)/include/config.h
wdenk34b613e2002-12-17 01:51:00 +000014
Daniel Hobi4683c4b2010-11-10 14:11:21 +010015# Compile for a hosted environment on the target
16HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \
Masahiro Yamada49a88e32013-11-01 10:28:45 +090017 -idirafter $(SRCTREE)/arch/$(ARCH)/include \
Wolfgang Denk302141d2010-11-27 23:30:56 +010018 -idirafter $(OBJTREE)/include \
Joe Hershbergerdd7750a2012-12-11 22:16:32 -060019 -idirafter $(SRCTREE)/tools/env \
Joe Hershberger671adc42012-10-03 09:38:46 +000020 -DUSE_HOSTCC \
21 -DTEXT_BASE=$(TEXT_BASE)
Marian Balakowiczd62379d2006-09-01 19:49:50 +020022
Markus Klotzbücher94db5572007-11-27 10:23:20 +010023ifeq ($(MTD_VERSION),old)
Daniel Hobi4683c4b2010-11-10 14:11:21 +010024HOSTCPPFLAGS += -DMTD_OLD
Markus Klotzbücher94db5572007-11-27 10:23:20 +010025endif
26
Marian Balakowiczd62379d2006-09-01 19:49:50 +020027all: $(obj)fw_printenv
28
Daniel Hobi4683c4b2010-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 Minier0d834332012-03-11 16:43:02 +010032 $(HOSTSTRIP) $@
wdenk34b613e2002-12-17 01:51:00 +000033
34clean:
Andreas Bießmannb42e76b2011-10-17 22:11:12 +000035 rm -f $(obj)fw_printenv
wdenk34b613e2002-12-17 01:51:00 +000036
37#########################################################################
38
Marian Balakowiczd62379d2006-09-01 19:49:50 +020039include $(TOPDIR)/rules.mk
wdenk34b613e2002-12-17 01:51:00 +000040
Marian Balakowiczd62379d2006-09-01 19:49:50 +020041sinclude $(obj).depend
wdenk34b613e2002-12-17 01:51:00 +000042
43#########################################################################