VirtualBox

Changeset 783 in kBuild


Ignore:
Timestamp:
Jan 24, 2007 9:43:39 PM (18 years ago)
Author:
bird
Message:

Makefile.kup - if found it'll automatically take up you one directory. (Makefile.kmk overrides Makefile.kup.)

Location:
trunk/src/gmake
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/main.c

    r778 r783  
    15331533    }
    15341534
     1535#ifdef KMK
     1536  /* If there wasn't any -C or -f flags, check for Makefile.kup and
     1537     insert a fake -C argument.
     1538     Makefile.kmk overrides Makefile.kup but not plain Makefile. */
     1539  if (makefiles == 0 && directories == 0)
     1540    {
     1541      struct stat st;
     1542      if ((   stat ("Makefile.kup", &st) == 0
     1543           && S_ISREG (st.st_mode) )
     1544       || (   stat ("makefile.kup", &st) == 0
     1545           && S_ISREG (st.st_mode) )
     1546       && stat ("Makefile.kmk", &st) < 0
     1547       && stat ("makefile.kmk", &st) < 0)
     1548        {
     1549          static char  fake_path[3*16 + 32] = "..";
     1550          static char *fake_list[2] = { &fake_path[0], NULL };
     1551          struct stringlist fake_directories = { &fake_list[0], 1, 0 };
     1552
     1553          char *cur = &fake_path[2];
     1554          int   up_levels = 1;
     1555
     1556          while (up_levels < 16)
     1557            {
     1558              /* File with higher precedence.s */
     1559              strcpy (cur, "/Makefile.kmk");
     1560              if (stat (fake_path, &st) == 0)
     1561                break;
     1562              strcpy (cur, "/makefile.kmk");
     1563              if (stat (fake_path, &st) == 0)
     1564                break;
     1565
     1566              /* the .kup files */
     1567              strcpy (cur, "/Makefile.kup");
     1568              if (   stat (fake_path, &st) != 0
     1569                  || !S_ISREG (st.st_mode))
     1570                {
     1571                  strcpy (cur, "/makefile.kup");
     1572                  if (   stat (fake_path, &st) != 0
     1573                      || !S_ISREG (st.st_mode))
     1574                    break;
     1575                }
     1576
     1577              /* ok */
     1578              strcpy (cur, "/..");
     1579              cur += 3;
     1580              up_levels++;
     1581            }
     1582
     1583          if (up_levels >= 16)
     1584            fatal (NILF, _("Makefile.kup recursion is too deep."));
     1585
     1586          *cur = '\0';
     1587          directories = &fake_directories;
     1588      }
     1589    }
     1590#endif
     1591
    15351592  /* If there were -C flags, move ourselves about.  */
    15361593  if (directories != 0)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette