Various fixes to the tree to get coreboot-v2 to build on Solaris

- Replace $(PWD) with $(CURDIR) in Makefiles. I don't know why
  the Solaris version behaves differently, but CURDIR is a safe
  choice on gnu make (and we require gnu make already)
- Use tail -1 instead of tail -n1 in a file that already relies on
  tail -1 support in another place
- Use tail -1 as alternative to tail -n1 in another place
- Use #define for ulong_t in romcc, as that name is used on Solaris
- Avoid fprinting a null pointer. The standard doesn't mandate that
  this is a special case, and Solaris doesn't implement it that way.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>

Index: src/mainboard/iwill/dk8_htx/Config.lb
===================================================================
--- src/mainboard/iwill/dk8_htx/Config.lb	(revision 4298)
+++ src/mainboard/iwill/dk8_htx/Config.lb	(working copy)
@@ -44,7 +44,7 @@
         object fadt.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/dx/dsdt_lb.dsl"
-		action  "iasl -p $(PWD)/dsdt_lb -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
+		action  "iasl -p $(CURDIR)/dsdt_lb -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
 		action  "mv dsdt_lb.hex dsdt.c"
 	end
         object ./dsdt.o
@@ -54,28 +54,28 @@
         if ACPI_SSDTX_NUM
             makerule ssdt2.c
                         depends "$(MAINBOARD)/dx/pci2.asl"
-                        action  "iasl -p $(PWD)/pci2 -tc $(MAINBOARD)/dx/pci2.asl"
+                        action  "iasl -p $(CURDIR)/pci2 -tc $(MAINBOARD)/dx/pci2.asl"
                         action  "perl -pi -e 's/AmlCode/AmlCode_ssdt2/g' pci2.hex"
                         action  "mv pci2.hex ssdt2.c"
             end
             object ./ssdt2.o
             makerule ssdt3.c
                         depends "$(MAINBOARD)/dx/pci3.asl"
-                        action  "iasl -p $(PWD)/pci3 -tc $(MAINBOARD)/dx/pci3.asl"
+                        action  "iasl -p $(CURDIR)/pci3 -tc $(MAINBOARD)/dx/pci3.asl"
                         action  "perl -pi -e 's/AmlCode/AmlCode_ssdt3/g' pci3.hex"
                         action  "mv pci3.hex ssdt3.c"
             end
             object ./ssdt3.o
             makerule ssdt4.c
                         depends "$(MAINBOARD)/dx/pci4.asl"
-                        action  "iasl -p $(PWD)/pci4 -tc $(MAINBOARD)/dx/pci4.asl"
+                        action  "iasl -p $(CURDIR)/pci4 -tc $(MAINBOARD)/dx/pci4.asl"
                         action  "perl -pi -e 's/AmlCode/AmlCode_ssdt4/g' pci4.hex"
                         action  "mv pci4.hex ssdt4.c"
             end
             object ./ssdt4.o
             makerule ssdt5.c
                         depends "$(MAINBOARD)/dx/pci5.asl"
-                        action  "iasl -p $(PWD)/pci5 -tc $(MAINBOARD)/dx/pci5.asl"
+                        action  "iasl -p $(CURDIR)/pci5 -tc $(MAINBOARD)/dx/pci5.asl"
                         action  "perl -pi -e 's/AmlCode/AmlCode_ssdt5/g' pci5.hex"
                         action  "mv pci5.hex ssdt5.c"
             end
Index: src/mainboard/kontron/986lcd-m/Config.lb
===================================================================
--- src/mainboard/kontron/986lcd-m/Config.lb	(revision 4298)
+++ src/mainboard/kontron/986lcd-m/Config.lb	(working copy)
@@ -52,7 +52,7 @@
 	makerule dsdt.c
 		depends "$(MAINBOARD)/dsdt.asl"
 		action  "iasl -p dsdt -tc $(MAINBOARD)/dsdt.asl"
-		action  "mv $(PWD)/dsdt.hex dsdt.c"
+		action  "mv $(CURDIR)/dsdt.hex dsdt.c"
 	end
 	object ./dsdt.o
 end
Index: src/mainboard/amd/pistachio/Config.lb
===================================================================
--- src/mainboard/amd/pistachio/Config.lb	(revision 4298)
+++ src/mainboard/amd/pistachio/Config.lb	(working copy)
@@ -42,7 +42,7 @@
 	object fadt.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/acpi/*.asl"
-		action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/acpi/dsdt.asl"
+		action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/acpi/dsdt.asl"
 		action  "mv dsdt.hex dsdt.c"
 	end
 	object ./dsdt.o
Index: src/mainboard/amd/dbm690t/Config.lb
===================================================================
--- src/mainboard/amd/dbm690t/Config.lb	(revision 4298)
+++ src/mainboard/amd/dbm690t/Config.lb	(working copy)
@@ -42,7 +42,7 @@
 	object fadt.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/acpi/*.asl"
-		action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/acpi/dsdt.asl"
+		action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/acpi/dsdt.asl"
 		action  "mv dsdt.hex dsdt.c"
 	end
 	object ./dsdt.o
Index: src/mainboard/amd/serengeti_cheetah/Config.lb
===================================================================
--- src/mainboard/amd/serengeti_cheetah/Config.lb	(revision 4298)
+++ src/mainboard/amd/serengeti_cheetah/Config.lb	(working copy)
@@ -44,7 +44,7 @@
         object fadt.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/dx/dsdt_lb.dsl"
-		action  "iasl -p $(PWD)/dsdt_lb -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
+		action  "iasl -p $(CURDIR)/dsdt_lb -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
 		action  "mv dsdt_lb.hex dsdt.c"
 	end
         object ./dsdt.o
@@ -54,21 +54,21 @@
         if ACPI_SSDTX_NUM
             makerule ssdt2.c
                         depends "$(MAINBOARD)/dx/pci2.asl"
-                        action  "iasl -p $(PWD)/pci2 -tc $(MAINBOARD)/dx/pci2.asl"
+                        action  "iasl -p $(CURDIR)/pci2 -tc $(MAINBOARD)/dx/pci2.asl"
                         action  "perl -pi -e 's/AmlCode/AmlCode_ssdt2/g' pci2.hex"
                         action  "mv pci2.hex ssdt2.c"
             end
             object ./ssdt2.o
             makerule ssdt3.c
                         depends "$(MAINBOARD)/dx/pci3.asl"
-                        action  "iasl -p $(PWD)/pci3 -tc $(MAINBOARD)/dx/pci3.asl"
+                        action  "iasl -p $(CURDIR)/pci3 -tc $(MAINBOARD)/dx/pci3.asl"
                         action  "perl -pi -e 's/AmlCode/AmlCode_ssdt3/g' pci3.hex"
                         action  "mv pci3.hex ssdt3.c"
             end
             object ./ssdt3.o
             makerule ssdt4.c
                         depends "$(MAINBOARD)/dx/pci4.asl"
-                        action  "iasl -p $(PWD)/pci4 -tc $(MAINBOARD)/dx/pci4.asl"
+                        action  "iasl -p $(CURDIR)/pci4 -tc $(MAINBOARD)/dx/pci4.asl"
                         action  "perl -pi -e 's/AmlCode/AmlCode_ssdt4/g' pci4.hex"
                         action  "mv pci4.hex ssdt4.c"
             end
Index: src/mainboard/amd/serengeti_cheetah_fam10/Config.lb
===================================================================
--- src/mainboard/amd/serengeti_cheetah_fam10/Config.lb	(revision 4298)
+++ src/mainboard/amd/serengeti_cheetah_fam10/Config.lb	(working copy)
@@ -44,7 +44,7 @@
 	 object fadt.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/dx/dsdt_lb.dsl"
-		action	"iasl -p $(PWD)/dsdt_lb -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
+		action	"iasl -p $(CURDIR)/dsdt_lb -tc $(MAINBOARD)/dx/dsdt_lb.dsl"
 		action	"mv dsdt_lb.hex dsdt.c"
 	end
 	 object ./dsdt.o
@@ -54,28 +54,28 @@
 	if ACPI_SSDTX_NUM
 	makerule ssdt2.c
 		depends "$(MAINBOARD)/dx/pci2.asl"
-		action	"iasl -p $(PWD)/pci2 -tc $(MAINBOARD)/dx/pci2.asl"
+		action	"iasl -p $(CURDIR)/pci2 -tc $(MAINBOARD)/dx/pci2.asl"
 		action	"perl -pi -e 's/AmlCode/AmlCode_ssdt2/g' pci2.hex"
 		action	"mv pci2.hex ssdt2.c"
 	end
 	object ./ssdt2.o
 	makerule ssdt3.c
 		depends "$(MAINBOARD)/dx/pci3.asl"
-		action	"iasl -p $(PWD)/pci3 -tc $(MAINBOARD)/dx/pci3.asl"
+		action	"iasl -p $(CURDIR)/pci3 -tc $(MAINBOARD)/dx/pci3.asl"
 		action	"perl -pi -e 's/AmlCode/AmlCode_ssdt3/g' pci3.hex"
 		action	"mv pci3.hex ssdt3.c"
 	end
 	object ./ssdt3.o
 	makerule ssdt4.c
 		depends "$(MAINBOARD)/dx/pci4.asl"
-		action	"iasl -p $(PWD)/pci4 -tc $(MAINBOARD)/dx/pci4.asl"
+		action	"iasl -p $(CURDIR)/pci4 -tc $(MAINBOARD)/dx/pci4.asl"
 		action	"perl -pi -e 's/AmlCode/AmlCode_ssdt4/g' pci4.hex"
 		action	"mv pci4.hex ssdt4.c"
 	end
 	object ./ssdt4.o
 	makerule ssdt5.c
 		depends "$(MAINBOARD)/dx/pci5.asl"
-		action	"iasl -p $(PWD)/pci5 -tc $(MAINBOARD)/dx/pci5.asl"
+		action	"iasl -p $(CURDIR)/pci5 -tc $(MAINBOARD)/dx/pci5.asl"
 		action	"perl -pi -e 's/AmlCode/AmlCode_ssdt5/g' pci5.hex"
 		action	"mv pci5.hex ssdt5.c"
 	end
Index: src/mainboard/tyan/s2891/Config.lb
===================================================================
--- src/mainboard/tyan/s2891/Config.lb	(revision 4298)
+++ src/mainboard/tyan/s2891/Config.lb	(working copy)
@@ -22,7 +22,7 @@
         object acpi_tables.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/dsdt.dsl"
-		action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/dsdt.dsl"
+		action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/dsdt.dsl"
 		action  "mv dsdt.hex dsdt.c"
 	end
         object ./dsdt.o
Index: src/mainboard/tyan/s2892/Config.lb
===================================================================
--- src/mainboard/tyan/s2892/Config.lb	(revision 4298)
+++ src/mainboard/tyan/s2892/Config.lb	(working copy)
@@ -23,7 +23,7 @@
         object acpi_tables.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/dsdt.dsl"
-		action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/dsdt.dsl"
+		action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/dsdt.dsl"
 		action  "mv dsdt.hex dsdt.c"
 	end
         object ./dsdt.o
Index: src/mainboard/tyan/s2895/Config.lb
===================================================================
--- src/mainboard/tyan/s2895/Config.lb	(revision 4298)
+++ src/mainboard/tyan/s2895/Config.lb	(working copy)
@@ -18,7 +18,7 @@
         object acpi_tables.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/dsdt.dsl"
-		action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/dsdt.dsl"
+		action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/dsdt.dsl"
 		action  "mv dsdt.hex dsdt.c"
 	end
         object ./dsdt.o
Index: src/mainboard/technexion/tim8690/Config.lb
===================================================================
--- src/mainboard/technexion/tim8690/Config.lb	(revision 4298)
+++ src/mainboard/technexion/tim8690/Config.lb	(working copy)
@@ -42,7 +42,7 @@
 	object fadt.o
 	makerule dsdt.c
 		depends "$(MAINBOARD)/acpi/*.asl"
-		action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/acpi/dsdt.asl"
+		action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/acpi/dsdt.asl"
 		action  "mv dsdt.hex dsdt.c"
 	end
 	object ./dsdt.o
Index: src/mainboard/asus/a8v-e_se/Config.lb
===================================================================
--- src/mainboard/asus/a8v-e_se/Config.lb	(revision 4298)
+++ src/mainboard/asus/a8v-e_se/Config.lb	(working copy)
@@ -31,7 +31,7 @@
   object fadt.o
   makerule dsdt.c
     depends "$(MAINBOARD)/dsdt.asl"
-    action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/dsdt.asl"
+    action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/dsdt.asl"
     action  "mv dsdt.hex dsdt.c"
   end
   object ./dsdt.o
Index: src/mainboard/asus/m2v-mx_se/Config.lb
===================================================================
--- src/mainboard/asus/m2v-mx_se/Config.lb	(revision 4298)
+++ src/mainboard/asus/m2v-mx_se/Config.lb	(working copy)
@@ -30,7 +30,7 @@
   object fadt.o
   makerule dsdt.c
     depends "$(MAINBOARD)/dsdt.asl"
-    action  "iasl -p $(PWD)/dsdt -tc $(MAINBOARD)/dsdt.asl"
+    action  "iasl -p $(CURDIR)/dsdt -tc $(MAINBOARD)/dsdt.asl"
     action  "mv dsdt.hex dsdt.c"
   end
   object ./dsdt.o
Index: src/config/Options.lb
===================================================================
--- src/config/Options.lb	(revision 4298)
+++ src/config/Options.lb	(working copy)
@@ -143,7 +143,7 @@
 	comment "Build domain name"
 end
 define COREBOOT_COMPILER
-	default "$(shell $(CC) $(CFLAGS) -v 2>&1 | tail -n 1)"
+	default "$(shell $(CC) $(CFLAGS) -v 2>&1 | tail -1)"
 	export always
 	format "\"%s\""
 	comment "Build compiler"
Index: src/northbridge/amd/amdfam10/Config.lb
===================================================================
--- src/northbridge/amd/amdfam10/Config.lb	(revision 4298)
+++ src/northbridge/amd/amdfam10/Config.lb	(working copy)
@@ -33,42 +33,42 @@
 	object amdfam10_acpi.o
 	makerule ssdt.c
 		depends "$(TOP)/src/northbridge/amd/amdfam10/ssdt.dsl"
-		action	 "iasl -p $(PWD)/ssdt -tc $(TOP)/src/northbridge/amd/amdfam10/ssdt.dsl"
+		action	 "iasl -p $(CURDIR)/ssdt -tc $(TOP)/src/northbridge/amd/amdfam10/ssdt.dsl"
 		action	 "perl -pi -e 's/AmlCode/AmlCode_ssdt/g' ssdt.hex"
 		action	 "mv ssdt.hex ssdt.c"
 	end
 	object ./ssdt.o
 	makerule sspr1.c
 		depends "$(TOP)/src/northbridge/amd/amdfam10/sspr1.dsl"
-		action	 "iasl -p $(PWD)/sspr1 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr1.dsl"
+		action	 "iasl -p $(CURDIR)/sspr1 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr1.dsl"
 		action	 "perl -pi -e 's/AmlCode/AmlCode_sspr1/g' sspr1.hex"
 		action	 "mv sspr1.hex sspr1.c"
 	end
 	object ./sspr1.o
 	makerule sspr2.c
 		depends "$(TOP)/src/northbridge/amd/amdfam10/sspr2.dsl"
-		action	 "iasl -p $(PWD)/sspr2 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr2.dsl"
+		action	 "iasl -p $(CURDIR)/sspr2 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr2.dsl"
 		action	 "perl -pi -e 's/AmlCode/AmlCode_sspr2/g' sspr2.hex"
 		action	 "mv sspr2.hex sspr2.c"
 	end
 	object ./sspr2.o
 	makerule sspr3.c
 		depends "$(TOP)/src/northbridge/amd/amdfam10/sspr3.dsl"
-		action	 "iasl -p $(PWD)/sspr3 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr3.dsl"
+		action	 "iasl -p $(CURDIR)/sspr3 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr3.dsl"
 		action	 "perl -pi -e 's/AmlCode/AmlCode_sspr3/g' sspr3.hex"
 		action	 "mv sspr3.hex sspr3.c"
 	end
 	object ./sspr3.o
 	makerule sspr4.c
 		depends "$(TOP)/src/northbridge/amd/amdfam10/sspr4.dsl"
-		action	 "iasl -p $(PWD)/sspr4 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr4.dsl"
+		action	 "iasl -p $(CURDIR)/sspr4 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr4.dsl"
 		action	 "perl -pi -e 's/AmlCode/AmlCode_sspr4/g' sspr4.hex"
 		action	 "mv sspr4.hex sspr4.c"
 	end
 	object ./sspr4.o
 	makerule sspr5.c
 		depends "$(TOP)/src/northbridge/amd/amdfam10/sspr5.dsl"
-		action	 "iasl -p $(PWD)/sspr5 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr5.dsl"
+		action	 "iasl -p $(CURDIR)/sspr5 -tc $(TOP)/src/northbridge/amd/amdfam10/sspr5.dsl"
 		action	 "perl -pi -e 's/AmlCode/AmlCode_sspr5/g' sspr5.hex"
 		action	 "mv sspr5.hex sspr5.c"
 	end
Index: util/newconfig/config.g
===================================================================
--- util/newconfig/config.g	(revision 4298)
+++ util/newconfig/config.g	(working copy)
@@ -2118,7 +2118,7 @@
 	file.write("# Function to create an item like -Di586 or -DCONFIG_MAX_CPUS='1' or -Ui686\n")
 	file.write("D_item = $(shell echo '$(if $(subst undefined,,$(origin $1)),\\#define $1$(if $($1), $($1),),\\#undef $1)' >> settings.h)\n\n")
 	file.write("# Compute the value of CPUFLAGS here during make's first pass.\n")
-	file.write("CPUFLAGS := $(strip $(shell echo '/* autogenerated */' > settings.h)$(foreach _var_,$(VARIABLES),$(call D_item,$(_var_)))-include $(PWD)/settings.h)\n\n")
+	file.write("CPUFLAGS := $(strip $(shell echo '/* autogenerated */' > settings.h)$(foreach _var_,$(VARIABLES),$(call D_item,$(_var_)))-include $(CURDIR)/settings.h)\n\n")
 
 	for i in image.getuserdefines():
 		file.write("%s\n" %i)
Index: util/abuild/abuild
===================================================================
--- util/abuild/abuild	(revision 4298)
+++ util/abuild/abuild	(working copy)
@@ -36,7 +36,14 @@
 configureonly=0
 
 # One might want to adjust these in case of cross compiling
-MAKE="make"
+for i in make gmake gnumake nonexistant_make; do
+	$i --version 2>/dev/null |grep "GNU Make" >/dev/null && break
+done
+if [ "$i" = "nonexistant_make" ]; then
+	echo No GNU Make found.
+	exit 1
+fi
+MAKE=$i
 PYTHON=python
 
 # this can be changed to xml by -x
@@ -202,10 +209,11 @@
 		LOGLEVEL2=""
 	fi
 
-	if [ "`which lzma`" != "" -a "$PAYLOAD" != /dev/null ]; then
-		COMPRESSION="option CONFIG_COMPRESSED_PAYLOAD_LZMA=1"
-	else
-		COMPRESSION="# no compression"
+	COMPRESSION="# no compression"
+	if which lzma >/dev/null 2>/dev/null; then
+		if [ "$PAYLOAD" != /dev/null ]; then
+			COMPRESSION="option CONFIG_COMPRESSED_PAYLOAD_LZMA=1"
+		fi
 	fi
 
 	cp $TARGET/Config-${VENDOR}_${MAINBOARD}.lb $TARGET/Config-${VENDOR}_${MAINBOARD}.lb.pre
@@ -266,7 +274,7 @@
 		xmlfile $build_dir/config.log
 		xml "  </log>"
 		xml ""
-		tail -n $CONTEXT $build_dir/config.log
+		tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log
 		return 1
 	fi
 }
@@ -315,7 +323,7 @@
 		xml "  </log>"
 
 		printf "FAILED after ${duration}s! Log excerpt:\n"
-		tail -n $CONTEXT make.log
+		tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log
 		cd $CURR
 		return 1
 	fi
Index: util/romcc/romcc.c
===================================================================
--- util/romcc/romcc.c	(revision 4298)
+++ util/romcc/romcc.c	(working copy)
@@ -280,7 +280,7 @@
 typedef int32_t  int_t;
 typedef uint32_t uint_t;
 typedef int32_t  long_t;
-typedef uint32_t ulong_t;
+#define ulong_t uint32_t
 
 #define SCHAR_T_MIN (-128)
 #define SCHAR_T_MAX 127
@@ -24819,8 +24819,8 @@
 			last_occurance != ins->occurance) {
 			if (!ins->occurance->parent) {
 				fprintf(fp, "\t/* %s,%s:%d.%d */\n",
-					ins->occurance->function,
-					ins->occurance->filename,
+					ins->occurance->function?ins->occurance->function:"(null)",
+					ins->occurance->filename?ins->occurance->filename:"(null)",
 					ins->occurance->line,
 					ins->occurance->col);
 			}
