Forum Discussion
Please note I have made case 00604188 in https://premiersupport.intel.com/ for this and it was confirmed that dependencies are not working.
And a fix is scheduled for the next release of Quartus.
Just for reference recently a colleague of mine has found a workaround as a rebuild is not really a sollution when you have to wait untill newlib is build which takes ~15min each time (with no build feedback!)
Fix incremental build (ctrl-b) when header file is updated
When a header file is updated the incremental build (ctrl-b) does not rebuild the objects that depend on the header file. So currently a clean + rebuild is needed.
This can be fixed with the following changes in the Makefile:
- In the Makefile for the project search for "-include $(APP_DEPS)" and adapt this to:
# Fix to always include Application dependency files
# Include the dependency files unless the make goal is performing a clean
# of the application.
#ifeq ($(firstword $(MAKECMDGOALS)),)
#ifeq ($(firstword $(MAKECMDGOALS)),app)
-include $(APP_DEPS)
#endif
#endif
- In the Makefile for the project search for "define compile.c" and adapt this to:
define compile.c
@$(ECHO) Info: Compiling $< to $@@
@$(MKDIR) $(@D)
$(CC) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< || (ret=$$?; rm -f $@ $(@:.o=.d) && exit $$ret)
@# Fix to correct paths in .d files
@dos2unix -q $(@:.o=.d)
@sed -e 's@[cC]:@/mnt/c@' -e 's@[dD]:@/mnt/d@' -e 's@\\@\/@g' -e 's@\/$$@\\@' -i $(@:.o=.d)
$(CC_POST_PROCESS)
endef
- In the Makefile for the project search for "define compile.cpp" and adapt this to:
define compile.cpp
@$(ECHO) Info: Compiling $< to $@@
@$(MKDIR) $(@D)
$(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< || (ret=$$?; rm -f $@ $(@:.o=.d) && exit $$ret)
@# Fix to correct paths in .d files
@dos2unix -q $(@:.o=.d)
@sed -e 's@[cC]:@/mnt/c@' -e 's@[dD]:@/mnt/d@' -e 's@\\@\/@g' -e 's@\/$$@\\@' -i $(@:.o=.d)
$(CXX_POST_PROCESS)
endef
-
In the Makefile for the project search for "define compile.cpp" and adapt this to:
define compile.s
@$(ECHO) Info: Assembling $< to $@@
@$(MKDIR) $(@D)
$(AS) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $< || (ret=$$?; rm -f $@ $(@:.o=.d) && exit $$ret)
@# Fix to correct paths in .d files
@dos2unix -q $(@:.o=.d)
@sed -e 's@[cC]:@/mnt/c@' -e 's@[dD]:@/mnt/d@' -e 's@\\@\/@g' -e 's@\/$$@\\@' -i $(@:.o=.d)
$(AS_POST_PROCESS)
endef
The -include $(APP_DEPS) command is never included due to the nested (wrong?) ifeq statements
"|| (ret=$$?; rm -f $@ $(@:.o=.d) && exit $$ret)" removes .o and .d file if gcc compiler returns with an error
The sed command converts the windows paths in the .d file to WSL path notation (e.g. C:\path\to\file is replaced by /mnt/c/path/to/file)
Warning: the sed command currently only supports C and D drives.
Thanks, this was very helpful. We of course cannot see your premier support case, so I have no idea how to tell if Intel have issued a fix, and if so what it was? But it seems they didn't change anything certainly until after 22.1 .
Couple of minor tweaks to the above:
1. You have an extra @ symbol at the end of the ECHO lines each of the define compile.*
2. The commented out ifeq lines for APP_DEPS can be replaced by ifeq (,$(filter clean,$(MAKECMDGOALS))) to continue to filter out the clean target.
3. You can make the sed command work with any drive letter by slightly tweaking the search to include any letter followed by colon and slash (necessary to stop it detecting the .h: and possibly .c: at the end of lines), with a capture group: 's@\([a-zA-Z]\):[\\/]@/mnt/\l\1/@'
define compile.c
@$(ECHO) Info: Compiling $< to $@
@$(MKDIR) $(@D)
$(CC) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) -o $@ $< || (ret=$$?; rm -f $@ $(@:.o=.d) && exit $$ret)
@# Fix to correct paths in .d files
@dos2unix -q $(@:.o=.d)
@sed -e 's@\([a-zA-Z]\):[\\/]@/mnt/\l\1/@' -e 's@\\@\/@g' -e 's@\/$$@\\@' -i $(@:.o=.d)
$(CC_POST_PROCESS)
endef
define compile.cpp
@$(ECHO) Info: Compiling $< to $@
@$(MKDIR) $(@D)
$(CXX) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CXXFLAGS) $(APP_CFLAGS) -o $@ $< || (ret=$$?; rm -f $@ $(@:.o=.d) && exit $$ret)
@# Fix to correct paths in .d files
@dos2unix -q $(@:.o=.d)
@sed -e 's@\([a-zA-Z]\):[\\/]@/mnt/\l\1/@' -e 's@\\@\/@g' -e 's@\/$$@\\@' -i $(@:.o=.d)
$(CXX_POST_PROCESS)
endef
define compile.s
@$(ECHO) Info: Assembling $< to $@
@$(MKDIR) $(@D)
$(AS) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $< || (ret=$$?; rm -f $@ $(@:.o=.d) && exit $$ret)
@# Fix to correct paths in .d files
@dos2unix -q $(@:.o=.d)
@sed -e 's@\([a-zA-Z]\):[\\/]@/mnt/\l\1/@' -e 's@\\@\/@g' -e 's@\/$$@\\@' -i $(@:.o=.d)
$(AS_POST_PROCESS)
endef