-
creating make
I am asked to create my own "make" facility.. but it will be much simpler as I don't have to worry about handling default rules or macros within my memake..
So I am planning to use the hash table to store the target and it's dependencies.. the target as the key in the hash table and the dependencies as the value.. my hash table uses chaining to handle collisions.
The confusing part is then, I have to recursively goes through each dependency and build each one..
Other part is if I have the target as the key and dependencies as the value, where should I store the build commands?? should I have two hash table to store the build commands with the dependencies?
-
Each node in your hash is a struct containing dependencies and rules.
-
so say with this example:
main : haha.o hoho.o hehe.o
build commands here
main is the key in the hash table and haha.o hoho.o and hehe.o each is the value(node) in the linked list.. so where do we store the dependencies
-
In the same node.
Code:
struct node {
struct depend *dependlist;
struct action *actionlist;
};
Each target has one of these.
-
okay so each target, which is the key in the hash table has a struct name rule, inside that struct of rule it has it's dependencies and also build commands...