| View previous topic :: View next topic |
| Author |
Message |
leik Guest
|
Posted: Wed 18 Jul 9:11:21 2007 Post subject: Converting VC++ Projects to Makefile. |
|
|
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
|
Posted: Mon 6 Aug 9:59:58 2007 Post subject: Using dos prompt in Windows |
|
|
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 |
|
 |
Nils-Petter Site Admin

Joined: 14 Mar 2007 Posts: 14 Location: Norway
|
Posted: Fri 21 Dec 12:33:37 2007 Post subject: New tool! |
|
|
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 |
|
 |
henriga
Joined: 30 Jul 2008 Posts: 2
|
Posted: Wed 30 Jul 9:33:58 2008 Post subject: |
|
|
I'm using MakefileWizard with default configuration file (wizconf.xml) and I'm pleased with the result. However, I get this in my makefile:
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 |
|
 |
Nils-Petter Site Admin

Joined: 14 Mar 2007 Posts: 14 Location: Norway
|
Posted: Wed 30 Jul 11:45:10 2008 Post subject: |
|
|
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 |
|
 |
|