xref: /openbmc/u-boot/tools/env/Makefile (revision 63e22517)
1# SPDX-License-Identifier: GPL-2.0+
2#
3# (C) Copyright 2002-2006
4# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5
6# 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.
9override HOSTCC = $(CC)
10
11# Compile for a hosted environment on the target
12HOST_EXTRACFLAGS  = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
13		-idirafter $(srctree)/tools/env \
14		-DUSE_HOSTCC \
15		-DTEXT_BASE=$(TEXT_BASE)
16
17ifeq ($(MTD_VERSION),old)
18HOST_EXTRACFLAGS += -DMTD_OLD
19endif
20
21always := fw_printenv
22hostprogs-y := fw_printenv
23
24lib-y += fw_env.o \
25	crc32.o ctype.o linux_string.o \
26	env_attr.o env_flags.o
27
28fw_printenv-objs := fw_env_main.o $(lib-y)
29
30quiet_cmd_crosstools_strip = STRIP   $^
31      cmd_crosstools_strip = $(STRIP) $^; touch $@
32
33$(obj)/.strip: $(obj)/fw_printenv
34	$(call cmd,crosstools_strip)
35
36always += .strip
37