home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / config / W95make.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.2 KB  |  80 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <process.h>
  22.  
  23. /*
  24.  * A feeble attempt at recursive make on win95 - spider 1/98
  25.  *
  26.  * argv[1] == target
  27.  * argv[2] == end directory (full)
  28.  * argv[3...n] == list of source directories
  29.  *
  30.  */
  31.  
  32. void main(int argc, char **argv)
  33. {
  34.     char *args[6];
  35.     int n = 0 ;
  36.     int rc = 0 ;
  37.  
  38.    /* Set up parameters to be sent: Sorry for the hardcode!*/
  39.    args[0] = "-nologo";
  40.    args[1] = "-nologo";
  41.    args[2] = "-S";
  42.    args[3] = "-f";
  43.    args[4] = "makefile.win";
  44.    args[5] = argv[1] ;
  45.    args[6] = NULL ;
  46.  
  47.    if (argc < 3) {
  48.        fprintf(stderr, "w95make: Not enough arguments, you figure it out\n");
  49.         exit (666) ;
  50.     }
  51.  
  52.  
  53.    while(argv[n+3] != NULL) {
  54.  
  55.         if (_chdir(argv[n+3]) != 0) {
  56.             fprintf(stderr, "w95make: Could not change to directory %s ... skipping\n", argv[n+3]);
  57.         } else {
  58.         
  59.             fprintf(stdout, "w95make: Entering Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]);
  60.             if ((rc = _spawnvp(_P_WAIT,"nmake", args)) != 0) {
  61.                 fprintf(stderr, "w95make: nmake failed in directory %s with error code %d\n", argv[n+3], rc);
  62.                 exit(rc);
  63.             }
  64.  
  65.             if (_chdir(argv[2]) != 0) {
  66.                 fprintf(stderr, "w95make: Could not change back to directory %s\n", argv[2]);
  67.                 exit (666) ;
  68.             }
  69.             
  70.             fprintf(stdout, "w95make: Leaving Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]);
  71.  
  72.         }
  73.         
  74.         n++;
  75.     }
  76.  
  77.     
  78.     exit(0);
  79. }
  80.