|
Lines 72-77
static const char rcsid[] =
Link Here
|
| 72 |
|
72 |
|
| 73 |
char * PREFIX; |
73 |
char * PREFIX; |
| 74 |
char destdir[MAXPATHLEN]; |
74 |
char destdir[MAXPATHLEN]; |
|
|
75 |
char ksrcdir[MAXPATHLEN]; |
| 75 |
char srcdir[MAXPATHLEN]; |
76 |
char srcdir[MAXPATHLEN]; |
| 76 |
|
77 |
|
| 77 |
int debugging; |
78 |
int debugging; |
|
Lines 110-117
main(int argc, char **argv)
Link Here
|
| 110 |
char xxx[MAXPATHLEN]; |
111 |
char xxx[MAXPATHLEN]; |
| 111 |
char *kernfile; |
112 |
char *kernfile; |
| 112 |
|
113 |
|
|
|
114 |
*ksrcdir = '\0'; |
| 113 |
kernfile = NULL; |
115 |
kernfile = NULL; |
| 114 |
while ((ch = getopt(argc, argv, "Cd:gpVx:")) != -1) |
116 |
while ((ch = getopt(argc, argv, "Cd:gk:pVx:")) != -1) |
| 115 |
switch (ch) { |
117 |
switch (ch) { |
| 116 |
case 'C': |
118 |
case 'C': |
| 117 |
filebased = 1; |
119 |
filebased = 1; |
|
Lines 125-130
main(int argc, char **argv)
Link Here
|
| 125 |
case 'g': |
127 |
case 'g': |
| 126 |
debugging++; |
128 |
debugging++; |
| 127 |
break; |
129 |
break; |
|
|
130 |
case 'k': |
| 131 |
if (*ksrcdir == '\0') |
| 132 |
strlcpy(ksrcdir, optarg, sizeof(ksrcdir)); |
| 133 |
else |
| 134 |
errx(EXIT_FAILURE, "Kernel ksrcdir already set"); |
| 135 |
break; |
| 128 |
case 'p': |
136 |
case 'p': |
| 129 |
profiling++; |
137 |
profiling++; |
| 130 |
break; |
138 |
break; |
|
Lines 164-170
main(int argc, char **argv)
Link Here
|
| 164 |
len = strlen(destdir); |
172 |
len = strlen(destdir); |
| 165 |
while (len > 1 && destdir[len - 1] == '/') |
173 |
while (len > 1 && destdir[len - 1] == '/') |
| 166 |
destdir[--len] = '\0'; |
174 |
destdir[--len] = '\0'; |
| 167 |
get_srcdir(); |
175 |
if (*ksrcdir == '\0') |
|
|
176 |
get_srcdir(); |
| 168 |
} else { |
177 |
} else { |
| 169 |
strlcpy(destdir, CDIR, sizeof(destdir)); |
178 |
strlcpy(destdir, CDIR, sizeof(destdir)); |
| 170 |
strlcat(destdir, PREFIX, sizeof(destdir)); |
179 |
strlcat(destdir, PREFIX, sizeof(destdir)); |
|
Lines 210-220
main(int argc, char **argv)
Link Here
|
| 210 |
* for "sys" (to make genassym.c work along with #include <sys/xxx>) |
219 |
* for "sys" (to make genassym.c work along with #include <sys/xxx>) |
| 211 |
* and similarly for "machine". |
220 |
* and similarly for "machine". |
| 212 |
*/ |
221 |
*/ |
| 213 |
if (*srcdir == '\0') |
222 |
if (*ksrcdir != '\0') |
| 214 |
(void)snprintf(xxx, sizeof(xxx), "../../include"); |
|
|
| 215 |
else |
| 216 |
(void)snprintf(xxx, sizeof(xxx), "%s/%s/include", |
223 |
(void)snprintf(xxx, sizeof(xxx), "%s/%s/include", |
|
|
224 |
ksrcdir, machinename); |
| 225 |
else if (*srcdir != '\0') |
| 226 |
(void)snprintf(xxx, sizeof(xxx), "%s/%s/include", |
| 217 |
srcdir, machinename); |
227 |
srcdir, machinename); |
|
|
228 |
else |
| 229 |
(void)snprintf(xxx, sizeof(xxx), "../../include"); |
| 218 |
(void) unlink(path("machine")); |
230 |
(void) unlink(path("machine")); |
| 219 |
(void) symlink(xxx, path("machine")); |
231 |
(void) symlink(xxx, path("machine")); |
| 220 |
if (strcmp(machinename, machinearch) != 0) { |
232 |
if (strcmp(machinename, machinearch) != 0) { |
|
Lines 222-233
main(int argc, char **argv)
Link Here
|
| 222 |
* make symbolic links in compilation directory for |
234 |
* make symbolic links in compilation directory for |
| 223 |
* machinearch, if it is different than machinename. |
235 |
* machinearch, if it is different than machinename. |
| 224 |
*/ |
236 |
*/ |
| 225 |
if (*srcdir == '\0') |
237 |
if (*ksrcdir != '\0') |
|
|
238 |
(void)snprintf(xxx, sizeof(xxx), "%s/%s/include", |
| 239 |
ksrcdir, machinearch); |
| 240 |
else if (*srcdir != '\0') |
| 241 |
(void)snprintf(xxx, sizeof(xxx), "%s/%s/include", |
| 242 |
srcdir, machinearch); |
| 243 |
else |
| 226 |
(void)snprintf(xxx, sizeof(xxx), "../../../%s/include", |
244 |
(void)snprintf(xxx, sizeof(xxx), "../../../%s/include", |
| 227 |
machinearch); |
245 |
machinearch); |
| 228 |
else |
|
|
| 229 |
(void)snprintf(xxx, sizeof(xxx), "%s/%s/include", |
| 230 |
srcdir, machinearch); |
| 231 |
(void) unlink(path(machinearch)); |
246 |
(void) unlink(path(machinearch)); |
| 232 |
(void) symlink(xxx, path(machinearch)); |
247 |
(void) symlink(xxx, path(machinearch)); |
| 233 |
} |
248 |
} |
|
Lines 278-284
static void
Link Here
|
| 278 |
usage(void) |
293 |
usage(void) |
| 279 |
{ |
294 |
{ |
| 280 |
|
295 |
|
| 281 |
fprintf(stderr, "usage: config [-CgpV] [-d destdir] sysname\n"); |
296 |
fprintf(stderr, "usage: config [-CgpV] [-k srcdir] [-d destdir] sysname\n"); |
| 282 |
fprintf(stderr, " config -x kernel\n"); |
297 |
fprintf(stderr, " config -x kernel\n"); |
| 283 |
exit(EX_USAGE); |
298 |
exit(EX_USAGE); |
| 284 |
} |
299 |
} |