Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
wdenk | 6aff311 | 2002-12-17 01:51:00 +0000 | [diff] [blame] | 2 | # |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 3 | # (C) Copyright 2002-2006 |
wdenk | 6aff311 | 2002-12-17 01:51:00 +0000 | [diff] [blame] | 4 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
wdenk | 6aff311 | 2002-12-17 01:51:00 +0000 | [diff] [blame] | 5 | |
Masahiro Yamada | 79fc0c5 | 2014-02-04 17:24:45 +0900 | [diff] [blame] | 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. |
Masahiro Yamada | 3b08252 | 2017-03-13 17:43:16 +0900 | [diff] [blame] | 9 | override HOSTCC = $(CC) |
Masahiro Yamada | 79fc0c5 | 2014-02-04 17:24:45 +0900 | [diff] [blame] | 10 | |
Daniel Hobi | 02bd475 | 2010-11-10 14:11:21 +0100 | [diff] [blame] | 11 | # Compile for a hosted environment on the target |
Matt Weber | e1df3fa | 2018-07-26 22:37:53 -0500 | [diff] [blame] | 12 | HOST_EXTRACFLAGS = -I$(srctree)/tools \ |
| 13 | $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \ |
Masahiro Yamada | 0128632 | 2014-03-11 11:05:20 +0900 | [diff] [blame] | 14 | -idirafter $(srctree)/tools/env \ |
Joe Hershberger | 497f205 | 2012-10-03 09:38:46 +0000 | [diff] [blame] | 15 | -DUSE_HOSTCC \ |
| 16 | -DTEXT_BASE=$(TEXT_BASE) |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 17 | |
Markus Klotzbücher | 6de66b3 | 2007-11-27 10:23:20 +0100 | [diff] [blame] | 18 | ifeq ($(MTD_VERSION),old) |
Masahiro Yamada | 940db16 | 2014-02-04 17:24:10 +0900 | [diff] [blame] | 19 | HOST_EXTRACFLAGS += -DMTD_OLD |
Markus Klotzbücher | 6de66b3 | 2007-11-27 10:23:20 +0100 | [diff] [blame] | 20 | endif |
| 21 | |
Masahiro Yamada | 79fc0c5 | 2014-02-04 17:24:45 +0900 | [diff] [blame] | 22 | always := fw_printenv |
Thomas Petazzoni | bdc7dc4 | 2014-08-27 14:29:00 +0200 | [diff] [blame] | 23 | hostprogs-y := fw_printenv |
Marian Balakowicz | f932863 | 2006-09-01 19:49:50 +0200 | [diff] [blame] | 24 | |
Stefano Babic | 2cb11b3 | 2015-10-30 14:57:04 +0100 | [diff] [blame] | 25 | lib-y += fw_env.o \ |
Masahiro Yamada | 940db16 | 2014-02-04 17:24:10 +0900 | [diff] [blame] | 26 | crc32.o ctype.o linux_string.o \ |
Tom Rini | c6831c7 | 2017-11-14 08:39:35 -0500 | [diff] [blame] | 27 | env_attr.o env_flags.o |
Masahiro Yamada | 79fc0c5 | 2014-02-04 17:24:45 +0900 | [diff] [blame] | 28 | |
Stefano Babic | 2cb11b3 | 2015-10-30 14:57:04 +0100 | [diff] [blame] | 29 | fw_printenv-objs := fw_env_main.o $(lib-y) |
| 30 | |
Thomas Petazzoni | bdc7dc4 | 2014-08-27 14:29:00 +0200 | [diff] [blame] | 31 | quiet_cmd_crosstools_strip = STRIP $^ |
| 32 | cmd_crosstools_strip = $(STRIP) $^; touch $@ |
Masahiro Yamada | 79fc0c5 | 2014-02-04 17:24:45 +0900 | [diff] [blame] | 33 | |
Thomas Petazzoni | bdc7dc4 | 2014-08-27 14:29:00 +0200 | [diff] [blame] | 34 | $(obj)/.strip: $(obj)/fw_printenv |
| 35 | $(call cmd,crosstools_strip) |
| 36 | |
| 37 | always += .strip |