gnumake-windows
gnumake-windows copied to clipboard
Case-sensitive file issue
Hello.
I have an issue with your gnu-make-4.3.exe
on Win-10 in rules like:
$(OBJ_DIR)/%.moc.cpp: %.h
moc.exe $(moc_flags) -o $@ $<
And a list of files that need to run via Qt's moc.exe
program to create the Meta Object .cpp-code:
plugin_moc = BeamSteeringCWmodBaseband.h BeamSteeringCWmodGui.h
moc_SRC = $(plugin_moc:.h=.moc.cpp)
# ...
plugin-foo.dll: $(plain_CPP_objects) $(moc_SRC:.cpp=.obj)
link -out:$@ $^ etc.
These are really lowercase letters on disk (beamsteeringcwmodbaseband.h
etc.).
My issue is that the above pattern rules is not used to match a creation of
BeamSteeringCWmodBaseband.moc.cpp
from BeamSteeringCWmodBaseband.h
.
This is no issue when using my self-compiled GNU-make from Git. So perhaps v4.3 has missed some commits that could avoid this issue?
I prefer writing my Makefile with mixed casing for clarity. The rules are more complex, but hope you get the idea.
Hello.
I checked on the following test:
- in cygwin:
$ echo 'all: My.moc.cpp' > test.mk $ echo '%.moc.cpp: %.h; echo $< $@' >> test.mk $ rm -f my.h $ touch my.h $ make -f test.mk make: *** No rule to make target 'My.moc.cpp', needed by 'all'. stop.
now if you do
$ touch My.h $ make -f test.mk make: *** No rule to make target 'My.moc.cpp', needed by 'all'. stop.
- same error - because the command "touch My.h" failed because the file "my.h" already exists.
now:
$ rm my.h $ touch My.h $ make -f test.mk echo My.h My.moc.cpp My.h My.moc.cpp
successfully.
$ make --version GNU Make 4.3 Built for x86_64-pc-cygwin Copyright (C) 1988-2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
- I will try the same for gnu make built from git
$ rm my.h $ touch my.h $ ./gnumake-667d70ea-x64.exe -f test.mk gnumake-667d70ea-x64: *** No rule to make target 'My.moc.cpp', needed by 'all'. stop.
delete my.h, create My.h, try again:
$ rm my.h $ touch My.h $ ./gnumake-667d70ea-x64.exe -f test.mk echo My.h My.moc.cpp My.h My.moc.cpp
$ ./gnumake-667d70ea-x64.exe --version GNU Make 4.3.90 Built for Windows32 Copyright (C) 1988-2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later https://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
- behavior similar to gnu make from cygwin.
- try in cmd.exe
$ cmd.exe /c "start cmd.exe"
del my.h rem.>my.h gnumake-667d70ea-x64.exe -f test.mk gnumake-667d70ea-x64: *** No rule to make target 'My.moc.cpp', needed by 'all'. stop.
delete my.h, create My.h, try again:
del my.h rem.>My.h gnumake-667d70ea-x64.exe -f test.mk echo My.h My.moc.cpp My.h My.moc.cpp
working.
Looks like name case is important in pattern-rules. I wonder how the tests above pass on your compiled gnu make from git? If there are no problems, then how can I compile gnu make from git in the same way as you?
I did build my make.exe
with #define HAVE_CASE_INSENSITIVE_FS 1
. Did you?
And BTW, I do not use Cygwin's terminal nor CMD. I use 4NT. But that should not matter.
Here is (for me) a clearer test-fs-issue.bat
:
::
:: Test for issue:
:: https://github.com/mbuilov/gnumake-windows/issues/3
::
@echo off
setlocal
echo. > my.h
echo all: My.moc.cpp > issue-3.mk
echo `%.moc.cpp: %.h; @echo $< $@` >> issue-3.mk
echo Testing Michael M. Builov 'make':
..\gnumake-4.3.exe --trace -f issue-3.mk
echo Errorlevel %?
echo Testing my own 'make':
gnumake.exe --trace -f issue-3.mk
echo Errorlevel %?
Running test-fs-issue.bat
gives:
Testing Michael M. Builov 'make':
gnumake-4.3: *** No rule to make target 'My.moc.cpp', needed by 'all'. Stop.
Errorlevel 2
Testing my own 'make':
issue-3.mk:2: update target 'My.moc.cpp' due to: my.h
my.h My.moc.cpp
Errorlevel 0
So I believe your gnumake-4.3.exe
was not built with -DHAVE_CASE_INSENSITIVE_FS
.
See dir.c
for details of how a filename = downcase (filename);
is used for hashing.
The --trace
clearly shows that the file-case is no issue. Presumably since I use -DHAVE_CASE_INSENSITIVE_FS
.
Thanks a lot for the detailed explanations. Personally, I've always worked with case-sensitive filenames - to avoid problems with cross-platform development.
Yes, adding HAVE_CASE_INSENSITIVE_FS helped - I built gnumake-667d70ea-ign-case-x64.exe
I tweaked test-fs-issue.bat
a bit to make it work in standard cmd.exe
.
::
:: Test for issue:
:: https://github.com/mbuilov/gnumake-windows/issues/3
::
@echo off
setlocal
del /q my.h 2> NUL
rem.> my.h
(echo.all: My.moc.cpp) > issue-3.mk
(echo.%%.moc.cpp: %%.h; @echo $^< $@) >> issue-3.mk
echo Testing make without case insensitive support:
.\gnumake-667d70ea-x64.exe --trace -f issue-3.mk
echo Errorlevel %ERRORLEVEL%
echo Testing make with case insensitive support:
.\gnumake-667d70ea-ign-case-x64.exe --trace -f issue-3.mk
echo Errorlevel %ERRORLEVEL%
Running test-fs-issue.bat
gives:
Testing make without case insensitive support:
gnumake-667d70ea-x64: *** No rule to make target 'My.moc.cpp', needed by 'all'. Stop.
Errorlevel 2
Testing make with case insensitive support:
issue-3.mk:2: update target 'My.moc.cpp' due to: my.h
echo my.h My.moc.cpp
my.h My.moc.cpp
Errorlevel 0
can this be closed?
can this be closed?
Yes, there are two pre-built executables - choose the one that suits you best