user1808932
user1808932

Reputation: 427

define macro in makefile for visual studio C++ build

I have two exe which use the same .dll through explicit linking, both do some specific work, which are differentiated through some macros. I have created a make file to build the dll, now how to define that macro in makefile, so that I can generate respective dll for my use. while my build is on windows, and I am using visual studio compiler, any input will be appreciable.

Upvotes: 0

Views: 702

Answers (1)

bobbogo
bobbogo

Reputation: 15493

When you run make, you can set macros on the command-line. These macros become read-only during the make run (in other words, they override any assignments that you may attempt inside the Makefile).

So, create a make-based VisualStudio project. For the Debug configuration ensure it runs

make TARGET=Debug

and for the Release configuration

make TARGET=Release

Upvotes: 1

Related Questions