As noted in follow up of ticket [#2155], these three functions, all of which should be derived from the lround_generic.c source, are missing from the WSL build of libmingwex.a, whereas they were included in the mingwrt-3.x builds.
--- old+++ new@@ -1 +1 @@-As noted in follow up of ticket [#2155], three functions, all of which should be derived from the lround_generic.c source, are missing from the WSL build of libmingwex.a, whereas they were included in the mingwrt-3.x builds.+As noted in follow up of ticket [#2155], these three functions, all of which should be derived from the lround_generic.c source, are missing from the WSL build of libmingwex.a, whereas they were included in the mingwrt-3.x builds.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks, but I'm not going to accept any patch which proliferates redundant source file stubs, such as asinh[fl].c, llround.c, and llround[fl].c; rather, I want to get rid of the few such redundancies which already exist, such as round[fl].c, and lround[fl].c, (and even the stubs currently provided for round.c, and lround.c, which may be conveniently replaced by renaming round_generic.c, and lround_generic.c, respectively).
The crux of this issue is that, when you run make, the wrong pattern rules seem to be selected for targets such as src/libcrt/math/fabs[fl].o, or src/libcrt/math/asinh[fl].o, whereas, when I run it, the correct rules are selected:
$make-n-dsrc/libcrt/math/fabsf.o
GNUMake3.81
Copyright(C)2006FreeSoftwareFoundation,Inc.
Thisisfreesoftware;seethesourceforcopyingconditions.
ThereisNOwarranty;notevenforMERCHANTABILITYorFITNESSFORA
PARTICULARPURPOSE.
Thisprogrambuiltforx86_64-pc-linux-gnu
...
Updatinggoaltargets....
Consideringtargetfile`src/libcrt/math/fabsf.o'. Looking for an implicit rule for `src/libcrt/math/fabsf.o'.
Tryingpatternrulewithstem`fabsf'. Trying implicit prerequisite `src/libcrt/math/fabsf.c'.
Foundprerequisite`src/libcrt/math/fabsf.c' as VPATH `../src/libcrt/math/fabsf.c'Foundanimplicitrulefor`src/libcrt/math/fabsf.o'. Considering target file `src/libcrt/math/fabsf.c'.
Lookingforanimplicitrulefor`src/libcrt/math/fabsf.c'. Trying pattern rule with stem `fabsf'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.y'. Trying pattern rule with stem `fabsf'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.l'. Trying pattern rule with stem `fabsf'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.w'. Trying pattern rule with stem `fabsf'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.w'. Trying pattern rule with stem `fabsf.c'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.c,v'. Trying pattern rule with stem `fabsf.c'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabsf.c,v'. Trying pattern rule with stem `fabsf.c'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabsf.c'. Trying pattern rule with stem `fabsf.c'.
Tryingimplicitprerequisite`src/libcrt/math/s.fabsf.c'. Trying pattern rule with stem `fabsf.c'.
Tryingimplicitprerequisite`src/libcrt/math/SCCS/s.fabsf.c'. Trying pattern rule with stem `fabsf'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.y'. Looking for a rule with intermediate file `src/libcrt/math/fabsf.y'.
Avoidingimplicitrulerecursion.
Tryingpatternrulewithstem`fabsf.y'. Trying implicit prerequisite `src/libcrt/math/fabsf.y,v'.
Tryingpatternrulewithstem`fabsf.y'. Trying implicit prerequisite `src/libcrt/math/RCS/fabsf.y,v'.
Tryingpatternrulewithstem`fabsf.y'. Trying implicit prerequisite `src/libcrt/math/RCS/fabsf.y'.
Tryingpatternrulewithstem`fabsf.y'. Trying implicit prerequisite `src/libcrt/math/s.fabsf.y'.
Tryingpatternrulewithstem`fabsf.y'. Trying implicit prerequisite `src/libcrt/math/SCCS/s.fabsf.y'.
Tryingpatternrulewithstem`fabsf'. Trying implicit prerequisite `src/libcrt/math/fabsf.l'.
Lookingforarulewithintermediatefile`src/libcrt/math/fabsf.l'. Avoiding implicit rule recursion. Trying pattern rule with stem `fabsf.l'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.l,v'. Trying pattern rule with stem `fabsf.l'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabsf.l,v'. Trying pattern rule with stem `fabsf.l'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabsf.l'. Trying pattern rule with stem `fabsf.l'.
Tryingimplicitprerequisite`src/libcrt/math/s.fabsf.l'. Trying pattern rule with stem `fabsf.l'.
Tryingimplicitprerequisite`src/libcrt/math/SCCS/s.fabsf.l'. Trying pattern rule with stem `fabsf'.
Tryingimplicitprerequisite`src/libcrt/math/fabsf.w'. Looking for a rule with intermediate file `src/libcrt/math/fabsf.w'.
Avoidingimplicitrulerecursion.
Tryingpatternrulewithstem`fabsf.w'. Trying implicit prerequisite `src/libcrt/math/fabsf.w,v'.
Tryingpatternrulewithstem`fabsf.w'. Trying implicit prerequisite `src/libcrt/math/RCS/fabsf.w,v'.
Tryingpatternrulewithstem`fabsf.w'. Trying implicit prerequisite `src/libcrt/math/RCS/fabsf.w'.
Tryingpatternrulewithstem`fabsf.w'. Trying implicit prerequisite `src/libcrt/math/s.fabsf.w'.
Tryingpatternrulewithstem`fabsf.w'. Trying implicit prerequisite `src/libcrt/math/SCCS/s.fabsf.w'.
Tryingpatternrulewithstem`fabsf'. Rejecting impossible implicit prerequisite `src/libcrt/math/fabsf.w'.
Noimplicitrulefoundfor`src/libcrt/math/fabsf.c'. Finished prerequisites of target file `src/libcrt/math/fabsf.c'.
Noneedtoremaketarget`src/libcrt/math/fabsf.c'; using VPATH name `../src/libcrt/math/fabsf.c'.
Finishedprerequisitesoftargetfile`src/libcrt/math/fabsf.o'. Prerequisite `../src/libcrt/math/fabsf.c'isolderthantarget`src/libcrt/math/fabsf.o'.No need to remake target `src/libcrt/math/fabsf.o'.
make:`src/libcrt/math/fabsf.o' is up to date.$ make -n -d src/libcrt/math/asinhf.o. . .Updating goal targets....Considering target file `src/libcrt/math/asinhf.o'.
Lookingforanimplicitrulefor`src/libcrt/math/asinhf.o'. Trying pattern rule with stem `asinhf'.
Tryingimplicitprerequisite`src/libcrt/math/asinhf.c'. Trying pattern rule with stem `asinhf'.
Tryingimplicitprerequisite`src/libcrt/math/asinhf.s'. Trying pattern rule with stem `asinh'.
Tryingimplicitprerequisite`src/libcrt/math/asinh.c'. Found prerequisite `src/libcrt/math/asinh.c'asVPATH`../src/libcrt/math/asinh.c' Found an implicit rule for `src/libcrt/math/asinhf.o'.
Consideringtargetfile`src/libcrt/math/asinh.c'. Looking for an implicit rule for `src/libcrt/math/asinh.c'.
Tryingpatternrulewithstem`asinh'. Trying implicit prerequisite `src/libcrt/math/asinh.y'.
Tryingpatternrulewithstem`asinh'. Trying implicit prerequisite `src/libcrt/math/asinh.l'.
Tryingpatternrulewithstem`asinh'. Trying implicit prerequisite `src/libcrt/math/asinh.w'.
Tryingpatternrulewithstem`asinh'. Trying implicit prerequisite `src/libcrt/math/asinh.w'.
Tryingpatternrulewithstem`asinh.c'. Trying implicit prerequisite `src/libcrt/math/asinh.c,v'.
Tryingpatternrulewithstem`asinh.c'. Trying implicit prerequisite `src/libcrt/math/RCS/asinh.c,v'.
Tryingpatternrulewithstem`asinh.c'. Trying implicit prerequisite `src/libcrt/math/RCS/asinh.c'.
Tryingpatternrulewithstem`asinh.c'. Trying implicit prerequisite `src/libcrt/math/s.asinh.c'.
Tryingpatternrulewithstem`asinh.c'. Trying implicit prerequisite `src/libcrt/math/SCCS/s.asinh.c'.
Tryingpatternrulewithstem`asinh'. Trying implicit prerequisite `src/libcrt/math/asinh.y'.
Lookingforarulewithintermediatefile`src/libcrt/math/asinh.y'. Avoiding implicit rule recursion. Trying pattern rule with stem `asinh.y'.
Tryingimplicitprerequisite`src/libcrt/math/asinh.y,v'. Trying pattern rule with stem `asinh.y'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/asinh.y,v'. Trying pattern rule with stem `asinh.y'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/asinh.y'. Trying pattern rule with stem `asinh.y'.
Tryingimplicitprerequisite`src/libcrt/math/s.asinh.y'. Trying pattern rule with stem `asinh.y'.
Tryingimplicitprerequisite`src/libcrt/math/SCCS/s.asinh.y'. Trying pattern rule with stem `asinh'.
Tryingimplicitprerequisite`src/libcrt/math/asinh.l'. Looking for a rule with intermediate file `src/libcrt/math/asinh.l'.
Avoidingimplicitrulerecursion.
Tryingpatternrulewithstem`asinh.l'. Trying implicit prerequisite `src/libcrt/math/asinh.l,v'.
Tryingpatternrulewithstem`asinh.l'. Trying implicit prerequisite `src/libcrt/math/RCS/asinh.l,v'.
Tryingpatternrulewithstem`asinh.l'. Trying implicit prerequisite `src/libcrt/math/RCS/asinh.l'.
Tryingpatternrulewithstem`asinh.l'. Trying implicit prerequisite `src/libcrt/math/s.asinh.l'.
Tryingpatternrulewithstem`asinh.l'. Trying implicit prerequisite `src/libcrt/math/SCCS/s.asinh.l'.
Tryingpatternrulewithstem`asinh'. Trying implicit prerequisite `src/libcrt/math/asinh.w'.
Lookingforarulewithintermediatefile`src/libcrt/math/asinh.w'. Avoiding implicit rule recursion. Trying pattern rule with stem `asinh.w'.
Tryingimplicitprerequisite`src/libcrt/math/asinh.w,v'. Trying pattern rule with stem `asinh.w'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/asinh.w,v'. Trying pattern rule with stem `asinh.w'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/asinh.w'. Trying pattern rule with stem `asinh.w'.
Tryingimplicitprerequisite`src/libcrt/math/s.asinh.w'. Trying pattern rule with stem `asinh.w'.
Tryingimplicitprerequisite`src/libcrt/math/SCCS/s.asinh.w'. Trying pattern rule with stem `asinh'.
Rejectingimpossibleimplicitprerequisite`src/libcrt/math/asinh.w'. No implicit rule found for `src/libcrt/math/asinh.c'.
Finishedprerequisitesoftargetfile`src/libcrt/math/asinh.c'. No need to remake target `src/libcrt/math/asinh.c';usingVPATHname`../src/libcrt/math/asinh.c'. Finished prerequisites of target file `src/libcrt/math/asinhf.o'.
Prerequisite`../src/libcrt/math/asinh.c' is older than target `src/libcrt/math/asinhf.o'.
Noneedtoremaketarget`src/libcrt/math/asinhf.o'.make: `src/libcrt/math/asinhf.o'isuptodate.
The pattern rules are correct; we need to identify why they are not being selected correctly, when you run make.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks, but I'm not going to accept any patch which proliferates redundant source file stubs, such as asinh[fl].c
I just followed the same scheme.
The pattern rules are correct; we need to identify why they are not being selected correctly, when you run make.
As posted earlier, make 3.82 is installed on my system, which is still the current one, but your version 3.81 is certainly still in use (e.g. its the one that comes with MSYS), and that is the only difference i can see here.
If you are only concerned about redundancy: with all the stub source files in place, the pattern rules for $(math_SOURCES) are actually not needed at all.
$make-n-dsrc/libcrt/math/fabsf.o
GNUMake3.82
Builtforx86_64-unknown-linux-gnu
...
Updatinggoaltargets....
Consideringtargetfile`src/libcrt/math/fabsf.o'. File `src/libcrt/math/fabsf.o'doesnotexist.
Lookingforanimplicitrulefor`src/libcrt/math/fabsf.o'. Trying pattern rule with stem `fabs'.
Tryingimplicitprerequisite`src/libcrt/math/fabs.c'. Found prerequisite `src/libcrt/math/fabs.c'asVPATH`../src/libcrt/math/fabs.c' Found an implicit rule for `src/libcrt/math/fabsf.o'.
Consideringtargetfile`src/libcrt/math/fabs.c'. Looking for an implicit rule for `src/libcrt/math/fabs.c'.
Tryingpatternrulewithstem`fabs'. Trying implicit prerequisite `src/libcrt/math/fabs.y'.
Tryingpatternrulewithstem`fabs'. Trying implicit prerequisite `src/libcrt/math/fabs.l'.
Tryingpatternrulewithstem`fabs'. Trying implicit prerequisite `src/libcrt/math/fabs.w'.
Tryingpatternrulewithstem`fabs'. Trying implicit prerequisite `src/libcrt/math/fabs.w'.
Tryingpatternrulewithstem`fabs.c'. Trying implicit prerequisite `src/libcrt/math/fabs.c,v'.
Tryingpatternrulewithstem`fabs.c'. Trying implicit prerequisite `src/libcrt/math/RCS/fabs.c,v'.
Tryingpatternrulewithstem`fabs.c'. Trying implicit prerequisite `src/libcrt/math/RCS/fabs.c'.
Tryingpatternrulewithstem`fabs.c'. Trying implicit prerequisite `src/libcrt/math/s.fabs.c'.
Tryingpatternrulewithstem`fabs.c'. Trying implicit prerequisite `src/libcrt/math/SCCS/s.fabs.c'.
Tryingpatternrulewithstem`fabs'. Trying implicit prerequisite `src/libcrt/math/fabs.y'.
Lookingforarulewithintermediatefile`src/libcrt/math/fabs.y'. Avoiding implicit rule recursion. Trying pattern rule with stem `fabs.y'.
Tryingimplicitprerequisite`src/libcrt/math/fabs.y,v'. Trying pattern rule with stem `fabs.y'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabs.y,v'. Trying pattern rule with stem `fabs.y'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabs.y'. Trying pattern rule with stem `fabs.y'.
Tryingimplicitprerequisite`src/libcrt/math/s.fabs.y'. Trying pattern rule with stem `fabs.y'.
Tryingimplicitprerequisite`src/libcrt/math/SCCS/s.fabs.y'. Trying pattern rule with stem `fabs'.
Tryingimplicitprerequisite`src/libcrt/math/fabs.l'. Looking for a rule with intermediate file `src/libcrt/math/fabs.l'.
Avoidingimplicitrulerecursion.
Tryingpatternrulewithstem`fabs.l'. Trying implicit prerequisite `src/libcrt/math/fabs.l,v'.
Tryingpatternrulewithstem`fabs.l'. Trying implicit prerequisite `src/libcrt/math/RCS/fabs.l,v'.
Tryingpatternrulewithstem`fabs.l'. Trying implicit prerequisite `src/libcrt/math/RCS/fabs.l'.
Tryingpatternrulewithstem`fabs.l'. Trying implicit prerequisite `src/libcrt/math/s.fabs.l'.
Tryingpatternrulewithstem`fabs.l'. Trying implicit prerequisite `src/libcrt/math/SCCS/s.fabs.l'.
Tryingpatternrulewithstem`fabs'. Trying implicit prerequisite `src/libcrt/math/fabs.w'.
Lookingforarulewithintermediatefile`src/libcrt/math/fabs.w'. Avoiding implicit rule recursion. Trying pattern rule with stem `fabs.w'.
Tryingimplicitprerequisite`src/libcrt/math/fabs.w,v'. Trying pattern rule with stem `fabs.w'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabs.w,v'. Trying pattern rule with stem `fabs.w'.
Tryingimplicitprerequisite`src/libcrt/math/RCS/fabs.w'. Trying pattern rule with stem `fabs.w'.
Tryingimplicitprerequisite`src/libcrt/math/s.fabs.w'. Trying pattern rule with stem `fabs.w'.
Tryingimplicitprerequisite`src/libcrt/math/SCCS/s.fabs.w'. Trying pattern rule with stem `fabs'.
Rejectingimpossibleimplicitprerequisite`src/libcrt/math/fabs.w'. No implicit rule found for `src/libcrt/math/fabs.c'.
Finishedprerequisitesoftargetfile`src/libcrt/math/fabs.c'. No need to remake target `src/libcrt/math/fabs.c';usingVPATHname`../src/libcrt/math/fabs.c'. Finished prerequisites of target file `src/libcrt/math/fabsf.o'.
Mustremaketarget`src/libcrt/math/fabsf.o'.Invoking recipe from Makefile:693 to update target `src/libcrt/math/fabsf.o'.
/bin/mkdir-psrc/libcrt/math
i686-pc-mingw32-gcc-c-DFUNCTION=fabsf...-osrc/libcrt/math/fabsf.o../src/libcrt/math/fabs.c
Successfullyremadetargetfile`src/libcrt/math/fabsf.o'.
So the different behaviour seems to be caused by (make 3.82):
Trying pattern rule with stem `fabs'
selecting the '$(SRCDIR)/%f.o: $(SRCDIR)/%.c' pattern rule, while yours (make 3.81) read:
Trying pattern rule with stem `fabsf'
selecting the more generic '%.o : %.c' pattern rule. To verify this, i just compiled make-3.81 from sources, and with this version i got the same result as you.
So the different behaviour seems to be caused by (make 3.82):
Trying pattern rule with stem `fabs'
selecting the $(SRCDIR)/%f.o: $(SRCDIR)/%.c pattern rule, while yours (make 3.81) read:
Trying pattern rule with stem `fabsf'
selecting the more generic %.o : %.c pattern rule. To verify this, i just compiled make-3.81 from sources, and with this version i got the same result as you.
Then, this is a regression in GNU make; we should file a bug report.
Thanks, but I'm not going to accept any patch which proliferates redundant source file stubs, such as asinh[fl].c
I just followed the same scheme.
Yes, you did, by copying and adapting existing redundant files which should never have existed in the first place.
If you are only concerned about redundancy: with all the stub source files in place, ...
It is the redundancy of maintaining all those stub files, which should not be there at all, which I object to; they must be removed, so...
the pattern rules for $(math_SOURCES) are actually not needed at all.
...they most definitely are. If we are to accommodate broken GNU make-3.82, maybe they need to be expressed as static pattern rules, but the redundant files must go.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
... maybe they need to be expressed as static pattern rules
On this basis, I've created the attached alternative makefile fragment; could you please confirm that it delivers the appropriate result? For me, this is:
To test this, you will need to create a new build directory somewhere adjacent to, or within, your source tree; (I put it in ${top_srcdir}/build/foo). Drop the new Makefile in there, and adjust its top_srcdir definition to the appropriate relative path. (I guess you'll also need to adjust the CC and AR definitions to suit your own tool chain). In addition to this, you will need to:
It is the redundancy of maintaining all those stub files, which should not be >there at all, which I object to; they must be removed, so...
i'm a bit surprised that you are so concerned about a few more files ;-)
After all, beside from the copyright notice, they all together contain no more code than the Makefile rules that are neccesary to properly compile them ;) It was just a quick solution to fix a problem that didn't exist in WSL 3.xx, if i went in the wrong direction, i apologize for that.
Then, this is a regression in GNU make; we should file a bug report.
I'm not familiar with the internals of make, but i guess they had a reason to change that. And as expected, the same bevaviour is also present in make 4.00.
And even if someone there thinks this might be a bug,it took almost 3 years between release 3.82 and 4.00, so we can't expect that to be fixed soon, and it wont help for a cross-compiler, where you usually have to live with whatever make version is installed there, so we have to find a way to avoid that 'feature'.
could you please confirm that it delivers the appropriate result?
So this indeed does work, tested with all 3 make versions (3.81, 3.82 and 4.00).
PS.: while you are at it, the lengthy definition of w32api_lib_LIBRARIES is identical to
$(winapi_lib_LIBRARIES) $(winapi_lib_DDK_LIBRARIES) $(winapi_lib_DIRECTX_LIBRARIES) $(winapi_lib_DIRECTX_DINPUT_LIBRARIES) $(winapi_mri_LIBRARIES) $(winapi_lib_EXTRA_LIBRARIES)
computed near the top of the Makefile.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is the redundancy of maintaining all those stub files, which should not be there at all, which I object to; they must be removed, so...
i'm a bit surprised that you are so concerned about a few more files ;-)
I'm not concerned about a few extra files; I am concerned about the box of sticking plasters you want to use to shore up a crack in the design. The engineer in me wants to understand why that design isn't working as intended, and fix it; I do not want to paper over the cracks.
After all, beside from the copyright notice,
That is 23 lines of copyright declaration...
they all together contain no more code
...over two lines of (barely copyrightable) effective code; how ludicrous is that? Especially given that one of those effective lines, in each case, is a #define that the properly implemented pattern rule would have passed as a -D command line assignment, and the second is a #include to compile the real source file, as the pattern rule would do directly.
than the Makefile rules that are neccesary to properly compile them ;)
So that's 25 lines for each and every sticking plaster, (and we've already got 12 of them); that's already 300 lines of sticking plaster, instead of around a dozen or two lines (at most) in the Makefile. Your maths doesn't stack up...
It was just a quick solution
But it isn't a solution; it's a kludge! Furthermore, I suspect that a proper solution will be just as simple, and perhaps even quicker to implement.
to fix a problem that didn't exist in WSL 3.xx
Perhaps it didn't exist, because it was implemented properly in 3.x; the original pattern rules had the design form:
(Yes, that's only six effective lines, compared to your 300 of sticking plaster, but there is a small additional overhead for special cases, such as the llround functions). The real issue here seems to be that the _generic suffix to the stem of the function name representation, in the associated source file name, got dropped from the pattern rules in 4.x, to be replaced by the first sticking plaster; that would likely be where it started going wrong.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Perhaps it didn't exist, because it was implemented properly in 3.x; the original pattern rules had the design form...
Sure enough, if I adapt the Makefile from my trial yesterday, as attached, reinstate the round_generic.c, and lround_generic.c sources, rename the asinh.c source to asinh_generic.c, and remove all the sticking plasters, I still achieve a successful outcome:
That's with exactly eight lines of effective makefile code, in pattern rules, versus 300 lines of sticking plaster. Unless you tell me this doesn't work for you, I'll work toward a solution on this basis.
That's with exactly eight lines of effective makefile code, in pattern rules, >versus 300 lines of sticking plaster
Thats a bit unfair, not all of those 300 lines where from the patch ;)
And it is a common practice i've seen/used several times before, but those projects used automake mostly, and probably didnt want to rely on gmake features.
Unless you tell me this doesn't work for you, I'll work toward a solution on >this basis.
It does work, again tested with all 3 version of make.
The only small problem is that now
That's with exactly eight lines of effective makefile code, in pattern rules, versus 300 lines of sticking plaster
Thats a bit unfair, not all of those 300 lines where from the patch ;)
I didn't mean to imply that they were. Someone else had already started the rot; your patch just added to it. It's time to stop it.
Unless you tell me this doesn't work for you, I'll work toward a solution on this basis.
It does work, again tested with all 3 version of make.
Thanks. I guess this is the way to go, then. I'll work up a new patch, to integrate this into the existing Makefile.in; the rest of the rubbish can be cleaned up later -- better to progress gradually, than to rush headlong into too much too quickly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is that such a problem? I think not, really. Anyhow, this was just a proof of concept; a final implementation should address the dependency, such that libmingwex.a would be regenerated only when any of libobjs/libmingwex-objects/*.o (or however else they may ultimately be called) changes.
PS.: is there some better place to discuss general problems/suggestions?
I committed this (on branch 4.0-dev only, for now). It's still hideously ugly -- and the ugliness made this patch more difficult to formulate than it should have been -- but a formal clean up will have to wait.
I presume this should be good to close, now.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Diff:
Patch added.
Thanks, but I'm not going to accept any patch which proliferates redundant source file stubs, such as
asinh[fl].c,llround.c, andllround[fl].c; rather, I want to get rid of the few such redundancies which already exist, such asround[fl].c, andlround[fl].c, (and even the stubs currently provided forround.c, andlround.c, which may be conveniently replaced by renaminground_generic.c, andlround_generic.c, respectively).The crux of this issue is that, when you run make, the wrong pattern rules seem to be selected for targets such as
src/libcrt/math/fabs[fl].o, orsrc/libcrt/math/asinh[fl].o, whereas, when I run it, the correct rules are selected:The pattern rules are correct; we need to identify why they are not being selected correctly, when you run make.
I just followed the same scheme.
As posted earlier, make 3.82 is installed on my system, which is still the current one, but your version 3.81 is certainly still in use (e.g. its the one that comes with MSYS), and that is the only difference i can see here.
If you are only concerned about redundancy: with all the stub source files in place, the pattern rules for $(math_SOURCES) are actually not needed at all.
So the different behaviour seems to be caused by (make 3.82):
selecting the '$(SRCDIR)/%f.o: $(SRCDIR)/%.c' pattern rule, while yours (make 3.81) read:
selecting the more generic '%.o : %.c' pattern rule. To verify this, i just compiled make-3.81 from sources, and with this version i got the same result as you.
And looking at the Changelog of make, i found:
So this behaviour has indeed changed, and actually is visible in the .FEATURES variable.
Last edit: Keith Marshall 2014-01-24
Then, this is a regression in GNU make; we should file a bug report.
Seems back to front, to me. Surely, patterns should be prioritized on the basis of longest possible match first?
Yes, you did, by copying and adapting existing redundant files which should never have existed in the first place.
It is the redundancy of maintaining all those stub files, which should not be there at all, which I object to; they must be removed, so...
...they most definitely are. If we are to accommodate broken GNU make-3.82, maybe they need to be expressed as static pattern rules, but the redundant files must go.
Thorsten,
Following up on my own suggestion:
On this basis, I've created the attached alternative makefile fragment; could you please confirm that it delivers the appropriate result? For me, this is:
To test this, you will need to create a new build directory somewhere adjacent to, or within, your source tree; (I put it in
${top_srcdir}/build/foo). Drop the new Makefile in there, and adjust itstop_srcdirdefinition to the appropriate relative path. (I guess you'll also need to adjust theCCandARdefinitions to suit your own tool chain). In addition to this, you will need to:to get rid of the unwanted stub files, before you test this new make strategy.
i'm a bit surprised that you are so concerned about a few more files ;-)
After all, beside from the copyright notice, they all together contain no more code than the Makefile rules that are neccesary to properly compile them ;) It was just a quick solution to fix a problem that didn't exist in WSL 3.xx, if i went in the wrong direction, i apologize for that.
I'm not familiar with the internals of make, but i guess they had a reason to change that. And as expected, the same bevaviour is also present in make 4.00.
And even if someone there thinks this might be a bug,it took almost 3 years between release 3.82 and 4.00, so we can't expect that to be fixed soon, and it wont help for a cross-compiler, where you usually have to live with whatever make version is installed there, so we have to find a way to avoid that 'feature'.
Sure.
So this indeed does work, tested with all 3 make versions (3.81, 3.82 and 4.00).
PS.: while you are at it, the lengthy definition of w32api_lib_LIBRARIES is identical to
$(winapi_lib_LIBRARIES) $(winapi_lib_DDK_LIBRARIES) $(winapi_lib_DIRECTX_LIBRARIES) $(winapi_lib_DIRECTX_DINPUT_LIBRARIES) $(winapi_mri_LIBRARIES) $(winapi_lib_EXTRA_LIBRARIES)
computed near the top of the Makefile.
Yes, but that's a separate issue, perhaps more closely associated with my rant on ticket [#2172].
Related
Issues: #2172
I'm not concerned about a few extra files; I am concerned about the box of sticking plasters you want to use to shore up a crack in the design. The engineer in me wants to understand why that design isn't working as intended, and fix it; I do not want to paper over the cracks.
That is 23 lines of copyright declaration...
...over two lines of (barely copyrightable) effective code; how ludicrous is that? Especially given that one of those effective lines, in each case, is a
#definethat the properly implemented pattern rule would have passed as a-Dcommand line assignment, and the second is a#includeto compile the real source file, as the pattern rule would do directly.So that's 25 lines for each and every sticking plaster, (and we've already got 12 of them); that's already 300 lines of sticking plaster, instead of around a dozen or two lines (at most) in the Makefile. Your maths doesn't stack up...
But it isn't a solution; it's a kludge! Furthermore, I suspect that a proper solution will be just as simple, and perhaps even quicker to implement.
Perhaps it didn't exist, because it was implemented properly in 3.x; the original pattern rules had the design form:
(Yes, that's only six effective lines, compared to your 300 of sticking plaster, but there is a small additional overhead for special cases, such as the llround functions). The real issue here seems to be that the
_genericsuffix to the stem of the function name representation, in the associated source file name, got dropped from the pattern rules in 4.x, to be replaced by the first sticking plaster; that would likely be where it started going wrong.Sure enough, if I adapt the Makefile from my trial yesterday, as attached, reinstate the round_generic.c, and lround_generic.c sources, rename the asinh.c source to asinh_generic.c, and remove all the sticking plasters, I still achieve a successful outcome:
That's with exactly eight lines of effective makefile code, in pattern rules, versus 300 lines of sticking plaster. Unless you tell me this doesn't work for you, I'll work toward a solution on this basis.
Thats a bit unfair, not all of those 300 lines where from the patch ;)
And it is a common practice i've seen/used several times before, but those projects used automake mostly, and probably didnt want to rely on gmake features.
It does work, again tested with all 3 version of make.
The only small problem is that now
is always executed.
Even if it did exist, in native builds this would not have been noticed before, because msys 1.0 comes with make 3.81.
PS.: is there some better place to discuss general problems/suggestions?
Last edit: Thorsten Otto 2014-01-26
I didn't mean to imply that they were. Someone else had already started the rot; your patch just added to it. It's time to stop it.
Thanks. I guess this is the way to go, then. I'll work up a new patch, to integrate this into the existing Makefile.in; the rest of the rubbish can be cleaned up later -- better to progress gradually, than to rush headlong into too much too quickly.
Is that such a problem? I think not, really. Anyhow, this was just a proof of concept; a final implementation should address the dependency, such that libmingwex.a would be regenerated only when any of
libobjs/libmingwex-objects/*.o(or however else they may ultimately be called) changes.On the general MinGW-Users mailing list perhaps, or if you'd like to become more involved, consider joining the development team.
I committed this (on branch 4.0-dev only, for now). It's still hideously ugly -- and the ugliness made this patch more difficult to formulate than it should have been -- but a formal clean up will have to wait.
I presume this should be good to close, now.
mingwrt-4.xis dead, and buried; this issue should have gone with it, and should no longer arise with anymingwrt-3.xormingwrt-5.xrelease.