Thread: creating make

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    569

    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?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Each node in your hash is a struct containing dependencies and rules.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    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

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    In the same node.
    Code:
    struct node {
       struct depend *dependlist;
       struct action *actionlist;
    };
    Each target has one of these.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    569
    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...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. trying to make a KenGen ( for a game tool )
    By lonewolfy in forum C# Programming
    Replies: 4
    Last Post: 03-28-2007, 08:23 AM
  2. how to make a windows application
    By crvenkapa in forum C++ Programming
    Replies: 3
    Last Post: 03-26-2007, 09:59 AM
  3. Win32 Common Controls in C++, how do i make and use them?
    By C+noob in forum Windows Programming
    Replies: 6
    Last Post: 01-09-2006, 11:53 AM
  4. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM
  5. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM