Improve company productivity with a Business Account.Sign Up

x
?
Solved

Convert Unix makefile to VC *.dsp file

Posted on 2001-07-24
18
Medium Priority
?
1,251 Views
Last Modified: 2012-06-27
Hi all,

Is there any way to convert an ANSI Unix makefile to the Microsoft Visual C++ DSP file format in some automatic fashion? The actual makefile already compiles with MS's NMAKE utility, but I can't get it imported to the C++ IDE (except as a reference-file, but I want a normal project view). Any idea or a link to some utility that does this is greatly appreciated.

thanks,
Abel
0
Comment
Question by:abel
  • 9
  • 6
  • 2
  • +1
18 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6312589
Try to open the Makefile as a project, that'll 'sort of' convert it.
0
 
LVL 39

Author Comment

by:abel
ID: 6312611
jkr:
Nop, the "sort of" conversion, like the one that happens when you open an old dsp file, does not work for this kind of makefiles. It doesn't convert it, it only appends the makefile file to the project as a single file with custom build settings set to NMAKE $file or something the like.

What I need is an import that make a "normal" VC dsp file of it, so that I can see the filetree, the class-view and all.
0
 
LVL 30

Accepted Solution

by:
Axter earned 600 total points
ID: 6312622
Create a new Makefile project. (ctrl-N, then select Makefile from the Project tab)

When you get to the first step, change the command line field to the name of your makefile.

After you click the FINISH button, add the source files to your project.
You can do this by clicking on PROJECT on the main menu, and then click Add-To-Project, and then click FILES.

You should get a normal project view then.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
LVL 30

Expert Comment

by:Axter
ID: 6312631
>>I can see the filetree, the class-view and all.
If you do the above instructions I posted, you'll get the file-tree view and class-view.
0
 
LVL 86

Expert Comment

by:jkr
ID: 6312645
Well, I meant 'Open Workspace' and choose 'Makefile' from the 'File Type' box...
0
 
LVL 39

Author Comment

by:abel
ID: 6312919
> Well, I meant 'Open Workspace' and choose 'Makefile' from the 'File Type' box...
same results...

Axter:
I tried your suggestions. All compiles perfectly well, but this is still not a converted makefile. I only execute/run the makefile with NMAKE from VC instead of having a compilable VC project that I can browse. I miss the "go to definition" functionality and the class view.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6312933
Did you add the source files (*.cpp, *.h) files to your project?
0
 
LVL 30

Expert Comment

by:Axter
ID: 6312938
If you added the source files to your project per the above instructions, you should difinitely get the class view.
If you don't have the class view, then you haven't added the source files to your project.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6312941
>>You can do this by clicking on PROJECT on the main menu,
>>and then click Add-To-Project, and then click FILES.
0
 
LVL 39

Author Comment

by:abel
ID: 6312962
> If you added the source files to your project per the above instructions, you should difinitely get the class view.
> If you don't have the class view, then you haven't added the source files to your project.

I really did this (adding the files to the project). Maybe I must do something else, but I really included every file. I noted that none of the files have build options. Only the project settings have build options. Is this correct? Do I need to alter something? I still run the makefile with the NMAKE-utility. Is this correct?
0
 
LVL 30

Expert Comment

by:Axter
ID: 6312993
>>Is this correct?
Yes this is correct.

>>Do I need to alter something?
No, you shouldn't.

>>I still run the makefile with the NMAKE-utility.
>>Is this correct?
That wouldn't make a difference.

Is there a posibility that you can email me the project?
My email is (david@axter.com)

I'm not sure what went wrong, but the makefile does not give you the class-view.  Adding the files to the project is what gives you the class-view.
If I could see the project, I should be able to tell what went wrong.
0
 
LVL 39

Author Comment

by:abel
ID: 6313253
I can send you the makefile, but the project (cpp/h) files themselves I cannot send due to copyright rules (it's not my project, I'm hired by a company...). And even then, it contains about 100Mb source files and the whole project needs supporting files and libraries that exceed 1 Gb! That's too much for sending over the wire... :(

Is the makefile enough?

0
 
LVL 2

Expert Comment

by:Slordak
ID: 6313359
With regards to "converting" a makefile into a Visual C++ DSP file, it certainly depends on what all is taking place in the makefile.  Most complex UNIX makefiles for real world products invoke a number of UNIX utilities in order to do some processing of the source code and output files.  These would include things such as awk, sed, perl, nm, m4, etc.

If one doesn't have these tools for WIN32, some of this becomes all but impossible, and most of these would have to be added as pre-build or post-build steps in the DSP file.  It can become a complicated task for anything but the most trivial makefiles.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6313394
>>Is the makefile enough?
Could you send me the VC++ project file(s) and the makefile?
0
 
LVL 30

Expert Comment

by:Axter
ID: 6313429
If you send me the *.dsp file and the makefile, I can then compare the two.

You *.dsp file should have your source files listed.
Something like the following:
# Begin Group "Source Files"

# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File

SOURCE=.\CSocket.cpp
# End Source File
# End Group
# Begin Group "Header Files"

# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File

SOURCE=.\CSocket.h
# End Source File
# End Group
# Begin Group "Resource Files"


The above listing is from a *.dsp file I created and then added CSocket.cpp and CSocket.h to the project.
This allows me to see (via class view) a custom CSocket class that I created.
0
 
LVL 39

Author Comment

by:abel
ID: 6313466
I owe you an apology. I should've tried harder... I did it once again and now I suddenly have all the classes listed in the class-view. Well, at least the ones in the files, as you said.

Thanks a lot! ;-)
0
 
LVL 39

Author Comment

by:abel
ID: 6313477
Slordak:
you are right, of course, but in this case, as I said in my question (I quote: "The actual makefile already compiles with MS's NMAKE") those problems were already overcome.

Axter:
points are yours!
0
 
LVL 30

Expert Comment

by:Axter
ID: 6313547
>>Thanks a lot! ;-)
Welcome.  Glad to have helped.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question