diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-06-06 14:04:32 +0900 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-06-11 16:27:05 -0400 |
commit | ad80c4a3220b5348f904f909ed572c364d50f867 (patch) | |
tree | 3c268b5ec197bd761b3628f40ca9f069ab3b41cf /tools | |
parent | 4a36be9bdb42157401618681c9ac28e3824c120e (diff) | |
download | u-boot-ad80c4a3220b5348f904f909ed572c364d50f867.zip u-boot-ad80c4a3220b5348f904f909ed572c364d50f867.tar.gz u-boot-ad80c4a3220b5348f904f909ed572c364d50f867.tar.bz2 |
kbuild, tools: generate wrapper C sources automatically by Makefile
There are many source files shared between U-boot image and tools.
Instead of adding a lot of dummy wrapper files that just include
the corresponding file in lib/ or common/ directory,
Makefile should automatically generate them.
The original inspiration for this came from
scripts/Makefile.asm-generic of Linux Kernel.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/.gitignore | 3 | ||||
-rw-r--r-- | tools/Makefile | 36 | ||||
-rw-r--r-- | tools/crc32.c | 1 | ||||
-rw-r--r-- | tools/env_embedded.c | 1 | ||||
-rw-r--r-- | tools/fdt.c | 1 | ||||
-rw-r--r-- | tools/fdt_ro.c | 1 | ||||
-rw-r--r-- | tools/fdt_rw.c | 1 | ||||
-rw-r--r-- | tools/fdt_strerror.c | 1 | ||||
-rw-r--r-- | tools/fdt_wip.c | 1 | ||||
-rw-r--r-- | tools/fdtdec.c | 1 | ||||
-rw-r--r-- | tools/image-fit.c | 1 | ||||
-rw-r--r-- | tools/image-sig.c | 1 | ||||
-rw-r--r-- | tools/image.c | 1 | ||||
-rw-r--r-- | tools/md5.c | 1 | ||||
-rw-r--r-- | tools/rsa-checksum.c | 1 | ||||
-rw-r--r-- | tools/rsa-sign.c | 1 | ||||
-rw-r--r-- | tools/rsa-verify.c | 1 | ||||
-rw-r--r-- | tools/sha1.c | 1 | ||||
-rw-r--r-- | tools/sha256.c | 1 |
19 files changed, 26 insertions, 30 deletions
diff --git a/tools/.gitignore b/tools/.gitignore index 725db90..0eb9068 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -21,3 +21,6 @@ /easylogo/easylogo /gdb/gdbcont /gdb/gdbsend + +/lib/ +/common/ diff --git a/tools/Makefile b/tools/Makefile index 762f7dc..06a95bb 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -47,7 +47,7 @@ hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX) HOSTCFLAGS_bmp_logo$(SFX).o := -pedantic hostprogs-$(CONFIG_BUILD_ENVCRC) += envcrc$(SFX) -envcrc$(SFX)-objs := crc32.o env_embedded.o envcrc.o sha1.o +envcrc$(SFX)-objs := envcrc.o lib/crc32.o common/env_embedded.o lib/sha1.o hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX) HOSTCFLAGS_gen_eth_addr$(SFX).o := -pedantic @@ -59,41 +59,43 @@ hostprogs-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX) HOSTCFLAGS_xway-swap-bytes$(SFX).o := -pedantic hostprogs-y += mkenvimage$(SFX) -mkenvimage$(SFX)-objs := crc32.o mkenvimage.o os_support.o +mkenvimage$(SFX)-objs := mkenvimage.o os_support.o lib/crc32.o hostprogs-y += dumpimage$(SFX) mkimage$(SFX) hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info$(SFX) fit_check_sign$(SFX) -FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := image-sig.o +FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o # Flattened device tree objects -LIBFDT_OBJS := fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o -RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := rsa-sign.o rsa-verify.o rsa-checksum.o +LIBFDT_OBJS := $(addprefix lib/libfdt/, \ + fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o) +RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \ + rsa-sign.o rsa-verify.o rsa-checksum.o) # common objs for dumpimage and mkimage dumpimage-mkimage-objs := aisimage.o \ atmelimage.o \ $(FIT_SIG_OBJS-y) \ - crc32.o \ + lib/crc32.o \ default_image.o \ - fdtdec.o \ + lib/fdtdec.o \ fit_common.o \ fit_image.o \ gpimage.o \ gpimage-common.o \ - image-fit.o \ + common/image-fit.o \ image-host.o \ - image.o \ + common/image.o \ imagetool.o \ imximage.o \ kwbimage.o \ - md5.o \ + lib/md5.o \ mxsimage.o \ omapimage.o \ os_support.o \ pblimage.o \ pbl_crc32.o \ - sha1.o \ - sha256.o \ + lib/sha1.o \ + lib/sha256.o \ ublimage.o \ $(LIBFDT_OBJS) \ $(RSA_OBJS-y) @@ -139,7 +141,7 @@ hostprogs-$(CONFIG_SUNXI) += mksunxiboot$(SFX) hostprogs-$(CONFIG_NETCONSOLE) += ncb$(SFX) hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) -ubsha1$(SFX)-objs := os_support.o sha1.o ubsha1.o +ubsha1$(SFX)-objs := os_support.o ubsha1.o lib/sha1.o HOSTCFLAGS_ubsha1.o := -pedantic @@ -159,6 +161,14 @@ HOSTCFLAGS_sha256.o := -pedantic #hostprogs-$(CONFIG_PPC) += mpc86x_clk$(SFX) #HOSTCFLAGS_mpc86x_clk$(SFX).o := -pedantic +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <$(srctree)/$(patsubst $(obj)/%,%,$@)>" >$@ + +$(obj)/lib/%.c $(obj)/common/%.c: + $(call cmd,wrap) + +clean-dirs := lib common + always := $(hostprogs-y) # Generated LCD/video logo diff --git a/tools/crc32.c b/tools/crc32.c deleted file mode 100644 index aed7112..0000000 --- a/tools/crc32.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/crc32.c" diff --git a/tools/env_embedded.c b/tools/env_embedded.c deleted file mode 100644 index 59a6357..0000000 --- a/tools/env_embedded.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/env_embedded.c" diff --git a/tools/fdt.c b/tools/fdt.c deleted file mode 100644 index 1eafc56..0000000 --- a/tools/fdt.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/libfdt/fdt.c" diff --git a/tools/fdt_ro.c b/tools/fdt_ro.c deleted file mode 100644 index 9005fe3..0000000 --- a/tools/fdt_ro.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/libfdt/fdt_ro.c" diff --git a/tools/fdt_rw.c b/tools/fdt_rw.c deleted file mode 100644 index adc3fdf..0000000 --- a/tools/fdt_rw.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/libfdt/fdt_rw.c" diff --git a/tools/fdt_strerror.c b/tools/fdt_strerror.c deleted file mode 100644 index d0b5822..0000000 --- a/tools/fdt_strerror.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/libfdt/fdt_strerror.c" diff --git a/tools/fdt_wip.c b/tools/fdt_wip.c deleted file mode 100644 index 7810f07..0000000 --- a/tools/fdt_wip.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/libfdt/fdt_wip.c" diff --git a/tools/fdtdec.c b/tools/fdtdec.c deleted file mode 100644 index f1c2256..0000000 --- a/tools/fdtdec.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/fdtdec.c" diff --git a/tools/image-fit.c b/tools/image-fit.c deleted file mode 100644 index 037e5cc..0000000 --- a/tools/image-fit.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/image-fit.c" diff --git a/tools/image-sig.c b/tools/image-sig.c deleted file mode 100644 index e45419f..0000000 --- a/tools/image-sig.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/image-sig.c" diff --git a/tools/image.c b/tools/image.c deleted file mode 100644 index 0f9bacc..0000000 --- a/tools/image.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/image.c" diff --git a/tools/md5.c b/tools/md5.c deleted file mode 100644 index befaa32..0000000 --- a/tools/md5.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/md5.c" diff --git a/tools/rsa-checksum.c b/tools/rsa-checksum.c deleted file mode 100644 index 09033e6..0000000 --- a/tools/rsa-checksum.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/rsa/rsa-checksum.c" diff --git a/tools/rsa-sign.c b/tools/rsa-sign.c deleted file mode 100644 index 150bbe1..0000000 --- a/tools/rsa-sign.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/rsa/rsa-sign.c" diff --git a/tools/rsa-verify.c b/tools/rsa-verify.c deleted file mode 100644 index bb662a1..0000000 --- a/tools/rsa-verify.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/rsa/rsa-verify.c" diff --git a/tools/sha1.c b/tools/sha1.c deleted file mode 100644 index 0d717df..0000000 --- a/tools/sha1.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/sha1.c" diff --git a/tools/sha256.c b/tools/sha256.c deleted file mode 100644 index 8ca931f..0000000 --- a/tools/sha256.c +++ /dev/null @@ -1 +0,0 @@ -#include "../lib/sha256.c" |