I’m writing a makefile.
I have an artifact data and I use gpt to process it. Due to token limits, I have to break the data into segments (rule segments), each processed by AI (rule ai), then assemble segments together (rule assemble).
segments :
break --size 20M ./data.txt seg-%d.txt
ai : segments
for f in seg-*; do
# outputfile is ai-output-%d
gpt $f
done
assemble : ai
concat --output final.txt -- ai-output-*
This makefile works when I call make assemble
.
However, gpt is not very stable. Sometimes I have to call it again to get a better output. Then, if I call make assemble
, make will re-run rule ai, and overwrite my better output.
I would like to use this makefile in two cases:
- When the folder is in a clean state, I call
make assemble
, andfinal.txt
is created. - When the folder is not clean, I manually rerun chatgpt and get a different ai output. Then I call
make assemble
, andfinal.txt
is created from my revised output.
How can I change my makefile to allow this two cases?
Dyson Cho is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.