Let’s design make. Each dependency has some dependency list that is passed in, to compile a target binary.
{"bin": ["foo.o", "bar.o", # "qux.h"]
"foo.o": [# "foo.h", # "foo.c", # "qux.h"]
"bar.o": [# "bar.h", # "bar.c"]
"foo.h" : [] # compile
"foo.c" : [] # compile
"bar.h" : [] # compile
"bar.c" : ["qux.h"] # compile this
"qux.h" : [] # compile this
}
map)
Builder(dependency
# call compile on all dependencies until we compile binary
KickOffBuild(binary) compile() # will add to a queue and compile asynchronously
# this is called with source file when compile returns() OnCompileComplete(source_file)