Reputation: 5
i want to create makefile with pythons codes like it allow in c++
it's example in c++
g++ main.cpp hello.cpp factorial.cpp -o hello
all: hello
hello: main.o factorial.o hello.o
g++ main.o factorial.o hello.o -o hello
main.o: main.cpp
g++ -c main.cpp
factorial.o: factorial.cpp
g++ -c factorial.cpp
hello.o: hello.cpp
g++ -c hello.cpp
clean:
rm -rf *.o hello
how to make the same with pythons files?
i have 3 files: hello.py , main.py , gui.py
I havent to use any packages
Upvotes: 0
Views: 1572
Reputation: 328674
There is no need to compile Python files yourself. The Python runtime will do that automatically for you when the code is executed on an as-needed basis.
If you want to share Python code with someone else, you really just need to put all the files into a ZIP archive or tarball.
Upvotes: 0
Reputation: 5805
I advice to read the chapter about *nix Python packaging in this book. It is very usefull.
Upvotes: 0
Reputation: 7324
Generally in Python you would write a setup.py
file rather than a Makefile
. This will take care of building and installing your package for you.
You can get closer to a C++ binary by packing your Python program with something like Py2Exe
or PyInstaller
. These put all the dependencies needed to run your program into a single executable that is probably as close as you'll get to something like the G++ output from compiling a C++ program.
Upvotes: 2