From: Masahiro Yamada <masahiroy@kernel.org>
To: barebox@lists.infradead.org
Cc: Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 3/3] scripts: use 'userprogs' to build programs for target
Date: Tue, 23 Jun 2020 12:07:02 +0900 [thread overview]
Message-ID: <20200623030702.666462-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20200623030702.666462-1-masahiroy@kernel.org>
Use 'userprogs' syntax to build standalone programs for the target
architecture (i.e. the same architecture as the barebox).
This changes the compiler flags passed to the target programs.
Previously, it used $(KBUILD_CFLAGS), which contains the same compiler
flags as used for the barebox space.
Going forward, it will use $(KBUILD_USERCFLAGS), which contains smaller
set of compiler flags because there is no need to add low-level options
for userspace builds.
The shortlog will be annotated with [U].
CC [U] scripts/bareboxenv-target
CC [U] scripts/kernel-install-target
CC [U] scripts/bareboxcrc32-target
CC [U] scripts/bareboximd-target
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/Makefile | 29 ++++++++++-------------------
scripts/bareboxcrc32-target.c | 1 +
scripts/bareboxenv-target.c | 1 +
scripts/bareboximd-target.c | 1 +
scripts/kernel-install-target.c | 1 +
5 files changed, 14 insertions(+), 19 deletions(-)
create mode 100644 scripts/bareboxcrc32-target.c
create mode 100644 scripts/bareboxenv-target.c
create mode 100644 scripts/bareboximd-target.c
create mode 100644 scripts/kernel-install-target.c
diff --git a/scripts/Makefile b/scripts/Makefile
index f3b9aece9..75e68822d 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -35,30 +35,21 @@ HOSTCFLAGS_omap4_usbboot.o = `pkg-config --cflags libusb-1.0`
HOSTLDLIBS_omap4_usbboot = -lpthread `pkg-config --libs libusb-1.0`
hostprogs-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT) += omap4_usbboot
+userprogs-$(CONFIG_BAREBOXENV_TARGET) += bareboxenv-target
+userprogs-$(CONFIG_KERNEL_INSTALL_TARGET) += kernel-install-target
+userprogs-$(CONFIG_BAREBOXCRC32_TARGET) += bareboxcrc32-target
+userprogs-$(CONFIG_IMD_TARGET) += bareboximd-target
+
+userccflags += -I $(srctree)/$(src)/include
+
+userprogs := $(userprogs-y)
+always-y := $(hostprogs-y) $(hostprogs-m) $(userprogs-y)
+
subdir-y += mod
subdir-y += imx
subdir-$(CONFIG_X86) += setupmbr
subdir-$(CONFIG_DTC) += dtc
subdir-$(CONFIG_ARCH_TEGRA) += tegra
-targetprogs-$(CONFIG_BAREBOXENV_TARGET) += bareboxenv-target
-targetprogs-$(CONFIG_KERNEL_INSTALL_TARGET) += kernel-install-target
-targetprogs-$(CONFIG_BAREBOXCRC32_TARGET) += bareboxcrc32-target
-targetprogs-$(CONFIG_IMD_TARGET) += bareboximd-target
-
# Let clean descend into subdirs
subdir- += basic kconfig setupmbr
-
-quiet_cmd_csingle = CC $@
- cmd_csingle = $(CC) -Wp,-MD,$(depfile) $(TARGETCFLAGS) $(KBUILD_CFLAGS) -o $@ $<
-
-__targetprogs := $(sort $(targetprogs-y) $(targetprogs-m))
-target-csingle := $(foreach m,$(__targetprogs),$(if $($(m)-objs),,$(m)))
-__targetprogs := $(addprefix $(obj)/,$(__targetprogs))
-target-csingle := $(addprefix $(obj)/,$(target-csingle))
-TARGETCFLAGS += -I$(srctree)/scripts/include/
-
-always := $(hostprogs-y) $(hostprogs-m) $(targetprogs-y)
-
-$(target-csingle): %-target: %.c FORCE
- $(call if_changed_dep,csingle)
diff --git a/scripts/bareboxcrc32-target.c b/scripts/bareboxcrc32-target.c
new file mode 100644
index 000000000..6c09c9f76
--- /dev/null
+++ b/scripts/bareboxcrc32-target.c
@@ -0,0 +1 @@
+#include "bareboxcrc32.c"
diff --git a/scripts/bareboxenv-target.c b/scripts/bareboxenv-target.c
new file mode 100644
index 000000000..caf175920
--- /dev/null
+++ b/scripts/bareboxenv-target.c
@@ -0,0 +1 @@
+#include "bareboxenv.c"
diff --git a/scripts/bareboximd-target.c b/scripts/bareboximd-target.c
new file mode 100644
index 000000000..903adee53
--- /dev/null
+++ b/scripts/bareboximd-target.c
@@ -0,0 +1 @@
+#include "bareboximd.c"
diff --git a/scripts/kernel-install-target.c b/scripts/kernel-install-target.c
new file mode 100644
index 000000000..845a96d29
--- /dev/null
+++ b/scripts/kernel-install-target.c
@@ -0,0 +1 @@
+#include "kernel-install.c"
--
2.25.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2020-06-23 3:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 3:07 [PATCH 1/3] kbuild: add -Wmissing-prototypes and -std=gnu89 to KBUILD_HOSTCFLAGS Masahiro Yamada
2020-06-23 3:07 ` [PATCH 2/3] kbuild: add infrastructure to build userspace programs Masahiro Yamada
2020-06-23 11:14 ` Sascha Hauer
2020-06-23 3:07 ` Masahiro Yamada [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200623030702.666462-3-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox