help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Makefile for my loadable builtin


From: Robert E. Griffith
Subject: Re: Makefile for my loadable builtin
Date: Wed, 27 Apr 2022 10:03:49 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

The goal for that file is to give you a template you can copy and just
change a couple of items (e.g., all occurrences of "example") to have a
Makefile you can use for your own builtin.
Well ok, but that does not seem like a great goal given that examples/loadables/Makefile.inc is a generated file that varies depending of target system capabilities.

The solution I am going with is to include a non-standard ./configure script in my project that modifies the Makefile.inc from the bash-builtins project to create a Makefile specific to the project. This maintains the "./configure && make" convention. I think that is a fine solution but its not obvious.


BTW, searching github for "bash loadable builtin" finds only 13 projects of which none appear to have a good build solution. A couple of them fork the whole bash project. Others describe manual steps for retrieving and modifying the Makefile.

It seems that just removing the targets from that file would allow a simple solution to distribution of loadable builtins.

1. Bash already provides a way to build a package with (aka install)
   headers and the configured builtin Makefile.inc
2. a loadable builtin project could build-time depend on that package
   and include the Makefile.inc from that package in its own short Make
   file.

The change I would propose is...

1. remove the targets at the end of examples/loadables/Makefile.inc
2. add a new file examples/loadables/Makefile.sample which has "include
   examples/loadables.Makefile.inc" and then has the targets that were
   removed from Makefile.inc as an example.

--BobG


On 4/25/22 16:25, Chet Ramey wrote:
On 4/25/22 11:15 AM, Robert E. Griffith wrote:
ok, thanks. It seems like copying the MakeFile.inc will work for a lot of platforms (enough for me probably) but not all.

Would it make sense to remove the "all" and "example" targets from examples/loadables/Makefile.inc.in and that way packages with loadable builtins could just include /usr/lib/bash/Makefile.inc (or similar maybe for non-debian distros)  to get the right options for any situation?

The goal for that file is to give you a template you can copy and just
change a couple of items (e.g., all occurrences of "example") to have a
Makefile you can use for your own builtin.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]