home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / DMAKE38C.ZIP / UNIX / RMPRQ.C < prev    next >
C/C++ Source or Header  |  1992-01-23  |  4KB  |  106 lines

  1. /* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/rmprq.c,v 1.1 1992/01/24 03:28:28 dvadura Exp $
  2. -- SYNOPSIS -- remove prerequisites code.
  3. -- 
  4. -- DESCRIPTION
  5. --    This code is different for DOS and for UNIX and parallel make
  6. --    architectures since the parallel case requires the rm's to be
  7. --    run in parallel, whereas DOS guarantees to run them sequentially.
  8. -- 
  9. -- AUTHOR
  10. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  11. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  12. --
  13. -- COPYRIGHT
  14. --      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  15. -- 
  16. --      This program is free software; you can redistribute it and/or
  17. --      modify it under the terms of the GNU General Public License
  18. --      (version 1), as published by the Free Software Foundation, and
  19. --      found in the file 'LICENSE' included with this distribution.
  20. -- 
  21. --      This program is distributed in the hope that it will be useful,
  22. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  23. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24. --      GNU General Public License for more details.
  25. -- 
  26. --      You should have received a copy of the GNU General Public License
  27. --      along with this program;  if not, write to the Free Software
  28. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  29. --
  30. -- LOG
  31. --     $Log: rmprq.c,v $
  32.  * Revision 1.1  1992/01/24  03:28:28  dvadura
  33.  * dmake Version 3.8, Initial revision
  34.  *
  35. */
  36.  
  37. #include "extern.h"
  38.  
  39. PUBLIC void
  40. Remove_prq( tcp )
  41. CELLPTR tcp;
  42. {
  43.    static  LINKPTR rlp = NIL(LINK);
  44.    static  flag = 0;
  45.    static  HASHPTR m_at, m_q, m_b, m_g, m_l, m_bb, m_up;
  46.    char    *m_at_s, *m_g_s, *m_q_s, *m_b_s, *m_l_s, *m_bb_s, *m_up_s;
  47.    LINKPTR tlp;
  48.  
  49.    tcp->ce_flag         &= ~(F_MADE|F_VISITED);
  50.    tcp->ce_time          = 0L;
  51.  
  52.    for( tlp=rlp; tlp !=NIL(LINK); tlp=tlp->cl_next )
  53.       if( (tlp->cl_prq->ce_flag & (F_VISITED|F_MADE)) != F_VISITED )
  54.      break;
  55.  
  56.    if( tlp == NIL(LINK) ) {
  57.       TALLOC(tlp, 1, LINK);
  58.       TALLOC(tlp->cl_prq, 1, CELL);
  59.       tlp->cl_next = rlp;
  60.       rlp = tlp;
  61.    }
  62.  
  63.    *tlp->cl_prq = *tcp;
  64.  
  65.    /* We save the dynamic macro values here, as it is possible that the
  66.     * .REMOVE recipe is getting executed for a target while some other target
  67.     * is in the middle of executing it's list of recipe lines, in this case
  68.     * the values of $@ etc, must be preserved so that when we return to
  69.     * complete the other recipe we must make certain that the values of it's
  70.     * dynamic macros are unmodified. */
  71.  
  72.    if( !flag ) {
  73.       /* Do the getting of the macros only once. */
  74.       flag = 1;
  75.       m_at = Get_name("@", Macs, TRUE);
  76.       m_g  = Get_name(">", Macs, TRUE);
  77.       m_q  = Get_name("?", Macs, TRUE);
  78.       m_b  = Get_name("<", Macs, TRUE);
  79.       m_l  = Get_name("&", Macs, TRUE);
  80.       m_bb = Get_name("*", Macs, TRUE);
  81.       m_up = Get_name("^", Macs, TRUE);
  82.    }
  83.  
  84.    m_at_s = m_at->ht_value; m_at->ht_value = NIL(char);
  85.    m_g_s  = m_g->ht_value;  m_g->ht_value  = NIL(char);
  86.    m_q_s  = m_q->ht_value;  m_q->ht_value  = NIL(char);
  87.    m_b_s  = m_b->ht_value;  m_b->ht_value  = NIL(char);
  88.    m_l_s  = m_l->ht_value;  m_l->ht_value  = NIL(char);
  89.    m_bb_s = m_bb->ht_value; m_bb->ht_value = NIL(char);
  90.    m_up_s = m_up->ht_value; m_up->ht_value = NIL(char);
  91.  
  92.    Make( tlp->cl_prq, tlp, NIL(CELL) );
  93.    if( tlp->cl_prq->ce_dir ){
  94.       FREE(tlp->cl_prq->ce_dir);
  95.       tlp->cl_prq->ce_dir=NIL(char);
  96.    }
  97.  
  98.    m_at->ht_value = m_at_s;
  99.    m_g->ht_value  = m_g_s;
  100.    m_q->ht_value  = m_q_s;
  101.    m_b->ht_value  = m_b_s;
  102.    m_l->ht_value  = m_l_s;
  103.    m_bb->ht_value = m_bb_s;
  104.    m_up->ht_value = m_up_s;
  105. }
  106.