开发者

Automatically run Makefiles when doubleclicked

开发者 https://www.devze.com 2023-02-25 06:35 出处:网络
Is there a way to have Makefiles run开发者_运维技巧 automatically (then pause at the end) when doubleclicked in Windows Explorer?Makefiles themselves are not meant to be executable, but there is a way

Is there a way to have Makefiles run开发者_运维技巧 automatically (then pause at the end) when doubleclicked in Windows Explorer?


Makefiles themselves are not meant to be executable, but there is a way to automate the making of programs by using a batch file (for Windows) or a shell script (for Unix). Place the following in a notepad text file and rename it to a .bat extension file (like makeprogram.bat):

make
pause

This .bat file is executable, and if placed in the same folder as a makefile will compile according to said makefile using the make command.


Just make a program to run make and them assign it as default program to run when the Makefile is clicked. Like this(Visual Studio) using C:

#include <shellapi.h>

int main(void)
{
    ShellExecute(0,0,"make.exe",0,0,SW_SHOWNORMAL);
}

Using a batch file is a lot simpler:

make
pause
0

精彩评论

暂无评论...
验证码 换一张
取 消