-1

I have an assignment for school that provided some code in c and a make file. We could chose any language to code in for the part we were assigned, and i chose python.

is it possible to execute the python code file in the make file along with the provided code files(which are in c)?

Anna
  • 65
  • 8
  • You should read [Open letter to students with homework problems](http://meta.softwareengineering.stackexchange.com/questions/6166/open-letter-to-students-with-homework-problems) –  Nov 16 '16 at 10:27
  • 1
    all i am asking is if it is possible, not how to do it, or to solve my homework for me – Anna Nov 16 '16 at 10:29
  • What is a "C makefile"? You mean a `cmake` file? That's not related to the C language. – too honest for this site Nov 16 '16 at 10:30
  • I mean a Makefile that executes multiple c programs in one simple "make" command on the terminal – Anna Nov 16 '16 at 10:31
  • Check this question, may can help: http://stackoverflow.com/questions/145270/calling-c-c-from-python – Radagast Nov 16 '16 at 10:33
  • 1
    Do you mean that when you execute `make` command, it will execute the python scripts you created? If it is the case, then it is possible of course. – acw1668 Nov 16 '16 at 10:48
  • Makefiles don't "execute C programs" (whatever a "C program" would be. They take actions according to rules. – too honest for this site Nov 16 '16 at 10:59

1 Answers1

0

You can do anything in a makefile - you can run any commands that you could type yourself and hit Enter. A makefile is just a convenient way to do that - it has 3 advantages over typing commands yourself:

  1. You don't have to type them every time, you can just type make and hit Enter, that's much faster.

  2. Any of the commands will not be run, if it was run before and "nothing important" changed in the meantime. This will make things faster again, but probably not by much for a small project. But you have to specify in the makefile, what is "important" for each command. The amount of time you will need to do that, will probably be more than what you saved, for a small project. Also, if you sc**w up, some commands may not run when they should, and you won't even know about it. This will mess you up BIG LEAGUE (and by the way people, this is what our Dear Leader says, not "bigly"). But if you want to learn makefiles, for later big projects, then yes go for it!

  3. The commands can run in parallel as much as possible, which will speed things up, provided you correctly specify in the makefile, what can and cannot be run in parallel, and provided you have a multiple-processor computer. Exactly like in 2 above, for a small project it is not worth it, unless you want to learn makefiles.

Mark Galeck
  • 6,155
  • 1
  • 28
  • 55