sunCC doesn't support -xMD
luoyi@slack$ sunCC -V
sunCC: Sun C++ 5.9 Linux_i386 Build35_2 2006/12/04
luoyi@slack$ sunCC -fast -xMD main.cc
sunCC: Warning: Option -xMD passed to ld, if ld is invoked, ignored otherwise
/usr/bin/ld: unrecognized option '-xMD'
/usr/bin/ld: use the --help option for usage information
same things happend on -xMMD -xMF.
but suncc support these flags.
and I want to know why sun like the following depend-file style:
luoyi@slack$ sunCC -fast -xM1 aaa main.cc
main.o : main.cc
main.o : cppall.h
luoyi@slack$ g++ -c -MM main.cc
main.o: main.cc cppall.h
luoyi@slack$
when try to include these info in Makefile, gcc's style is more easily for use.
Message was edited by:
luoyi82
[788 byte] By [
luoyi82a] at [2007-11-26 13:06:42]

# 1
Yep, C++ compiler does not yet support -xMD so we are working on it. As for the output format - that is our original format for dependencies and we do plan to change it to gcc style for those gcc-inspired options.regards,__Fedor.
SFVa at 2007-7-7 17:15:51 >

# 2
http://developers.sun.com/sunstudio/downloads/express_readme.html says:
New compiler flags (C & C++): -xMD, -xMF, -xMMD
-xMD -- Generate makefile dependencies. Same as -xM, plus runs the compilation
-xMMD -- Generate makefile dependencies excluding system headers. Same as -xM1, plus compilation
-xMF <filename> -- Specify filename for makefile dependency output
All of the -xM, -xM1, -xMD, and -xMMD options are mutually exclusive, and only one can be in effect.
# 3
Hrm... that is a deficiency in express documentation.
Well, in fact -xMD is supported by C++ frontend, yet sunCC/CC driver support for this feature did not make it into this express release.
Sorry for that.
It will surely be done in the next express release.
regards,
__Fedor.
SFVa at 2007-7-7 17:15:51 >

# 4
Hello,
Currently I'm trying to use the CC -xM compiler option to generate dependency info for source files.
By default I think that the -xM option assumes that all the object files are in the same directory as the output file
Suppose if the object files are in a different directory than the source files then how does the -xM recoginize it?
Because when I give in my makefiel as given below, depend option works fine.
$(OBJS):%.o:%.cxx
$(CXX) -xM1 $(CFLAGS) $< > $*.P
$(CXX) $(CFLAGS) $(@F:.o=.cxx) -o $@
-include $(SRCS:.cxx=.P)
But when the object files are in a different directory as given below it does not work properly.
$(OBJS):$(OUTPUT_DIR)/%.o:%.cxx
$(CXX) -xM1 $(CFLAGS) $< > $(OUTPUT_DIR)/$*.P
$(CXX) $(CFLAGS) $(@F:.o=.cxx) -o $@
-include $(SRCS:%.cxx=$(OUTPUT_DIR)/%.P)
From what I found when -xM1 ouputs info it assumes that alll the object files are in the same directory as the source files.
When I give a "make" in the source directory it displays like this.
CEventQueue.o : CEventQueue.cxx
CEventQueue.o : CEventQueue.h
CEventQueue.o : ../../pdfcore/src//CCoQueueService.h
CEventQueue.o : ../../pdfcore/src//CCoPthreadObj.h
CEventQueue.o : ../../pdfcommon/src//CPdfObject.h
CEventQueue.o : ../../pdfcommon/src//CPdfTrace.h
CEventQueue.o : ../../pdfcommon/src//CPdfException.h
CEventQueue.o : ../../pdfcommon/src//PdfType.h
But actually it should refer the .o's like this.
../../build/CEventQueue.o : CEventQueue.cxx where ../../build is the OUTPUT_DIR.
I found that there is no CC compiler option for adding prefix to object files.
Could you tell me what to do now.?All the makefiles in our project create the .o files in a seperate directory other than the source directory.
Thanks in advance,
GA
# 5
Hi Fedor,
Does this mean that the latest version of SunStudio 11 supports the following compiler options ?
New compiler flags (C & C++): -xMD, -xMF, -xMMD
If I download the latest release from
http://developers.sun.com/sunstudio/downloads/
WIll the compiler options -xMD, -xMF, -xMMD be available for Solaris CC compiler (for C++) and cc compiler (for C) ?
Please let me know about this.
Thanks in advance,
GA
# 6
> WIll the compiler options -xMD, -xMF, -xMMD be available for Solaris CC compiler (for C++) and cc compiler (for C) ?
It is available already for C (though out[ut format is somewhat different).
For C++ it should be available in the next installment of express release which is still couple months away.
Readme file for this release will be updated accordingly to point out the changes.
regards,
__Fedor.
SFVa at 2007-7-7 17:15:51 >

# 7
> By default I think that the -xM option assumes that all the object files are in the same directory as the output file
Thats true. Btw, that is default behavior fo gcc as well.
If you need to prepend object directory to .o files you can easily do it with postprocessing (sed/perl whatever you feel appropriate).
regards,
__Fedor.
SFVa at 2007-7-7 17:15:51 >

# 8
yes, see my post (number 5) in this thread< http://forum.java.sun.com/thread.jspa?threadID=5071304>
# 9
Thanks, slashlib, it should work both for gnu-make and dmake.
SFVa at 2007-7-7 17:15:51 >
