Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

problems generating prerequisites automatically

$
0
0

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++?


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>