1 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
---|
2 | /* ***** BEGIN LICENSE BLOCK ***** |
---|
3 | * Version: NPL 1.1/GPL 2.0/LGPL 2.1 |
---|
4 | * |
---|
5 | * The contents of this file are subject to the Netscape Public License |
---|
6 | * Version 1.1 (the "License"); you may not use this file except in |
---|
7 | * compliance with the License. You may obtain a copy of the License at |
---|
8 | * http://www.mozilla.org/NPL/ |
---|
9 | * |
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis, |
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
---|
12 | * for the specific language governing rights and limitations under the |
---|
13 | * License. |
---|
14 | * |
---|
15 | * The Original Code is mozilla.org code. |
---|
16 | * |
---|
17 | * The Initial Developer of the Original Code is |
---|
18 | * Netscape Communications Corporation. |
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998 |
---|
20 | * the Initial Developer. All Rights Reserved. |
---|
21 | * |
---|
22 | * Contributor(s): |
---|
23 | * |
---|
24 | * |
---|
25 | * Alternatively, the contents of this file may be used under the terms of |
---|
26 | * either the GNU General Public License Version 2 or later (the "GPL"), or |
---|
27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
---|
28 | * in which case the provisions of the GPL or the LGPL are applicable instead |
---|
29 | * of those above. If you wish to allow use of your version of this file only |
---|
30 | * under the terms of either the GPL or the LGPL, and not to allow others to |
---|
31 | * use your version of this file under the terms of the NPL, indicate your |
---|
32 | * decision by deleting the provisions above and replace them with the notice |
---|
33 | * and other provisions required by the GPL or the LGPL. If you do not delete |
---|
34 | * the provisions above, a recipient may use your version of this file under |
---|
35 | * the terms of any one of the NPL, the GPL or the LGPL. |
---|
36 | * |
---|
37 | * ***** END LICENSE BLOCK ***** */ |
---|
38 | #include <stdio.h> |
---|
39 | #include <stdlib.h> |
---|
40 | #include <string.h> |
---|
41 | #include <process.h> |
---|
42 | |
---|
43 | /* |
---|
44 | * A feeble attempt at recursive make on win95 - spider 1/98 |
---|
45 | * |
---|
46 | * argv[1] == target |
---|
47 | * argv[2] == end directory (full) |
---|
48 | * argv[3...n] == list of source directories |
---|
49 | * |
---|
50 | */ |
---|
51 | |
---|
52 | void main(int argc, char **argv) |
---|
53 | { |
---|
54 | char *args[7]; |
---|
55 | int n = 0 ; |
---|
56 | int rc = 0 ; |
---|
57 | |
---|
58 | /* Set up parameters to be sent: Sorry for the hardcode!*/ |
---|
59 | args[0] = "-nologo"; |
---|
60 | args[1] = "-nologo"; |
---|
61 | args[2] = "-S"; |
---|
62 | args[3] = "-f"; |
---|
63 | args[4] = "makefile.win"; |
---|
64 | args[5] = argv[1] ; |
---|
65 | args[6] = NULL ; |
---|
66 | |
---|
67 | if (argc < 3) { |
---|
68 | fprintf(stderr, "w95make: Not enough arguments, you figure it out\n"); |
---|
69 | exit (666) ; |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | while(argv[n+3] != NULL) { |
---|
74 | |
---|
75 | if (_chdir(argv[n+3]) != 0) { |
---|
76 | fprintf(stderr, "w95make: Could not change to directory %s ... skipping\n", argv[n+3]); |
---|
77 | } else { |
---|
78 | |
---|
79 | fprintf(stdout, "w95make: Entering Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]); |
---|
80 | if ((rc = _spawnvp(_P_WAIT,"nmake", args)) != 0) { |
---|
81 | fprintf(stderr, "w95make: nmake failed in directory %s with error code %d\n", argv[n+3], rc); |
---|
82 | exit(rc); |
---|
83 | } |
---|
84 | |
---|
85 | if (_chdir(argv[2]) != 0) { |
---|
86 | fprintf(stderr, "w95make: Could not change back to directory %s\n", argv[2]); |
---|
87 | exit (666) ; |
---|
88 | } |
---|
89 | |
---|
90 | fprintf(stdout, "w95make: Leaving Directory %s\\%s with target %s\n", argv[2], argv[n+3], argv[1]); |
---|
91 | |
---|
92 | } |
---|
93 | |
---|
94 | n++; |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | exit(0); |
---|
99 | } |
---|