aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1996-05-09 18:02:06 +0000
committerRoland McGrath <roland@redhat.com>1996-05-09 18:02:06 +0000
commite99a3aca7ec9796973a7e4d93676c5c13483a948 (patch)
tree7f890ef18c4ef6a0b5eac55013b70b7dea4a3a58 /main.c
parent73c52a3b125b08bb1f86230c4c1238e6f441c148 (diff)
downloadgunmake-e99a3aca7ec9796973a7e4d93676c5c13483a948.tar.gz
Thu May 9 13:54:49 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* GNUmakefile (globfiles): Add AmigaDOS support files. (distfiles): Add $(amigafiles). (amigafiles): New variable. Thu Nov 7 10:18:16 1995 Aaron Digulla <digulla@fh-konstanz.de> * Added Amiga support in commands.c, dir.c, function.c, job.c, main.c, make.h, read.c, remake.c * commands.c: Amiga has neither SIGHUP nor SIGQUIT * dir.c: Amiga has filenames with Upper- and Lowercase, but "FileName" is the same as "filename". Added strieq() which is use to compare filenames. This is like streq() on all other systems. Also there is no such thing as "." under AmigaDOS. * function.c: On Amiga, the environment is not passed as envp, there are no pipes and Amiga can't fork. Use my own function to create a new child. * job.c: default_shell is "" (The system automatically chooses a shell for me). Have to use the same workaround as MSDOS for running batch commands. Added HAVE_SYS_PARAM_H. NOFILE isn't known on Amiga. Cloned code to run children from MSDOS. Own version of sh_chars[] and sh_cmds[]. No dup2() or dup() on Amiga. * main.c: Force stack to 20000 bytes. Read environment from ENV: device. On Amiga, exec_command() does return, so I exit() afterwards. * make.h: Added strieq() to compare filenames. * read.c: Amiga needs special extension to have passwd. Only one include-dir. "Makefile" and "makefile" are the same. Added "SMakefile". Added special code to handle device names (xxx:) and "./" in rules. * remake.c: Only one lib-dir. Amiga link-libs are named "%s.lib" instead of "lib%s.a". * main.c, rule.c, variable.c: Avoid floats at all costs. * vpath.c: Get rid of as many alloca()s as possible.
Diffstat (limited to 'main.c')
-rw-r--r--main.c78
1 files changed, 77 insertions, 1 deletions
diff --git a/main.c b/main.c
index efbd70e..3525fed 100644
--- a/main.c
+++ b/main.c
@@ -174,9 +174,13 @@ static unsigned int inf_jobs = 0;
Negative values mean unlimited, while zero means limit to
zero load (which could be useful to start infinite jobs remotely
but one at a time locally). */
-
+#ifndef NO_FLOAT
double max_load_average = -1.0;
double default_load_average = -1.0;
+#else
+int max_load_average = -1;
+int default_load_average = -1;
+#endif
/* List of directories given with -C switches. */
@@ -239,10 +243,17 @@ static const struct command_switch switches[] =
0, (char *) &default_keep_going_flag,
"keep-going", 0,
"Keep going when some targets can't be made" },
+#ifndef NO_FLOAT
{ 'l', floating, (char *) &max_load_average, 1, 1, 0,
(char *) &default_load_average, (char *) &default_load_average,
"load-average", "N",
"Don't start multiple jobs unless load is below N" },
+#else
+ { 'l', positive_int, (char *) &max_load_average, 1, 1, 0,
+ (char *) &default_load_average, (char *) &default_load_average,
+ "load-average", "N",
+ "Don't start multiple jobs unless load is below N" },
+#endif
{ 'm', ignore, 0, 0, 0, 0, 0, 0,
0, 0,
"-b" },
@@ -414,11 +425,15 @@ debug_signal_handler (sig)
debug_flag = ! debug_flag;
}
+#ifndef _AMIGA
int
main (argc, argv, envp)
int argc;
char **argv;
char **envp;
+#else
+int main (int argc, char ** argv)
+#endif
{
register struct file *f;
register unsigned int i;
@@ -452,8 +467,12 @@ main (argc, argv, envp)
else \
ADD_SIG (sig);
+#ifdef SIGHUP
FATAL_SIG (SIGHUP);
+#endif
+#ifdef SIGQUIT
FATAL_SIG (SIGQUIT);
+#endif
FATAL_SIG (SIGINT);
FATAL_SIG (SIGTERM);
@@ -530,6 +549,7 @@ main (argc, argv, envp)
done before $(MAKE) is are figured out so its definitions will not be
one from the environment. */
+#ifndef _AMIGA
for (i = 0; envp[i] != 0; ++i)
{
register char *ep = envp[i];
@@ -547,6 +567,41 @@ main (argc, argv, envp)
be exported, because it was originally in the environment. */
->export = v_export;
}
+#else /* For Amiga, read the ENV: device, ignoring all dirs */
+ {
+ BPTR env, file, old;
+ char buffer[1024];
+ int len;
+ __aligned struct FileInfoBlock fib;
+
+ env = Lock ("ENV:", ACCESS_READ);
+ if (env)
+ {
+ old = CurrentDir (DupLock(env));
+ Examine (env, &fib);
+
+ while (ExNext (env, &fib))
+ {
+ if (fib.fib_DirEntryType < 0) /* File */
+ {
+ file = Open (fib.fib_FileName, MODE_OLDFILE);
+
+ if (file)
+ {
+ len = Read (file, buffer, sizeof (buffer)-1);
+ buffer[len] = 0;
+
+ define_variable (fib.fib_FileName,
+ strlen (fib.fib_FileName),
+ buffer, o_env, 1)->export = v_export;
+ }
+ }
+ }
+ UnLock (env);
+ UnLock(CurrentDir(old));
+ }
+ }
+#endif
/* Decode the switches. */
@@ -1051,6 +1106,7 @@ main (argc, argv, envp)
fatal ("Couldn't change back to original directory.");
}
+#ifndef _AMIGA
for (p = environ; *p != 0; ++p)
if (!strncmp (*p, "MAKELEVEL=", 10))
{
@@ -1063,6 +1119,17 @@ main (argc, argv, envp)
sprintf (*p, "MAKELEVEL=%u", makelevel);
break;
}
+#else /* AMIGA */
+# include <dos/dos.h>
+# include <proto/dos.h>
+ {
+ char buffer[256];
+ int len;
+
+ sprintf (buffer, "%u", makelevel);
+ SetVar ("MAKELEVEL", buffer, -1, GVF_LOCAL_ONLY);
+ }
+#endif
if (debug_flag)
{
@@ -1076,7 +1143,12 @@ main (argc, argv, envp)
fflush (stdout);
fflush (stderr);
+#ifndef _AMIGA
exec_command (argv, environ);
+#else
+ exec_command (argv);
+ exit (0);
+#endif
/* NOTREACHED */
}
}
@@ -1372,6 +1444,7 @@ positive integral argument",
= *(unsigned int *) cs->noarg_value;
break;
+#ifndef NO_FLOAT
case floating:
if (optarg == 0 && optind < argc
&& (isdigit (argv[optind][0]) || argv[optind][0] == '.'))
@@ -1383,6 +1456,7 @@ positive integral argument",
: *(double *) cs->noarg_value);
break;
+#endif
}
/* We've found the switch. Stop looking. */
@@ -1702,6 +1776,7 @@ define_makeflags (all, makefile)
}
break;
+#ifndef NO_FLOAT
case floating:
if (all)
{
@@ -1721,6 +1796,7 @@ define_makeflags (all, makefile)
}
}
break;
+#endif
case string:
if (all)