Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make Python MakeFile
#1
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
Reply
#2
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.)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  make: *** [Makefile:29: all] Segmentation fault Anldra12 2 1,812 May-01-2022, 06:17 PM
Last Post: Anldra12
  Python project "pong" without any makefile sylas 5 4,938 Nov-28-2017, 05:55 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020