user1104856
user1104856

Reputation: 147

C/C++ - run Makefile programmably

I have made a Makefile. To use it, I open my Terminal, go to the containing folder and run it with:

make flash

My question is, how can I do this in C/C++? That is, how can I invoke make inside my program (programmably)?

Upvotes: 1

Views: 163

Answers (2)

grzkv
grzkv

Reputation: 2619

You can use the system function, like this:

#include <stdlib.h>

system("make flash");

Upvotes: 0

thiton
thiton

Reputation: 36059

The system function is your friend:

system("make -C /Users/MyNAME/Desktop/Folder flash");

Upvotes: 5

Related Questions