Re: [PATCH 0/8] CMake build system for git
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 25, 2020, 14:28 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2004251624100.18039@tvgsbejvaqbjf.bet>
- In-Reply-To
- <CAKiG+9VMjft14ttqQuZMwewOGFbnbfJ3uXn0vPiJb05A8wdSwg@mail.gmail.com>
Hi Sibi,
On Sat, 25 Apr 2020, Sibi Siddharthan wrote:
Show 15 quoted lines
> On Sat, Apr 25, 2020 at 6:59 PM Johannes Schindelin > <Johannes.Schindelin@gmx.de> wrote: > > > > > We already use `GIT-VERSION-GEN` as the authoritative source for the Git > > version, by parsing the line that contains. > > > > It would look very similar, at least in my mind, to generate the list of > > source/script files by parsing the `Makefile`. > > > > Sibi, what do you think? > > One way of doing it is to track if the Makefile is changed in a commit, > run a hook to see if it contains any new OBJs and match it with the > CMake script. But this is too much work, in my opinion.
Oh, sorry, I should have clarified: We already parse the `DEF_VER=v2.26.GIT` line in `GIT-VERSION-GEN` to determine the Git version.
We should be able to do the very exact same thing to parse the `SCRIPT_SH` lines like
SCRIPT_SH += git-bisect.sh
in the `Makefile` to accumulate the list of shell scripts, and likewise the list of object files could be accumulated by parsing the `LIB_OBJS` lines like
LIB_OBJS += abspath.o
(We would of course need to substitute the `.o` with `.c`, but that should be easy.)
That way, nobody will ever need to touch the CMakeLists.txt file when they add a new source file to libgit.a.
I was not trying to auto-detect what `sed` invocation changed. Those changes _will_ need manual forward-porting to CMakeLists.txt. Thankfully, those events are really rare.
Makes sense?
Ciao, Dscho