Closed
Conversation
Added more todos.
Add executing program to the list of input files.
Contributor
|
Use make instead of nob. |
Author
|
I'd use make, but even make can't do what I implemented in this pr. |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So I've implemented caching system that uses strace to automatically find out which are input/output files.
Example on how to use it.
First time you run it, it will generate
nob.cachefile that contains something like this:main: main.c cc -o main main.cWhen you run
nobagain it will read and parsenob.cachefile and will only run the command if themain.c(or anything included by main.c) was modified (nob_needs_rebuild).This has a few TODOs still:
strace is just a program that is not on all distributions. <sys/ptrace.h> is part of glibc and should be more cross platform.
Motivation:
You have for example N png files.
You have a tool to generate atlas from png files.
You don't want to build the tool every time.
And you don't want to run the tool every time.
But you don't want to manually specify which .png will be used by the tool.
Coolest thing I found out when looking at the output was this:
I'm running git commands during build process to get the current branch and commit hash and it found the dependencies for those commands.
I didn't know files
.git/HEAD,.git/refs/heads/master, and.git/packed-refsexisted, but the tool I made uses those files to do something. Magic.