CDP Forum Forum Index CDP Forum
NOTE: The forum is being replaced by support.icd.no
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Converting VC++ Projects to Makefile.

 
Post new topic   Reply to topic    CDP Forum Forum Index -> Linux programming
View previous topic :: View next topic  
Author Message
leik
Guest





PostPosted: Wed 18 Jul 9:11:21 2007    Post subject: Converting VC++ Projects to Makefile. Reply with quote

The best option is to write the whole Makefile from scratch, since a lot of the parameters from VC++ and windows will not be of any meaning in gcc / linux. This will take some time, but the result will probably be better, and more lucid than a script generated Makefile.

If you have wery large project files, it may be better to use a script and clean up the mess afterwards. This may be done by a awk-script made by Josť Fonseca called dsw2mak.awk

Use in Windows:
1) Download and install MinGW from sourceforge.net, and install it to c:/MinGW
2) Download and install the shell emulator MSys. This file can be found by a googlesearch; "msys-1.0.9.exe", or else on sourceforge.net
3) Donwload and install the package mingw-utils from http://sourceforge.net/project/downloading.php?groupname=mingw&filename=mingw-utils-0.3.tar.gz&use_mirror=kent and untar the content into c:/MinGW
4) Copy your VC++ project folder into c:/MinGW . This is done to make it visible to the MSys-shell.
5) Start the MSys - shell, from Startmenu -> Programs -> MinGW -> MSYS -> msys. Your project can now be found in msys /mingw : cd /mingw
6) If you're using VC++ v7.0 or newer, read pkt 6a) before continuing.
7) Run the scipt
gawk -f dsw2mak /mingw/proj_name/CDP_Application/CDP_Application.dsw

6a)
The solution above only works on dsw, that is VC++ 6.0 project file. If you're using a newer vertion of Visual C++, you will have to convert your .sln/ .vcproj files to the older .dsw/ .dsp VC++ 6.0 project files. A guide/ tool for this is located on
http://www.arstdesign.com/articles/prjconverter.html

Use in Linux:
Here you already have a shell, and most probably the tool awk or gawk. This means that the only thing that has to be done is to get the dsw2mak.awk script. This is found under /bin in ming-utils-0.3.tar.gz . Extract this file, and use the commando given in pkt. 7 above, only with absolute filepath. You still need the .dsw/.dsp files (VC++ 6.0 project files). See pkt. 6a above. Use wine to run prjconverter.exe.
Back to top
Nils-Petter
Site Admin


Joined: 14 Mar 2007
Posts: 14
Location: Norway

PostPosted: Mon 6 Aug 9:59:58 2007    Post subject: Using dos prompt in Windows Reply with quote

You can also use dos prompt (Windows):

1. Install MinGW.
2. Select "run" from the start menu and type cmd.
3. Go to your project folder (with the project dsw file).
4. Type "path\to\utility\gawk -f path\to\script\dsw2mak.awk dswFileName".

This will convert all project files included in the dsw file to makefiles with the extension .mak.

Example:
D:\CDP\CDP_Application>C:\msys\1.0\bin\gawk -f C:\msys\1.0\bin\dsw2mak.awk CDP.dsw
_________________
Nils Petter Eftedal
Industrial Control Design AS
Back to top
View user's profile Send private message Visit poster's website
Nils-Petter
Site Admin


Joined: 14 Mar 2007
Posts: 14
Location: Norway

PostPosted: Fri 21 Dec 12:33:37 2007    Post subject: New tool! Reply with quote

We now have a new tool available that enable users to convert solution files and project files into GNU makefiles. The tool can also be used to edit existing project settings and create new makefiles from template. The MakefileWizard also provides a graphical user interface and highly configurable conversion rules that can be edited in xml.

Download the MakefileWizard the below link:
http://www.icd.no/download/Tools/MakefileWizard/
_________________
Nils Petter Eftedal
Industrial Control Design AS
Back to top
View user's profile Send private message Visit poster's website
henriga



Joined: 30 Jul 2008
Posts: 2

PostPosted: Wed 30 Jul 9:33:58 2008    Post subject: Reply with quote

I'm using MakefileWizard with default configuration file (wizconf.xml) and I'm pleased with the result. However, I get this in my makefile:

Code:
SOURCE_FILES=    \


The "HEADER_FILES" correctly becomes a list of header files from the Visual studio project, but the list of source files disappear. I found a workaround - replace the SOURCE_FILES line with this:
Code:

DIRECTORIES = src
SOURCE_FILES = $(foreach dir,$(DIRECTORIES),$(wildcard $(dir)/*.c))


This will set SOURCE_FILES to a list of *.c files in all directories specified. If you want to also include cpp-files, use this:

Code:
SOURCE_FILES = $(foreach dir,$(DIRECTORIES),$(wildcard $(dir)/*.c $(dir)/*.cpp))


If you want to add more source directories, do like this:
Code:

DIRECTORIES = src1 src2


/Henrik
Back to top
View user's profile Send private message
Nils-Petter
Site Admin


Joined: 14 Mar 2007
Posts: 14
Location: Norway

PostPosted: Wed 30 Jul 11:45:10 2008    Post subject: Reply with quote

Thank you for feedback!

You are absolutely right in your discovery. The MakefileWizard only supports .cpp files. Note that you must also add dependency for .c files for your fix to work:

Code:

%.o: %.c
   $(COMPILER) $(CFLAGS) $(ILFLAGS) $(GLOBALS) -o $@ -c $<


I'll add this in the next version of the MakefileWizard.
_________________
Nils Petter Eftedal
Industrial Control Design AS
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    CDP Forum Forum Index -> Linux programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group