- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have a mixed fortran/c++ code. generated a Makefile that correctly compiles the code. however, i ran into a problem generating prerequisites automatically for the c++ parts. the relevant part of the Makefile is
$(DEPDIR)/%.d: %.cpp @echo "Constructing dependencies for $<..." @set -e; rm -f $@; \ $(CXX) -MT '$$(BLDDIR)/$(subst .cpp,.o,$<)' -MM $< > $@.T; \ sed "s,\($*\)\.o[ :]*,\1.o $@ : ,g" < $@.T > $@; \ rm -f $@.T
when CXX=g++ (version 8), i get the correct *.d files, for example
$(BLDDIR)/src/FP/export.o .build/dep/src/FP/export.d : src/FP/export.cpp src/FP/lib-array.h \ src/FP/lib-algorithms.h src/FP/state.h src/FP/formulary.h \ src/FP/export.h
when CXX=icpc (version 19, update 3 on CentOS 7.6) there's an extra '$'
$$(BLDDIR)/src/FP/export.o .build/dep/src/FP/export.d : src/FP/export.cpp src/FP/lib-array.h \ src/FP/lib-algorithms.h src/FP/state.h src/FP/formulary.h \ src/FP/export.h
which, of course, fails to force a recompile of export.cpp if any of its headers change. any suggestions? i've tried -MQ option, but doesn't really matter. is there a way i can force icpc to generate the same thing as g++?
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so, a workaround would be to replace the sed w/ the following:
sed -e 's,\$$\$$,\$$,' -e "s,\($*\)\.o[ :]*,\1.o $@ : ,g" < $@.T > $@; \
but i would prefer to understand why there's an extra $.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page