Solved

Convert Unix makefile to VC *.dsp file

Posted on 2001-07-24
18
1,178 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

792 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