Greetings, here's a set of diffs that will allow FreeBSD's usr.bin/make to build on Linux. I'm sure they are gross, and I don't plan to commit them (at least not all of them), but I thought I'd post them here to see what people think.
I think that the extra config.h includes, the errc -> errx patches and the Makefile.dist patches may be good for the tree. The rest may not meet FreeBSD's source tree policies. Comments? Warner diff -ur pmake.orig/config.h pmake/config.h --- pmake.orig/config.h 2005-02-01 03:50:35.000000000 -0700 +++ pmake/config.h 2008-03-03 22:24:16.745493000 -0700 @@ -108,4 +108,27 @@ # endif #endif +#ifndef TAILQ_HEAD_INITIALIZER +#define TAILQ_HEAD_INITIALIZER(head) { NULL, &(head).tqh_first } +#endif + +#ifndef TAILQ_FOREACH +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = TAILQ_FIRST((head)); \ + (var); \ + (var) = TAILQ_NEXT((var), field)) +#endif + +#ifndef TAILQ_FIRST +#define TAILQ_FIRST(head) ((head)->tqh_first) +#endif + +#ifndef TAILQ_NEXT +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) +#endif + +#ifndef TAILQ_EMPTY +#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) +#endif + #endif /* config_h_efe0765e */ diff -ur pmake.orig/dir.c pmake/dir.c --- pmake.orig/dir.c 2005-03-23 05:56:15.000000000 -0700 +++ pmake/dir.c 2008-03-03 22:22:36.072235000 -0700 @@ -93,6 +93,7 @@ #include <unistd.h> #include "arch.h" +#include "config.h" #include "dir.h" #include "globals.h" #include "GNode.h" Only in pmake: log diff -ur pmake.orig/main.c pmake/main.c --- pmake.orig/main.c 2007-12-18 15:58:14.000000000 -0700 +++ pmake/main.c 2008-03-03 22:25:47.543349000 -0700 @@ -63,7 +63,9 @@ #include <sys/param.h> #include <sys/stat.h> +#ifdef __FreeBSD__ #include <sys/sysctl.h> +#endif #include <sys/time.h> #include <sys/queue.h> #include <sys/resource.h> @@ -366,7 +368,9 @@ rearg: optind = 1; /* since we're called more than once */ +#ifndef linux optreset = 1; +#endif #define OPTFLAGS "ABC:D:E:I:PSV:Xd:ef:ij:km:nqrstvx:" for (;;) { if ((optind < argc) && strcmp(argv[optind], "--") == 0) { @@ -660,11 +664,9 @@ int level = (value == NULL) ? 0 : atoi(value); if (level < 0) { - errc(2, EAGAIN, "Invalid value for recursion level (%d).", - level); + errx(2, "Invalid value for recursion level (%d).", level); } else if (level > MKLVL_MAXVAL) { - errc(2, EAGAIN, "Max recursion level (%d) exceeded.", - MKLVL_MAXVAL); + errx(2, "Max recursion level (%d) exceeded.", MKLVL_MAXVAL); } else { char new_value[32]; sprintf(new_value, "%d", level + 1); @@ -931,6 +933,7 @@ } #endif +#ifdef __FreeBSD__ /* * FreeBSD/pc98 kernel used to set the utsname.machine to * "i386", and MACHINE was defined as "i386", so it could @@ -951,6 +954,7 @@ machine = "pc98"; } } +#endif /* * Get the name of this type of MACHINE from utsname diff -ur pmake.orig/Makefile.dist pmake/Makefile.dist --- pmake.orig/Makefile.dist 2007-12-18 15:58:14.000000000 -0700 +++ pmake/Makefile.dist 2008-03-03 22:27:31.711240000 -0700 @@ -2,7 +2,7 @@ # a simple makefile to help builds on !FreeBSD systems pmake: @echo 'make started.' - cc -D__FBSDID="static const char *id=" -DDEFSHELLNAME=\"sh\" -I. -c *.c + cc -D__dead2="" -D__unused="" -Darc4random=random -D__FBSDID="static const char *id=" -DDEFSHELLNAME=\"sh\" -I. -c *.c cc *.o -o pmake @echo 'make completed.' diff -ur pmake.orig/shell.c pmake/shell.c --- pmake.orig/shell.c 2005-05-24 09:30:03.000000000 -0600 +++ pmake/shell.c 2008-03-03 22:20:08.597377000 -0700 @@ -45,6 +45,7 @@ #include <stdlib.h> #include <string.h> +#include "config.h" #include "parse.h" #include "pathnames.h" #include "shell.h" _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"