blob: 4633e0e72ba294817bd472da4f4981beaae22363 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001# SPDX-License-Identifier: GPL-2.0+
wdenk34b613e2002-12-17 01:51:00 +00002#
Marian Balakowiczd62379d2006-09-01 19:49:50 +02003# (C) Copyright 2002-2006
wdenk34b613e2002-12-17 01:51:00 +00004# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenk34b613e2002-12-17 01:51:00 +00005
Masahiro Yamada9563d572014-02-04 17:24:45 +09006# fw_printenv is supposed to run on the target system, which means it should be
7# built with cross tools. Although it may look weird, we only replace "HOSTCC"
8# with "CC" here for the maximum code reuse of scripts/Makefile.host.
Masahiro Yamada00b613b2017-03-13 17:43:16 +09009override HOSTCC = $(CC)
Masahiro Yamada9563d572014-02-04 17:24:45 +090010
Daniel Hobi4683c4b2010-11-10 14:11:21 +010011# Compile for a hosted environment on the target
Masahiro Yamada60bb7342014-07-30 14:08:17 +090012HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
Masahiro Yamadaff517042014-03-11 11:05:20 +090013 -idirafter $(srctree)/tools/env \
Joe Hershberger671adc42012-10-03 09:38:46 +000014 -DUSE_HOSTCC \
15 -DTEXT_BASE=$(TEXT_BASE)
Marian Balakowiczd62379d2006-09-01 19:49:50 +020016
Markus Klotzbücher94db5572007-11-27 10:23:20 +010017ifeq ($(MTD_VERSION),old)
Masahiro Yamadaf2431802014-02-04 17:24:10 +090018HOST_EXTRACFLAGS += -DMTD_OLD
Markus Klotzbücher94db5572007-11-27 10:23:20 +010019endif
20
Masahiro Yamada9563d572014-02-04 17:24:45 +090021always := fw_printenv
Thomas Petazzoni66be1ae2014-08-27 14:29:00 +020022hostprogs-y := fw_printenv
wdenk34b613e2002-12-17 01:51:00 +000023
Stefano Babicb7c3b3f2015-10-30 14:57:04 +010024lib-y += fw_env.o \
Masahiro Yamadaf2431802014-02-04 17:24:10 +090025 crc32.o ctype.o linux_string.o \
Tom Rini6b6ee8a2017-11-14 08:39:35 -050026 env_attr.o env_flags.o
Masahiro Yamada9563d572014-02-04 17:24:45 +090027
Stefano Babicb7c3b3f2015-10-30 14:57:04 +010028fw_printenv-objs := fw_env_main.o $(lib-y)
29
Thomas Petazzoni66be1ae2014-08-27 14:29:00 +020030quiet_cmd_crosstools_strip = STRIP $^
31 cmd_crosstools_strip = $(STRIP) $^; touch $@
32
33$(obj)/.strip: $(obj)/fw_printenv
34 $(call cmd,crosstools_strip)
Masahiro Yamada9563d572014-02-04 17:24:45 +090035
Thomas Petazzoni66be1ae2014-08-27 14:29:00 +020036always += .strip