Python Forum

Full Version: How to make Python MakeFile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello!

As I understand it makefiles are not so much required for python because it's not a compiled language, moreso interpreted. However, I need to make a makefile for my project.

So...

I know how to make a makefile for c++ but I've never done it for python. Everything I look at on google has this giant, long file that is waaay more than I'm looking for. Is there an easy 1 or 2 lines of code I can use to run my file? I have a single file ABAC_engine.py that contains all my code. Do I need to make it an executable first? How does this work?

Let me know if there's info I need to include and I will find it.

Thanks in advance to all!

I forgot to add that it must be able to be called with:

abacmonitor command-line-arguments-go-here
I'm going to go ahead and post this here since there is so little on the internet about making python makefiles. This is what I used (and it works):

PY=python3
ZIP=abacmonitor.zip
MAIN=main
DIR=$(PWD)
.SUFFIXES: .py
FILES = \
	abacmonitor.py
All: 
	echo " $(PY) $(DIR)/$(FILES) " \"'$$1'\" > abacmonitor
	chmod 777 abacmonitor
A little explaination:

PY=python3 (this is my python version)

FILES (this is my python file. I only had one)

All: (this is the main part of it which grabs the python version, directory location, and filename and uses it alongside another command $$1 which works with another file to feed input from .txt files as arguments into the program.)