Solved

Convert Unix makefile to VC *.dsp file

Posted on 2001-07-24
18
1,174 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 150 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

770 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