sln2nmake.pl is a Perl script that converts Visual Studio .sln files and their associated .vcproj or .vcxproj project files into NMAKE-compatible Makefiles. It generates project-specific Makefiles for both Release and Debug configurations, using backslashes (\) for Windows compatibility, and a master Makefile to build all projects.
- Supports legacy
.vcproj(pre-VS 2010) and modern.vcxproj(VS 2010+) files. - Extracts project details: source files (
.cpp/.c), include directories, linker dependencies, and advanced linker settings (e.g., output file, subsystem, entry point). - Generates targets for
Win32andx64in bothRelease(/MT) andDebug(/MTd) configurations. - Creates a master
Makefilefor solution-wide builds. - Uses backslashes exclusively for Windows
NMAKEcompatibility.
Syntax : sln2nmake.pl -pl <x64|win32> -conf <debug|release>
[-opts <linker opts>] [-v] <fn.sln> [<vcproj/vcxprojfn>]
generate a Makefile from a sln file
Options: -pl platform, default: x64
-conf config, default: Release
-opts optional linker options
-v be more verbose
perl sln2nmake.pl MySolution.sln
or
perl sln2nmake.pl MySolution.sln MyProject1
Processes MySolution.sln, generates a Makefile in MyProject1, and a master Makefile in the current directory.
-
Build all projects: nmake
-
Clean all projects: nmake clean
-
Build specific configuration:
nmake project1
SolutionDir\
├── Makefile
├── Makefile_Project1
├── Makefile_Project2
├── Project1\
│ └── Project1.vcxproj
├── Project2\
│ └── Project2.vcproj
└── MySolution.sln
- clean target assumes default executable name ($projnm.exe); custom OutputFile paths may not be cleaned.
- Only supports Release and Debug configurations (extendable via code).
MIT License - free to use, modify, and distribute.