--- builtins.c.orig	2006-06-05 12:52:18.000000000 +0200
+++ builtins.c	2014-08-07 15:35:40.000000000 +0200
@@ -134,9 +134,10 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)jmp;
+
 	LIST *targets = lol_get( args, 0 );
 	LIST *sources = lol_get( args, 1 );
-	int which = parse->num;
 	LIST *l;
 
 	for( l = targets; l; l = list_next( l ) )
@@ -173,6 +174,9 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)parse;
+	(void)jmp;
+
 	list_print( lol_get( args, 0 ) );
 	printf( "\n" );
 	return L0;
@@ -191,6 +195,9 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)parse;
+	(void)jmp;
+
 	list_print( lol_get( args, 0 ) );
 	printf( "\n" );
 	exit( EXITBAD ); /* yeech */
@@ -210,6 +217,9 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)parse;
+	(void)jmp;
+
 	LIST *l = lol_get( args, 0 );
 
 	for( ; l; l = list_next( l ) )
@@ -234,6 +244,9 @@
 	int	status,
 	time_t	time )
 {
+	(void)status;
+	(void)time;
+
 	struct globbing *globbing = (struct globbing *)closure;
 	LIST		*l;
 	PATHNAME	f;
@@ -260,6 +273,9 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)parse;
+	(void)jmp;
+
 	LIST *l = lol_get( args, 0 );
 	LIST *r = lol_get( args, 1 );
 
@@ -284,6 +300,9 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)parse;
+	(void)jmp;
+
 	LIST *l, *r;
 	LIST *result = 0;
 
@@ -332,19 +351,22 @@
     LOL      *args,
     int      *jmp )
 {
-  LIST*  l = lol_get( args, 0 );
+	(void)parse;
+	(void)jmp;
 
-  for ( ; l; l = list_next(l) )
-  {
-    TARGET*  t = bindtarget( l->string );
+	LIST*  l = lol_get( args, 0 );
 
-    /* scan file for header filename macro definitions */
-    if ( DEBUG_HEADER )
-      printf( "scanning '%s' for header file macro definitions\n",
-              l->string );
+	for ( ; l; l = list_next(l) )
+	{
+		TARGET*  t = bindtarget( l->string );
 
-    macro_headers( t );
-  }
+		/* scan file for header filename macro definitions */
+		if ( DEBUG_HEADER )
+			printf( "scanning '%s' for header file macro definitions\n",
+					l->string );
 
-  return L0;
+		macro_headers( t );
+	}
+
+	return L0;
 }
--- compile.c.orig	2014-08-07 15:35:58.000000000 +0200
+++ compile.c	2014-08-07 15:36:52.000000000 +0200
@@ -371,6 +371,8 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)jmp;
+
 	/* voodoo 1 means: s is a copyable string */
 	const char *s = parse->string;
 	return var_expand( L0, s, s + strlen( s ), args, 1 );
@@ -434,6 +436,10 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)parse;
+	(void)args;
+	(void)jmp;
+
 	return L0;
 }
 
@@ -692,6 +698,9 @@
 	LOL	*args,
 	int	*jmp )
 {
+	(void)args;
+	(void)jmp;
+
 	RULE	*rule = bindrule( parse->string );
 	LIST	*params = 0;
 	PARSE	*p;
--- execunix.c.orig	2006-06-05 12:52:27.000000000 +0200
+++ execunix.c	2014-08-07 15:38:48.000000000 +0200
@@ -45,6 +45,13 @@
 
 # ifdef USE_EXECUNIX
 
+
+# ifdef OS_FREEBSD
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/wait.h>
+# endif
+
 # ifdef OS_OS2
 # define USE_EXECNT
 # include <process.h>
@@ -85,6 +92,8 @@
 void
 onintr( int disp )
 {
+	(void)disp;
+
 	intr++;
 	printf( "...interrupted\n" );
 }
@@ -231,7 +240,7 @@
 # else
 	if ((pid = vfork()) == 0) 
    	{
-		execvp( argv[0], argv );
+		execvp( argv[0], (char * const *)argv );
 		_exit(127);
 	}
 # endif
--- expand.c.orig	2014-08-07 15:13:43.000000000 +0200
+++ expand.c	2014-08-07 15:16:26.000000000 +0200
@@ -83,7 +83,7 @@
 	int depth;
 
 	if( DEBUG_VAREXP )
-	    printf( "expand '%.*s'\n", end - in, in );
+	    printf( "expand '%.*s'\n", (int)(end - in), in );
 
 	/* This gets alot of cases: $(<) and $(>) */
 
@@ -210,7 +210,7 @@
 
 		strcpy( varname, vars->string );
 
-		if( colon = strchr( varname, MAGIC_COLON ) )
+		if( ( colon = strchr( varname, MAGIC_COLON ) ) )
 		{
 		    *colon = '\0';
 		    var_edit_parse( colon + 1, &edits );
@@ -220,11 +220,11 @@
 		/* sub1 is x (0 default) */
 		/* sub2 is length (-1 means forever) */
 
-		if( bracket = strchr( varname, MAGIC_LEFT ) )
+		if( ( bracket = strchr( varname, MAGIC_LEFT ) ) )
 		{
 		    char *dash;
 
-		    if( dash = strchr( bracket + 1, '-' ) )
+		    if( ( dash = strchr( bracket + 1, '-' ) ) )
 			*dash = '\0';
 
 		    sub1 = atoi( bracket + 1 ) - 1;
@@ -454,7 +454,7 @@
 		fp->ptr = "";
 		fp->len = 0;
 	    }
-	    else if( p = strchr( mods, MAGIC_COLON ) )
+	    else if( ( p = strchr( mods, MAGIC_COLON ) ) )
 	    {
 		*p = 0;
 		fp->ptr = ++mods;
@@ -544,7 +544,7 @@
 var_edit_quote( char  *out )
 {
   /* Handle quoting now */
-  int    count, len;
+  int    count;
   char*  p = out;
   char*  q;
 
--- fileunix.c.orig	2014-08-07 15:16:40.000000000 +0200
+++ fileunix.c	2014-08-07 15:18:11.000000000 +0200
@@ -51,6 +51,11 @@
 #   include <sys/stat.h>
 # endif
 
+# if defined( OS_FREEBSD )
+# include <sys/types.h>
+# include <unistd.h>
+# endif
+
 # if defined( OS_RHAPSODY ) || \
      defined( OS_MACOSX ) || \
      defined( OS_NEXT )
@@ -141,7 +146,7 @@
 	if( DEBUG_BINDSCAN )
 	    printf( "scan directory %s\n", dir );
 
-	while( dirent = readdir( d ) )
+	while( ( dirent = readdir( d ) ) )
 	{
 # ifdef old_sinix
 	    /* Broken structure definition on sinix. */
--- hash.c.orig	2014-08-07 15:18:25.000000000 +0200
+++ hash.c	2014-08-07 15:19:06.000000000 +0200
@@ -239,14 +239,14 @@
 
 	for( i = nel; i > 0; i-- )
 	{
-		if( here = ( *tab++ != (ITEM *)0 ) )
+		if( ( here = ( *tab++ != (ITEM *)0 ) ) )
 			count++;
 		if( here && !run )
 			sets++;
 		run = here;
 	}
 
-	printf( "%s table: %d+%d+%d (%dK+%dK) items+table+hash, %f density\n",
+	printf( "%s table: %d+%d+%d (%dK+%zuK) items+table+hash, %f density\n",
 		hp->name, 
 		count, 
 		hp->items.nel,
--- hdrmacro.c.orig	2014-08-07 15:19:17.000000000 +0200
+++ hdrmacro.c	2014-08-07 15:23:19.000000000 +0200
@@ -39,8 +39,6 @@
  *		just to invoke a rule.
  */
 
-static LIST *header_macros1( LIST *l, char *file, int rec, regexp *re[] );
-
 /* this type is used to store a dictionary of file header macros */
 typedef struct header_macro
 {
@@ -60,11 +58,9 @@
 void
 macro_headers( TARGET *t )
 {
-	LIST	*hdrrule;
 	regexp	*re;
 	FILE	*f;
 	char	buf[ 1024 ];
-	int	i;
 
     if ( DEBUG_HEADER )
       printf( "macro header scan for %s\n", t->name );
--- headers.c.orig	2014-08-07 15:23:32.000000000 +0200
+++ headers.c	2014-08-07 15:23:38.000000000 +0200
@@ -53,7 +53,6 @@
 {
 	LIST	*hdrscan;
 	LIST	*hdrrule;
-	LIST	*hdrcache;
 	LOL	lol;
 
 	if( !( hdrscan = var_get( "HDRSCAN" ) ) || 
--- jam.c.orig	2014-08-07 15:39:04.000000000 +0200
+++ jam.c	2014-08-07 15:39:24.000000000 +0200
@@ -167,7 +167,7 @@
 # endif
 
 int
-main( int argc, char **argv, char **arg_environ )
+main( int argc, char **argv )
 {
 	int		n, num_targets;
 	const char	*s;
--- lists.c.orig	2014-08-07 15:25:31.000000000 +0200
+++ lists.c	2014-08-07 15:26:01.000000000 +0200
@@ -190,7 +190,7 @@
 
 	    /* Any embedded "'s?  Escape them */
 
-	    while( p = (char *)memchr( op, '"',  ep - op ) )
+	    while( ( p = (char *)memchr( op, '"',  ep - op ) ) )
 	    {
 		fwrite( op, p - op, 1, out );
 		fputc( '\\', out );
--- make.c.orig	2014-08-07 15:26:13.000000000 +0200
+++ make.c	2014-08-07 15:27:53.000000000 +0200
@@ -69,6 +69,10 @@
 # define max( a,b ) ((a)>(b)?(a):(b))
 # endif
 
+# if defined ( OS_FREEBSD )
+# include <unistd.h> // unlink(2)
+# endif
+
 typedef struct {
 	int	temp;
 	int	updating;
@@ -169,7 +173,7 @@
 	COUNTS	*counts,	/* for reporting */
 	int	anyhow )	/* forcibly touch all (real) targets */
 {
-	TARGETS	*c, *d, *incs;
+	TARGETS	*c, *incs;
 	TARGET 	*ptime = t;
 	time_t	last, leaf, hlast;
 	int	fate;
@@ -246,7 +250,7 @@
 	    case T_BIND_MISSING:
 	    case T_BIND_PARENTS:
 		printf( "time\t--\t%s%s: %s\n",
-			spaces( depth ), t->name, target_bind[ t->binding ] );
+			spaces( depth ), t->name, target_bind[ (int)t->binding ] );
 		break;
 
 	    case T_BIND_EXISTS:
@@ -481,13 +485,13 @@
 
 	if( DEBUG_MAKEPROG )
 	    printf( "made%s\t%s\t%s%s\n",
-		flag, target_fate[ t->fate ],
+		flag, target_fate[ (int)t->fate ],
 		spaces( depth ), t->name );
 
 	if( DEBUG_CAUSES &&
 	    t->fate >= T_FATE_NEWER &&
 	    t->fate <= T_FATE_MISSING )
-		printf( "%s %s\n", target_fate[ t->fate ], t->name );
+		printf( "%s %s\n", target_fate[ (int)t->fate ], t->name );
 }
 
 /*
--- make1.c.orig	2014-08-07 15:28:04.000000000 +0200
+++ make1.c	2014-08-07 15:28:43.000000000 +0200
@@ -62,6 +62,10 @@
 # include "command.h"
 # include "execcmd.h"
 
+# if defined ( OS_FREEBSD )
+# include <unistd.h> // unlink(2)
+# endif
+
 static void make1a( TARGET *t, TARGET *parent );
 static void make1b( TARGET *t );
 static void make1c( TARGET *t );
@@ -426,7 +430,6 @@
 	    SETTINGS *boundvars;
 	    LIST    *nt, *ns;
 	    ACTIONS *a1;
-	    CMD	    *cmd;
 	    int	    start, chunk, length, maxline;
 
 	    /* Only do rules with commands to execute. */
--- mkjambase.c.orig	2014-08-07 15:44:34.000000000 +0200
+++ mkjambase.c	2014-08-07 15:44:46.000000000 +0200
@@ -24,7 +24,7 @@
 # include <stdio.h>
 # include <string.h>
 
-main( int argc, char **argv, char **envp )
+int main( int argc, char **argv, char **envp )
 {
 	char buf[ 1024 ];
 	FILE *fin;
--- newstr.c.orig	2014-08-07 15:39:56.000000000 +0200
+++ newstr.c	2014-08-07 15:40:34.000000000 +0200
@@ -82,6 +82,7 @@
 void
 freestr( const char *s )
 {
+	(void)s; // is this supposed to be free(s); ?
 }
 
 /*
--- pathunix.c.orig	2006-06-05 12:52:12.000000000 +0200
+++ pathunix.c	2014-08-07 15:41:24.000000000 +0200
@@ -110,7 +110,7 @@
 	p = 0;
 	q = file;
 
-	while( q = (char *)memchr( q, '.', end - q ) )
+	while( ( q = (char *)memchr( q, '.', end - q ) ) )
 	    p = q++;
 
 	if( p )
@@ -136,6 +136,7 @@
 	char	*file,
 	int	binding )
 {
+	(void)binding;
 	/* Start with the grist.  If the current grist isn't */
 	/* surrounded by <>'s, add them. */
 
--- rules.c.orig	2014-08-07 15:29:24.000000000 +0200
+++ rules.c	2014-08-07 15:29:43.000000000 +0200
@@ -185,8 +185,6 @@
 	TARGETS	*chain,
 	TARGETS	*targets )
 {
-	TARGETS *c;
-
 	if( !targets )
 	    return chain;
 	else if( !chain )
@@ -297,7 +295,7 @@
 SETTINGS *
 copysettings( SETTINGS *from )
 {
-	SETTINGS *head = 0, *v;
+	SETTINGS *head = 0;
 
 	for( ; from; from = from->next )
 	{
--- search.c.orig	2014-08-07 15:30:23.000000000 +0200
+++ search.c	2014-08-07 15:30:50.000000000 +0200
@@ -34,7 +34,7 @@
 	f->f_grist.ptr = 0;
 	f->f_grist.len = 0;
 
-	if( varlist = var_get( "LOCATE" ) )
+	if( ( varlist = var_get( "LOCATE" ) ) )
 	{
 	    f->f_root.ptr = varlist->string;
 	    f->f_root.len = strlen( varlist->string );
@@ -48,7 +48,7 @@
 
 	    return newstr( buf );
 	}
-	else if( varlist = var_get( "SEARCH" ) )
+	else if( ( varlist = var_get( "SEARCH" ) ) )
 	{
 	    while( varlist )
 	    {
--- variable.c.orig	2006-06-05 12:52:08.000000000 +0200
+++ variable.c	2014-08-07 15:43:50.000000000 +0200
@@ -88,7 +88,7 @@
 	
 	    if( ( val = strchr( *e, '=' ) ) || ( val = *e + strlen( *e ) ) )
 # else
-	    if( val = strchr( *e, '=' ) )
+	    if( ( val = strchr( *e, '=' ) ) )
 # endif
 	    {
 		LIST *l = L0;
@@ -112,11 +112,11 @@
 
 		/* Do the split */
 
-		for( pp = val + 1; p = strchr( pp, split ); pp = p + 1 )
+		for( pp = val + 1; ( p = strchr( pp, split ) ); pp = p + 1 )
 		{
-		    int  len = p - pp;
+		    size_t len = p - pp;
 
-		    if ( len >= sizeof(buf) )
+		    if ( ( len >= sizeof(buf) ) )
 		      len = sizeof(buf)-1;
 
 		    strncpy( buf, pp, len );
@@ -203,7 +203,7 @@
 
 		    /* Separate with space */
 
-		    if( l = list_next( l ) )
+		    if( ( l = list_next( l ) ) )
 		    *out++ = ' ';
 		}
 
