On Mon, Oct 11, 2021 at 11:53 PM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote: > > On Mon, Oct 11, 2021 at 11:37:07PM +0900, Masahiro Yamada wrote: > > On Wed, Oct 6, 2021 at 11:26 PM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote: > > > > > > Several functions are duplicated in different host tools. This patch > > > starts collecting them in a single C file. We start with read_file() > > > and read_file_2(), others follow in separate commits. > > > > > > It would be great to compile these functions in a separate library, but > > > I don't know how this can be archieved in Kbuild. Instead, the C file > > > is included where needed. Not nice, not beautiful, but at least enough > > > to get something going. > > > > > > You can try this. > > > > > > hostprogs-always-$(CONFIG_IMD) += bareboximd > > bareboximd-objs := bareboximd.o common.o > > > > > > hostprogs-always-$(CONFIG_OMAP3_USB_LOADER) += omap3-usb-loader > > omap3-usb-loader-objs := omap3-usb-loader.o common.o > > I did and it works well as long as common.o is used only in a single > directory. Unfortunately some tools are in subdirectories, like for > example scripts/imx/imx-usb-loader.c. Of course these could be moved up > one level, but I didn't want to go that path. > Do you see any possibility to archieve the same with files in different > directories? > Then, I have no idea. At least, the Makefile part needs to be moved up. hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE) += imx-image imx-usb-loader-objs := imx/imx-usb-loader.o imx/imx.o common.o Probably, you do not want to do it. -- Best Regards Masahiro Yamada _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox