Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/8a2c5bd3ed3be593c94aa838feea70665cf75b9f
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/8a2c5bd3ed3be593c94aa838feea70665cf75b9f
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/8a2c5bd3ed3be593c94aa838feea70665cf75b9f

The branch, master has been updated
       via  8a2c5bd3ed3be593c94aa838feea70665cf75b9f (commit)
       via  5db541a6d7e1d6ae7792e392f8e7dd5d5b07345f (commit)
      from  25c21e5fefc554c1941aa1a99b5b7a6c6ca67589 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=8a2c5bd3ed3be593c94aa838feea70665cf75b9f
commit 8a2c5bd3ed3be593c94aa838feea70665cf75b9f
Author: Vincent Sanders <vi...@kyllikki.org>
Commit: Vincent Sanders <vi...@kyllikki.org>

    split out library and feature building macros

diff --git a/Makefile b/Makefile
index aa0a1b3..80330b5 100644
--- a/Makefile
+++ b/Makefile
@@ -89,138 +89,8 @@ TOOLROOT := $(OBJROOT)/tools
 CFLAGS_ENV := $(CFLAGS)
 CXXFLAGS_ENV := $(CXXFLAGS)
 
-# A macro that conditionaly adds flags to the build when a feature is enabled.
-#
-# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
-# 2: Parameters to add to CFLAGS
-# 3: Parameters to add to LDFLAGS
-# 4: Human-readable name for the feature
-define feature_enabled
-  ifeq ($$(NETSURF_USE_$(1)),YES)
-    CFLAGS += $(2)
-    CXXFLAGS += $(2)
-    LDFLAGS += $(3)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(4)   enabled       (NETSURF_USE_$(1) := YES))
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),NO)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(4)   disabled      (NETSURF_USE_$(1) := NO))
-    endif
-  else
-    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
-    $$(error NETSURF_USE_$(1) must be YES or NO)
-  endif
-endef
-
-# A macro that conditionaly adds flags to the build with a uniform display.
-#
-# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
-# 2: Human-readable name for the feature
-# 3: Parameters to add to CFLAGS when enabled
-# 4: Parameters to add to LDFLAGS when enabled
-# 5: Parameters to add to CFLAGS when disabled
-# 6: Parameters to add to LDFLAGS when disabled
-define feature_switch
-  ifeq ($$(NETSURF_USE_$(1)),YES)
-    CFLAGS += $(3)
-    CXXFLAGS += $(3)
-    LDFLAGS += $(4)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(2)   enabled       (NETSURF_USE_$(1) := YES))
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),NO)
-    CFLAGS += $(5)
-    CXXFLAGS += $(5)
-    LDFLAGS += $(6)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(2)   disabled      (NETSURF_USE_$(1) := NO))
-    endif
-  else
-    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
-    $$(error NETSURF_USE_$(1) must be YES or NO)
-  endif
-endef
-
-# Extend flags with appropriate values from pkg-config for enabled features
-#
-# 1: pkg-config required modules for feature
-# 2: Human-readable name for the feature
-define pkg_config_find_and_add
-  ifeq ($$(PKG_CONFIG),)
-    $$(error pkg-config is required to auto-detect feature availability)
-  endif
-
-  PKG_CONFIG_$(1)_EXISTS := $$(shell $$(PKG_CONFIG) --exists $(1) && echo yes)
-
-  ifeq ($$(PKG_CONFIG_$(1)_EXISTS),yes)
-      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
-      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
-      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(1))
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info PKG.CNFG: $(2) ($(1))  enabled)
-      endif
-  else
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info PKG.CNFG: $(2) ($(1))    failed)
-      $$(error Unable to find library for: $(2) ($(1)))
-    endif
-  endif
-endef
-
-# Extend flags with appropriate values from pkg-config for enabled features
-#
-# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
-# 2: pkg-config required modules for feature
-# 3: Human-readable name for the feature
-define pkg_config_find_and_add_enabled
-  ifeq ($$(PKG_CONFIG),)
-    $$(error pkg-config is required to auto-detect feature availability)
-  endif
-
-  NETSURF_FEATURE_$(1)_AVAILABLE := $$(shell $$(PKG_CONFIG) --exists $(2) && 
echo yes)
-  NETSURF_FEATURE_$(1)_CFLAGS ?= -DWITH_$(1)
-
-  ifeq ($$(NETSURF_USE_$(1)),YES)
-    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
-      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  enabled       (NETSURF_USE_$(1) := YES))
-      endif
-    else
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  failed        (NETSURF_USE_$(1) := YES))
-        $$(error Unable to find library for: $(3) ($(2)))
-      endif
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),AUTO)
-    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
-      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  auto-enabled  (NETSURF_USE_$(1) := 
AUTO))
-       NETSURF_USE_$(1) := YES
-      endif
-    else
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  auto-disabled (NETSURF_USE_$(1) := 
AUTO))
-       NETSURF_USE_$(1) := NO
-      endif
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),NO)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(3) ($(2))    disabled      (NETSURF_USE_$(1) := NO))
-    endif
-  else
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(3) ($(2))    error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
-      $$(error NETSURF_USE_$(1) must be YES, NO, or AUTO)
-    endif
-  endif
-endef
+# library and feature building macros
+include Makefile.macros
 
 # ----------------------------------------------------------------------------
 # General flag setup
diff --git a/Makefile.macros b/Makefile.macros
new file mode 100644
index 0000000..37a9954
--- /dev/null
+++ b/Makefile.macros
@@ -0,0 +1,137 @@
+# -*- mode: makefile-gmake -*-
+##
+## Netsurf library and feature macros
+##
+
+# A macro that conditionaly adds flags to the build when a feature is enabled.
+#
+# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
+# 2: Parameters to add to CFLAGS
+# 3: Parameters to add to LDFLAGS
+# 4: Human-readable name for the feature
+define feature_enabled
+  ifeq ($$(NETSURF_USE_$(1)),YES)
+    CFLAGS += $(2)
+    CXXFLAGS += $(2)
+    LDFLAGS += $(3)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(4)   enabled       (NETSURF_USE_$(1) := YES))
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),NO)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(4)   disabled      (NETSURF_USE_$(1) := NO))
+    endif
+  else
+    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
+    $$(error NETSURF_USE_$(1) must be YES or NO)
+  endif
+endef
+
+# A macro that conditionaly adds flags to the build with a uniform display.
+#
+# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
+# 2: Human-readable name for the feature
+# 3: Parameters to add to CFLAGS when enabled
+# 4: Parameters to add to LDFLAGS when enabled
+# 5: Parameters to add to CFLAGS when disabled
+# 6: Parameters to add to LDFLAGS when disabled
+define feature_switch
+  ifeq ($$(NETSURF_USE_$(1)),YES)
+    CFLAGS += $(3)
+    CXXFLAGS += $(3)
+    LDFLAGS += $(4)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(2)   enabled       (NETSURF_USE_$(1) := YES))
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),NO)
+    CFLAGS += $(5)
+    CXXFLAGS += $(5)
+    LDFLAGS += $(6)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(2)   disabled      (NETSURF_USE_$(1) := NO))
+    endif
+  else
+    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
+    $$(error NETSURF_USE_$(1) must be YES or NO)
+  endif
+endef
+
+# Extend flags with appropriate values from pkg-config for enabled features
+#
+# 1: pkg-config required modules for feature
+# 2: Human-readable name for the feature
+define pkg_config_find_and_add
+  ifeq ($$(PKG_CONFIG),)
+    $$(error pkg-config is required to auto-detect feature availability)
+  endif
+
+  PKG_CONFIG_$(1)_EXISTS := $$(shell $$(PKG_CONFIG) --exists $(1) && echo yes)
+
+  ifeq ($$(PKG_CONFIG_$(1)_EXISTS),yes)
+      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
+      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
+      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(1))
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info PKG.CNFG: $(2) ($(1))  enabled)
+      endif
+  else
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info PKG.CNFG: $(2) ($(1))    failed)
+      $$(error Unable to find library for: $(2) ($(1)))
+    endif
+  endif
+endef
+
+# Extend flags with appropriate values from pkg-config for enabled features
+#
+# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
+# 2: pkg-config required modules for feature
+# 3: Human-readable name for the feature
+define pkg_config_find_and_add_enabled
+  ifeq ($$(PKG_CONFIG),)
+    $$(error pkg-config is required to auto-detect feature availability)
+  endif
+
+  NETSURF_FEATURE_$(1)_AVAILABLE := $$(shell $$(PKG_CONFIG) --exists $(2) && 
echo yes)
+  NETSURF_FEATURE_$(1)_CFLAGS ?= -DWITH_$(1)
+
+  ifeq ($$(NETSURF_USE_$(1)),YES)
+    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
+      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  enabled       (NETSURF_USE_$(1) := YES))
+      endif
+    else
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  failed        (NETSURF_USE_$(1) := YES))
+        $$(error Unable to find library for: $(3) ($(2)))
+      endif
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),AUTO)
+    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
+      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  auto-enabled  (NETSURF_USE_$(1) := 
AUTO))
+       NETSURF_USE_$(1) := YES
+      endif
+    else
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  auto-disabled (NETSURF_USE_$(1) := 
AUTO))
+       NETSURF_USE_$(1) := NO
+      endif
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),NO)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(3) ($(2))    disabled      (NETSURF_USE_$(1) := NO))
+    endif
+  else
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(3) ($(2))    error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
+      $$(error NETSURF_USE_$(1) must be YES, NO, or AUTO)
+    endif
+  endif
+endef


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=5db541a6d7e1d6ae7792e392f8e7dd5d5b07345f
commit 5db541a6d7e1d6ae7792e392f8e7dd5d5b07345f
Author: Vincent Sanders <vi...@kyllikki.org>
Commit: Vincent Sanders <vi...@kyllikki.org>

    Improve target setup in makefiles
    
    split out HOST TARGET and SUBTARGET generation into separate file.
    split out target(frontend) specific tool settings into separate files.

diff --git a/Makefile b/Makefile
index d8e3b16..aa0a1b3 100644
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,7 @@
 #
 # Look at Makefile.config for configuration options.
 #
-# Tested on unix platforms (building for GTK and cross-compiling for RO) and
-# on RO (building for RO).
+# Best results obtained building on unix platforms cross compiling for others
 #
 # To clean, invoke as above, with the 'clean' target
 #
@@ -26,100 +25,8 @@
 
 all: all-program
 
-# Determine host type
-# NOTE: HOST determination on RISC OS could fail because of missing bug fixes
-#      in UnixLib which only got addressed in UnixLib 5 / GCCSDK 4.
-#      When you don't have 'uname' available, you will see:
-#        File 'uname' not found
-#      When you do and using a 'uname' compiled with a buggy UnixLib, you
-#      will see the following printed on screen:
-#        RISC OS
-#      In both cases HOST make variable is empty and we recover from that by
-#      assuming we're building on RISC OS.
-#      In case you don't see anything printed (including the warning), you
-#      have an up-to-date RISC OS build system. ;-)
-HOST := $(shell uname -s)
-
-# Sanitise host
-# TODO: Ideally, we want the equivalent of s/[^A-Za-z0-9]/_/g here
-HOST := $(subst .,_,$(subst -,_,$(subst /,_,$(HOST))))
-
-ifeq ($(HOST),)
-  HOST := riscos
-  $(warning Build platform determination failed but that's a known problem for 
RISC OS so we're assuming a native RISC OS build.)
-else
-  ifeq ($(HOST),RISC OS)
-    # Fixup uname -s returning "RISC OS"
-    HOST := riscos
-  endif
-endif
-ifeq ($(HOST),riscos)
-  # Build happening on RO platform, default target is RO backend
-  ifeq ($(TARGET),)
-    TARGET := riscos
-  endif
-endif
-
-ifeq ($(HOST),BeOS)
-  HOST := beos
-endif
-ifeq ($(HOST),Haiku)
-  # Haiku implements the BeOS API
-  HOST := beos
-endif
-ifeq ($(HOST),beos)
-    # Build happening on BeOS platform, default target is BeOS backend
-    ifeq ($(TARGET),)
-      TARGET := beos
-    endif
-    ifeq ($(TARGET),haiku)
-      override TARGET := beos
-    endif
-endif
-
-ifeq ($(HOST),AmigaOS)
-  HOST := amiga
-  ifeq ($(TARGET),)
-    TARGET := amiga
-  endif
-endif
-
-ifeq ($(HOST),FreeMiNT)
-  HOST := mint
-endif
-ifeq ($(HOST),mint)
-  ifeq ($(TARGET),)
-    TARGET := atari
-  endif
-endif
-
-ifeq ($(findstring MINGW,$(HOST)),MINGW)
-  # MSYS' uname reports the likes of "MINGW32_NT-6.0"
-  HOST := windows
-endif
-ifeq ($(HOST),windows)
-  ifeq ($(TARGET),)
-    TARGET := windows
-  endif
-endif
+# default values for base variables
 
-# Default target is GTK backend
-ifeq ($(TARGET),)
-  TARGET := gtk3
-endif
-
-# valid values for the TARGET
-VLDTARGET := riscos gtk2 gtk3 beos amiga amigaos3 framebuffer windows atari 
monkey
-
-# Check for valid TARGET
-ifeq ($(filter $(VLDTARGET),$(TARGET)),)
-  $(error Unknown TARGET "$(TARGET)", Must be one of $(VLDTARGET))
-endif
-
-# ensure empty values for base variables
-
-# Sub target for build
-SUBTARGET=
 # Resources executable target depends upon
 RESOURCES=
 # Messages executable target depends on
@@ -153,169 +60,11 @@ BUILD_CFLAGS = -g -W -Wall -Wundef -Wpointer-arith 
-Wcast-align \
        -Wwrite-strings -Wmissing-declarations -Wuninitialized \
        -Wno-unused-parameter
 
-ifeq ($(TARGET),riscos)
-  ifeq ($(HOST),riscos)
-    # Build for RO on RO
-    GCCSDK_INSTALL_ENV := <NSLibs$$Dir>
-    CCRES := ccres
-    TPLEXT :=
-    MAKERUN := makerun
-    SQUEEZE := squeeze
-    RUNEXT :=
-    CC := gcc
-    CXX := g++
-    EXEEXT :=
-    PKG_CONFIG :=
-  else
-    # Cross-build for RO (either using GCCSDK 3.4.6 - AOF,
-    # either using GCCSDK 4 - ELF)
-    ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
-      ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/env),)
-        GCCSDK_INSTALL_ENV := /opt/netsurf/arm-unknown-riscos/env
-      else
-        GCCSDK_INSTALL_ENV := /home/riscos/env
-      endif
-    endif
-
-    ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
-      ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/cross/bin),)
-        GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-unknown-riscos/cross/bin
-      else
-        GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
-      endif
-    endif
+# compute HOST, TARGET and SUBTARGET
+include frontends/Makefile.hts
 
-    CCRES := $(GCCSDK_INSTALL_CROSSBIN)/ccres
-    TPLEXT := ,fec
-    MAKERUN := $(GCCSDK_INSTALL_CROSSBIN)/makerun
-    SQUEEZE := $(GCCSDK_INSTALL_CROSSBIN)/squeeze
-    RUNEXT := ,feb
-    CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-    ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
-      SUBTARGET := -elf
-      EXEEXT := ,e1f
-      ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif
-    else
-     SUBTARGET := -aof
-     EXEEXT := ,ff8
-    endif
-    CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-    PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
-  endif
-else
-  ifeq ($(TARGET),beos)
-    # Building for BeOS/Haiku
-    #ifeq ($(HOST),beos)
-      # Build for BeOS on BeOS
-      GCCSDK_INSTALL_ENV := /boot/develop
-      CC := gcc
-      CXX := g++
-      EXEEXT :=
-      PKG_CONFIG := pkg-config
-    #endif
-  else
-    ifeq ($(TARGET),windows)
-      ifneq ($(HOST),windows)
-        # Set Mingw defaults
-        GCCSDK_INSTALL_ENV ?= /opt/netsurf/i686-w64-mingw32/env
-        GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/i686-w64-mingw32/cross/bin
-
-        CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-        WINDRES := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*windres)
-
-        PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
-      else
-        # Building on Windows
-        CC := gcc
-        PKG_CONFIG :=
-      endif
-    else
-      ifeq ($(findstring amiga,$(TARGET)),amiga)
-        ifeq ($(findstring amiga,$(HOST)),amiga)
-          PKG_CONFIG := pkg-config
-        else
-          ifeq ($(TARGET),amigaos3)
-            GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-unknown-amigaos/env
-            GCCSDK_INSTALL_CROSSBIN ?= 
/opt/netsurf/m68k-unknown-amigaos/cross/bin
-
-            SUBTARGET = os3
-          else
-            GCCSDK_INSTALL_ENV ?= /opt/netsurf/ppc-amigaos/env
-            GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/ppc-amigaos/cross/bin
-          endif
-
-          override TARGET := amiga
-
-          CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-
-          PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config
-        endif
-      else
-          ifeq ($(TARGET),atari)
-            ifeq ($(HOST),atari)
-              PKG_CONFIG := pkg-config
-            else
-              ifeq ($(HOST),mint)
-                PKG_CONFIG := pkg-config
-              else
-                GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-atari-mint/env
-                GCCSDK_INSTALL_CROSSBIN ?= 
/opt/netsurf/m68k-atari-mint/cross/bin
-
-                CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-
-                PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config
-              endif
-            endif
-          else
-           ifeq ($(TARGET),monkey)
-              ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
-                PKG_CONFIG := pkg-config
-              else
-                PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config              
  
-              endif
-
-              ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
-                CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-                CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-              endif
-           else
-             ifeq ($(TARGET),framebuffer)
-                ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
-                  PKG_CONFIG := pkg-config
-                else
-                  PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config              
  
-                endif
-
-                ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
-                  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-                  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-                endif
-
-              else
-                # All native targets
-
-                # use native package config
-               PKG_CONFIG := pkg-config
-
-                # gtk target processing
-               ifeq ($(TARGET),gtk3)
-                  override TARGET := gtk
-                  override NETSURF_GTK_MAJOR := 3
-                  SUBTARGET = $(NETSURF_GTK_MAJOR)
-                else
-                 ifeq ($(TARGET),gtk2)
-                    override TARGET := gtk
-                    override NETSURF_GTK_MAJOR := 2
-                    SUBTARGET = $(NETSURF_GTK_MAJOR)
-                  endif
-                endif
-              endif
-            endif
-          endif
-      endif
-    endif
-  endif
-endif
+# target specific tool overrides
+include frontends/$(TARGET)/Makefile.tools
 
 # compiler versioning to adjust warning flags
 CC_VERSION := $(shell $(CC) -dumpfullversion -dumpversion)
diff --git a/frontends/Makefile.hts b/frontends/Makefile.hts
new file mode 100644
index 0000000..1915b35
--- /dev/null
+++ b/frontends/Makefile.hts
@@ -0,0 +1,122 @@
+# -*- mode: makefile-gmake -*-
+##
+## determine the HOST TARGET and SUBTARGET
+##
+
+# Determine host type
+# NOTE: HOST determination on RISC OS could fail because of missing bug fixes
+#      in UnixLib which only got addressed in UnixLib 5 / GCCSDK 4.
+#      When you don't have 'uname' available, you will see:
+#        File 'uname' not found
+#      When you do and using a 'uname' compiled with a buggy UnixLib, you
+#      will see the following printed on screen:
+#        RISC OS
+#      In both cases HOST make variable is empty and we recover from that by
+#      assuming we're building on RISC OS.
+#      In case you don't see anything printed (including the warning), you
+#      have an up-to-date RISC OS build system. ;-)
+HOST := $(shell uname -s)
+
+# Sanitise host
+# TODO: Ideally, we want the equivalent of s/[^A-Za-z0-9]/_/g here
+HOST := $(subst .,_,$(subst -,_,$(subst /,_,$(HOST))))
+
+ifeq ($(HOST),)
+  HOST := riscos
+  $(warning Build platform determination failed but that's a known problem for 
RISC OS so we're assuming a native RISC OS build.)
+else
+  ifeq ($(HOST),RISC OS)
+    # Fixup uname -s returning "RISC OS"
+    HOST := riscos
+  endif
+endif
+ifeq ($(HOST),riscos)
+  # Build happening on RO platform, default target is RO backend
+  ifeq ($(TARGET),)
+    TARGET := riscos
+  endif
+endif
+
+ifeq ($(HOST),BeOS)
+  HOST := beos
+endif
+ifeq ($(HOST),Haiku)
+  # Haiku implements the BeOS API
+  HOST := beos
+endif
+ifeq ($(HOST),beos)
+    # Build happening on BeOS platform, default target is BeOS backend
+    ifeq ($(TARGET),)
+      TARGET := beos
+    endif
+    ifeq ($(TARGET),haiku)
+      override TARGET := beos
+    endif
+endif
+
+ifeq ($(HOST),AmigaOS)
+  HOST := amiga
+  ifeq ($(TARGET),)
+    TARGET := amiga
+  endif
+endif
+
+ifeq ($(HOST),FreeMiNT)
+  HOST := mint
+endif
+ifeq ($(HOST),mint)
+  ifeq ($(TARGET),)
+    TARGET := atari
+  endif
+endif
+
+ifeq ($(findstring MINGW,$(HOST)),MINGW)
+  # MSYS' uname reports the likes of "MINGW32_NT-6.0"
+  HOST := windows
+endif
+ifeq ($(HOST),windows)
+  ifeq ($(TARGET),)
+    TARGET := windows
+  endif
+endif
+
+# Setup (sub)targets
+
+# empty default sub target
+SUBTARGET=
+
+# Default target is GTK 3 backend
+ifeq ($(TARGET),)
+  override TARGET := gtk
+  SUBTARGET = 3
+else
+  ifeq ($(TARGET),gtk)
+    # unspecified gtk is gtk3
+    SUBTARGET = 3
+  else
+    ifeq ($(TARGET),gtk3)
+      # gtk3 is gtk target with subtarget of 3
+      override TARGET := gtk
+      SUBTARGET = 3
+    else
+      ifeq ($(TARGET),gtk2)
+        # gtk2 is gtk target with subtarget of 2
+        override TARGET := gtk
+        SUBTARGET = 2
+      else
+        ifeq ($(TARGET),amigaos3)
+          override TARGET := amiga
+          SUBTARGET = os3      
+        endif
+      endif
+    endif
+  endif
+endif
+
+# valid values for the TARGET
+VLDTARGET := amiga atari beos framebuffer gtk monkey riscos windows
+
+# Check for valid TARGET
+ifeq ($(filter $(VLDTARGET),$(TARGET)),)
+  $(error Unknown TARGET "$(TARGET)", Must be one of $(VLDTARGET))
+endif
diff --git a/frontends/amiga/Makefile.tools b/frontends/amiga/Makefile.tools
new file mode 100644
index 0000000..c169287
--- /dev/null
+++ b/frontends/amiga/Makefile.tools
@@ -0,0 +1,21 @@
+# -*- mode: makefile-gmake -*-
+##
+## amiga target tool setup
+##
+
+ifeq ($(findstring amiga,$(HOST)),amiga)
+  # building for amiga on amiga
+  PKG_CONFIG := pkg-config
+else
+  ifeq ($(SUBTARGET),os3)
+    GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-unknown-amigaos/env
+    GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/m68k-unknown-amigaos/cross/bin
+  else
+    GCCSDK_INSTALL_ENV ?= /opt/netsurf/ppc-amigaos/env
+    GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/ppc-amigaos/cross/bin
+  endif
+
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
+endif
diff --git a/frontends/atari/Makefile.tools b/frontends/atari/Makefile.tools
new file mode 100644
index 0000000..971ab21
--- /dev/null
+++ b/frontends/atari/Makefile.tools
@@ -0,0 +1,19 @@
+# -*- mode: makefile-gmake -*-
+##
+## atari target tool setup
+##
+
+ifeq ($(HOST),atari)
+  PKG_CONFIG := pkg-config
+else
+  ifeq ($(HOST),mint)
+    PKG_CONFIG := pkg-config
+  else
+    GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-atari-mint/env
+    GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/m68k-atari-mint/cross/bin
+
+    CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+
+    PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
+  endif
+endif
\ No newline at end of file
diff --git a/frontends/beos/Makefile.tools b/frontends/beos/Makefile.tools
new file mode 100644
index 0000000..0324a28
--- /dev/null
+++ b/frontends/beos/Makefile.tools
@@ -0,0 +1,14 @@
+# -*- mode: makefile-gmake -*-
+##
+## BeOS target tool setup
+##
+
+# Building for BeOS/Haiku
+#ifeq ($(HOST),beos)
+  # Build for BeOS on BeOS
+  GCCSDK_INSTALL_ENV := /boot/develop
+  CC := gcc
+  CXX := g++
+  EXEEXT :=
+  PKG_CONFIG := pkg-config
+#endif
diff --git a/frontends/framebuffer/Makefile.tools 
b/frontends/framebuffer/Makefile.tools
new file mode 100644
index 0000000..80623b1
--- /dev/null
+++ b/frontends/framebuffer/Makefile.tools
@@ -0,0 +1,15 @@
+# -*- mode: makefile-gmake -*-
+##
+## tool setup for the framebuffer target
+##
+
+ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
+  PKG_CONFIG := pkg-config
+else
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config                
+endif
+
+ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
+endif
diff --git a/frontends/gtk/Makefile.tools b/frontends/gtk/Makefile.tools
new file mode 100644
index 0000000..5331dcc
--- /dev/null
+++ b/frontends/gtk/Makefile.tools
@@ -0,0 +1,16 @@
+# -*- mode: makefile-gmake -*-
+##
+## tool setup for the gtk target
+##
+
+# use native package config
+PKG_CONFIG := pkg-config
+
+# gtk target processing
+ifeq ($(SUBTARGET),3)
+  override NETSURF_GTK_MAJOR := 3
+endif
+
+ifeq ($(SUBTARGET),2)
+  override NETSURF_GTK_MAJOR := 2
+endif
diff --git a/frontends/monkey/Makefile.tools b/frontends/monkey/Makefile.tools
new file mode 100644
index 0000000..7546506
--- /dev/null
+++ b/frontends/monkey/Makefile.tools
@@ -0,0 +1,15 @@
+# -*- mode: makefile-gmake -*-
+##
+## monkey target tool setup
+##
+
+ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
+  PKG_CONFIG := pkg-config
+else
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config                
+endif
+
+ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
+endif
diff --git a/frontends/riscos/Makefile.tools b/frontends/riscos/Makefile.tools
new file mode 100644
index 0000000..9ea5c29
--- /dev/null
+++ b/frontends/riscos/Makefile.tools
@@ -0,0 +1,52 @@
+# -*- mode: makefile-gmake -*-
+##
+## RISC OS target tool setup
+##
+
+ifeq ($(HOST),riscos)
+  # Build for RO on RO
+  GCCSDK_INSTALL_ENV := <NSLibs$$Dir>
+  CCRES := ccres
+  TPLEXT :=
+  MAKERUN := makerun
+  SQUEEZE := squeeze
+  RUNEXT :=
+  CC := gcc
+  CXX := g++
+  EXEEXT :=
+  PKG_CONFIG :=
+else
+  # Cross-build for RO (either using GCCSDK 3.4.6 - AOF,
+  # either using GCCSDK 4 - ELF)
+  ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
+    ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/env),)
+      GCCSDK_INSTALL_ENV := /opt/netsurf/arm-unknown-riscos/env
+    else
+      GCCSDK_INSTALL_ENV := /home/riscos/env
+    endif
+  endif
+   ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+    ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/cross/bin),)
+      GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-unknown-riscos/cross/bin
+    else
+      GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
+    endif
+  endif
+
+  CCRES := $(GCCSDK_INSTALL_CROSSBIN)/ccres
+  TPLEXT := ,fec
+  MAKERUN := $(GCCSDK_INSTALL_CROSSBIN)/makerun
+  SQUEEZE := $(GCCSDK_INSTALL_CROSSBIN)/squeeze
+  RUNEXT := ,feb
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
+    SUBTARGET := -elf
+    EXEEXT := ,e1f
+    ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif
+  else
+   SUBTARGET := -aof
+   EXEEXT := ,ff8
+  endif
+  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
+  PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
+endif
diff --git a/frontends/windows/Makefile.tools b/frontends/windows/Makefile.tools
new file mode 100644
index 0000000..dff3dfe
--- /dev/null
+++ b/frontends/windows/Makefile.tools
@@ -0,0 +1,19 @@
+# -*- mode: makefile-gmake -*-
+##
+## windows (win32) target tool setup
+##
+
+ifneq ($(HOST),windows)
+  # Set Mingw defaults
+  GCCSDK_INSTALL_ENV ?= /opt/netsurf/i686-w64-mingw32/env
+  GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/i686-w64-mingw32/cross/bin
+
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  WINDRES := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*windres)
+
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
+else
+  # Building on Windows
+  CC := gcc
+  PKG_CONFIG :=
+endif


-----------------------------------------------------------------------

Summary of changes:
 Makefile                             |  399 +---------------------------------
 Makefile.macros                      |  137 ++++++++++++
 frontends/Makefile.hts               |  122 +++++++++++
 frontends/amiga/Makefile.tools       |   21 ++
 frontends/atari/Makefile.tools       |   19 ++
 frontends/beos/Makefile.tools        |   14 ++
 frontends/framebuffer/Makefile.tools |   15 ++
 frontends/gtk/Makefile.tools         |   16 ++
 frontends/monkey/Makefile.tools      |   15 ++
 frontends/riscos/Makefile.tools      |   52 +++++
 frontends/windows/Makefile.tools     |   19 ++
 11 files changed, 439 insertions(+), 390 deletions(-)
 create mode 100644 Makefile.macros
 create mode 100644 frontends/Makefile.hts
 create mode 100644 frontends/amiga/Makefile.tools
 create mode 100644 frontends/atari/Makefile.tools
 create mode 100644 frontends/beos/Makefile.tools
 create mode 100644 frontends/framebuffer/Makefile.tools
 create mode 100644 frontends/gtk/Makefile.tools
 create mode 100644 frontends/monkey/Makefile.tools
 create mode 100644 frontends/riscos/Makefile.tools
 create mode 100644 frontends/windows/Makefile.tools

diff --git a/Makefile b/Makefile
index d8e3b16..80330b5 100644
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,7 @@
 #
 # Look at Makefile.config for configuration options.
 #
-# Tested on unix platforms (building for GTK and cross-compiling for RO) and
-# on RO (building for RO).
+# Best results obtained building on unix platforms cross compiling for others
 #
 # To clean, invoke as above, with the 'clean' target
 #
@@ -26,100 +25,8 @@
 
 all: all-program
 
-# Determine host type
-# NOTE: HOST determination on RISC OS could fail because of missing bug fixes
-#      in UnixLib which only got addressed in UnixLib 5 / GCCSDK 4.
-#      When you don't have 'uname' available, you will see:
-#        File 'uname' not found
-#      When you do and using a 'uname' compiled with a buggy UnixLib, you
-#      will see the following printed on screen:
-#        RISC OS
-#      In both cases HOST make variable is empty and we recover from that by
-#      assuming we're building on RISC OS.
-#      In case you don't see anything printed (including the warning), you
-#      have an up-to-date RISC OS build system. ;-)
-HOST := $(shell uname -s)
-
-# Sanitise host
-# TODO: Ideally, we want the equivalent of s/[^A-Za-z0-9]/_/g here
-HOST := $(subst .,_,$(subst -,_,$(subst /,_,$(HOST))))
-
-ifeq ($(HOST),)
-  HOST := riscos
-  $(warning Build platform determination failed but that's a known problem for 
RISC OS so we're assuming a native RISC OS build.)
-else
-  ifeq ($(HOST),RISC OS)
-    # Fixup uname -s returning "RISC OS"
-    HOST := riscos
-  endif
-endif
-ifeq ($(HOST),riscos)
-  # Build happening on RO platform, default target is RO backend
-  ifeq ($(TARGET),)
-    TARGET := riscos
-  endif
-endif
-
-ifeq ($(HOST),BeOS)
-  HOST := beos
-endif
-ifeq ($(HOST),Haiku)
-  # Haiku implements the BeOS API
-  HOST := beos
-endif
-ifeq ($(HOST),beos)
-    # Build happening on BeOS platform, default target is BeOS backend
-    ifeq ($(TARGET),)
-      TARGET := beos
-    endif
-    ifeq ($(TARGET),haiku)
-      override TARGET := beos
-    endif
-endif
-
-ifeq ($(HOST),AmigaOS)
-  HOST := amiga
-  ifeq ($(TARGET),)
-    TARGET := amiga
-  endif
-endif
-
-ifeq ($(HOST),FreeMiNT)
-  HOST := mint
-endif
-ifeq ($(HOST),mint)
-  ifeq ($(TARGET),)
-    TARGET := atari
-  endif
-endif
-
-ifeq ($(findstring MINGW,$(HOST)),MINGW)
-  # MSYS' uname reports the likes of "MINGW32_NT-6.0"
-  HOST := windows
-endif
-ifeq ($(HOST),windows)
-  ifeq ($(TARGET),)
-    TARGET := windows
-  endif
-endif
-
-# Default target is GTK backend
-ifeq ($(TARGET),)
-  TARGET := gtk3
-endif
+# default values for base variables
 
-# valid values for the TARGET
-VLDTARGET := riscos gtk2 gtk3 beos amiga amigaos3 framebuffer windows atari 
monkey
-
-# Check for valid TARGET
-ifeq ($(filter $(VLDTARGET),$(TARGET)),)
-  $(error Unknown TARGET "$(TARGET)", Must be one of $(VLDTARGET))
-endif
-
-# ensure empty values for base variables
-
-# Sub target for build
-SUBTARGET=
 # Resources executable target depends upon
 RESOURCES=
 # Messages executable target depends on
@@ -153,169 +60,11 @@ BUILD_CFLAGS = -g -W -Wall -Wundef -Wpointer-arith 
-Wcast-align \
        -Wwrite-strings -Wmissing-declarations -Wuninitialized \
        -Wno-unused-parameter
 
-ifeq ($(TARGET),riscos)
-  ifeq ($(HOST),riscos)
-    # Build for RO on RO
-    GCCSDK_INSTALL_ENV := <NSLibs$$Dir>
-    CCRES := ccres
-    TPLEXT :=
-    MAKERUN := makerun
-    SQUEEZE := squeeze
-    RUNEXT :=
-    CC := gcc
-    CXX := g++
-    EXEEXT :=
-    PKG_CONFIG :=
-  else
-    # Cross-build for RO (either using GCCSDK 3.4.6 - AOF,
-    # either using GCCSDK 4 - ELF)
-    ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
-      ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/env),)
-        GCCSDK_INSTALL_ENV := /opt/netsurf/arm-unknown-riscos/env
-      else
-        GCCSDK_INSTALL_ENV := /home/riscos/env
-      endif
-    endif
-
-    ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
-      ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/cross/bin),)
-        GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-unknown-riscos/cross/bin
-      else
-        GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
-      endif
-    endif
-
-    CCRES := $(GCCSDK_INSTALL_CROSSBIN)/ccres
-    TPLEXT := ,fec
-    MAKERUN := $(GCCSDK_INSTALL_CROSSBIN)/makerun
-    SQUEEZE := $(GCCSDK_INSTALL_CROSSBIN)/squeeze
-    RUNEXT := ,feb
-    CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-    ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
-      SUBTARGET := -elf
-      EXEEXT := ,e1f
-      ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif
-    else
-     SUBTARGET := -aof
-     EXEEXT := ,ff8
-    endif
-    CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-    PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
-  endif
-else
-  ifeq ($(TARGET),beos)
-    # Building for BeOS/Haiku
-    #ifeq ($(HOST),beos)
-      # Build for BeOS on BeOS
-      GCCSDK_INSTALL_ENV := /boot/develop
-      CC := gcc
-      CXX := g++
-      EXEEXT :=
-      PKG_CONFIG := pkg-config
-    #endif
-  else
-    ifeq ($(TARGET),windows)
-      ifneq ($(HOST),windows)
-        # Set Mingw defaults
-        GCCSDK_INSTALL_ENV ?= /opt/netsurf/i686-w64-mingw32/env
-        GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/i686-w64-mingw32/cross/bin
-
-        CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-        WINDRES := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*windres)
-
-        PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
-      else
-        # Building on Windows
-        CC := gcc
-        PKG_CONFIG :=
-      endif
-    else
-      ifeq ($(findstring amiga,$(TARGET)),amiga)
-        ifeq ($(findstring amiga,$(HOST)),amiga)
-          PKG_CONFIG := pkg-config
-        else
-          ifeq ($(TARGET),amigaos3)
-            GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-unknown-amigaos/env
-            GCCSDK_INSTALL_CROSSBIN ?= 
/opt/netsurf/m68k-unknown-amigaos/cross/bin
-
-            SUBTARGET = os3
-          else
-            GCCSDK_INSTALL_ENV ?= /opt/netsurf/ppc-amigaos/env
-            GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/ppc-amigaos/cross/bin
-          endif
-
-          override TARGET := amiga
-
-          CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-
-          PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config
-        endif
-      else
-          ifeq ($(TARGET),atari)
-            ifeq ($(HOST),atari)
-              PKG_CONFIG := pkg-config
-            else
-              ifeq ($(HOST),mint)
-                PKG_CONFIG := pkg-config
-              else
-                GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-atari-mint/env
-                GCCSDK_INSTALL_CROSSBIN ?= 
/opt/netsurf/m68k-atari-mint/cross/bin
-
-                CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-
-                PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config
-              endif
-            endif
-          else
-           ifeq ($(TARGET),monkey)
-              ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
-                PKG_CONFIG := pkg-config
-              else
-                PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config              
  
-              endif
-
-              ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
-                CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-                CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-              endif
-           else
-             ifeq ($(TARGET),framebuffer)
-                ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
-                  PKG_CONFIG := pkg-config
-                else
-                  PKG_CONFIG := 
PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" pkg-config              
  
-                endif
-
-                ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
-                  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
-                  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
-                endif
-
-              else
-                # All native targets
-
-                # use native package config
-               PKG_CONFIG := pkg-config
-
-                # gtk target processing
-               ifeq ($(TARGET),gtk3)
-                  override TARGET := gtk
-                  override NETSURF_GTK_MAJOR := 3
-                  SUBTARGET = $(NETSURF_GTK_MAJOR)
-                else
-                 ifeq ($(TARGET),gtk2)
-                    override TARGET := gtk
-                    override NETSURF_GTK_MAJOR := 2
-                    SUBTARGET = $(NETSURF_GTK_MAJOR)
-                  endif
-                endif
-              endif
-            endif
-          endif
-      endif
-    endif
-  endif
-endif
+# compute HOST, TARGET and SUBTARGET
+include frontends/Makefile.hts
+
+# target specific tool overrides
+include frontends/$(TARGET)/Makefile.tools
 
 # compiler versioning to adjust warning flags
 CC_VERSION := $(shell $(CC) -dumpfullversion -dumpversion)
@@ -340,138 +89,8 @@ TOOLROOT := $(OBJROOT)/tools
 CFLAGS_ENV := $(CFLAGS)
 CXXFLAGS_ENV := $(CXXFLAGS)
 
-# A macro that conditionaly adds flags to the build when a feature is enabled.
-#
-# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
-# 2: Parameters to add to CFLAGS
-# 3: Parameters to add to LDFLAGS
-# 4: Human-readable name for the feature
-define feature_enabled
-  ifeq ($$(NETSURF_USE_$(1)),YES)
-    CFLAGS += $(2)
-    CXXFLAGS += $(2)
-    LDFLAGS += $(3)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(4)   enabled       (NETSURF_USE_$(1) := YES))
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),NO)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(4)   disabled      (NETSURF_USE_$(1) := NO))
-    endif
-  else
-    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
-    $$(error NETSURF_USE_$(1) must be YES or NO)
-  endif
-endef
-
-# A macro that conditionaly adds flags to the build with a uniform display.
-#
-# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
-# 2: Human-readable name for the feature
-# 3: Parameters to add to CFLAGS when enabled
-# 4: Parameters to add to LDFLAGS when enabled
-# 5: Parameters to add to CFLAGS when disabled
-# 6: Parameters to add to LDFLAGS when disabled
-define feature_switch
-  ifeq ($$(NETSURF_USE_$(1)),YES)
-    CFLAGS += $(3)
-    CXXFLAGS += $(3)
-    LDFLAGS += $(4)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(2)   enabled       (NETSURF_USE_$(1) := YES))
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),NO)
-    CFLAGS += $(5)
-    CXXFLAGS += $(5)
-    LDFLAGS += $(6)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(2)   disabled      (NETSURF_USE_$(1) := NO))
-    endif
-  else
-    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
-    $$(error NETSURF_USE_$(1) must be YES or NO)
-  endif
-endef
-
-# Extend flags with appropriate values from pkg-config for enabled features
-#
-# 1: pkg-config required modules for feature
-# 2: Human-readable name for the feature
-define pkg_config_find_and_add
-  ifeq ($$(PKG_CONFIG),)
-    $$(error pkg-config is required to auto-detect feature availability)
-  endif
-
-  PKG_CONFIG_$(1)_EXISTS := $$(shell $$(PKG_CONFIG) --exists $(1) && echo yes)
-
-  ifeq ($$(PKG_CONFIG_$(1)_EXISTS),yes)
-      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
-      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
-      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(1))
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info PKG.CNFG: $(2) ($(1))  enabled)
-      endif
-  else
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info PKG.CNFG: $(2) ($(1))    failed)
-      $$(error Unable to find library for: $(2) ($(1)))
-    endif
-  endif
-endef
-
-# Extend flags with appropriate values from pkg-config for enabled features
-#
-# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
-# 2: pkg-config required modules for feature
-# 3: Human-readable name for the feature
-define pkg_config_find_and_add_enabled
-  ifeq ($$(PKG_CONFIG),)
-    $$(error pkg-config is required to auto-detect feature availability)
-  endif
-
-  NETSURF_FEATURE_$(1)_AVAILABLE := $$(shell $$(PKG_CONFIG) --exists $(2) && 
echo yes)
-  NETSURF_FEATURE_$(1)_CFLAGS ?= -DWITH_$(1)
-
-  ifeq ($$(NETSURF_USE_$(1)),YES)
-    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
-      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  enabled       (NETSURF_USE_$(1) := YES))
-      endif
-    else
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  failed        (NETSURF_USE_$(1) := YES))
-        $$(error Unable to find library for: $(3) ($(2)))
-      endif
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),AUTO)
-    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
-      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
-      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  auto-enabled  (NETSURF_USE_$(1) := 
AUTO))
-       NETSURF_USE_$(1) := YES
-      endif
-    else
-      ifneq ($(MAKECMDGOALS),clean)
-        $$(info M.CONFIG: $(3) ($(2))  auto-disabled (NETSURF_USE_$(1) := 
AUTO))
-       NETSURF_USE_$(1) := NO
-      endif
-    endif
-  else ifeq ($$(NETSURF_USE_$(1)),NO)
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(3) ($(2))    disabled      (NETSURF_USE_$(1) := NO))
-    endif
-  else
-    ifneq ($(MAKECMDGOALS),clean)
-      $$(info M.CONFIG: $(3) ($(2))    error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
-      $$(error NETSURF_USE_$(1) must be YES, NO, or AUTO)
-    endif
-  endif
-endef
+# library and feature building macros
+include Makefile.macros
 
 # ----------------------------------------------------------------------------
 # General flag setup
diff --git a/Makefile.macros b/Makefile.macros
new file mode 100644
index 0000000..37a9954
--- /dev/null
+++ b/Makefile.macros
@@ -0,0 +1,137 @@
+# -*- mode: makefile-gmake -*-
+##
+## Netsurf library and feature macros
+##
+
+# A macro that conditionaly adds flags to the build when a feature is enabled.
+#
+# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
+# 2: Parameters to add to CFLAGS
+# 3: Parameters to add to LDFLAGS
+# 4: Human-readable name for the feature
+define feature_enabled
+  ifeq ($$(NETSURF_USE_$(1)),YES)
+    CFLAGS += $(2)
+    CXXFLAGS += $(2)
+    LDFLAGS += $(3)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(4)   enabled       (NETSURF_USE_$(1) := YES))
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),NO)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(4)   disabled      (NETSURF_USE_$(1) := NO))
+    endif
+  else
+    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
+    $$(error NETSURF_USE_$(1) must be YES or NO)
+  endif
+endef
+
+# A macro that conditionaly adds flags to the build with a uniform display.
+#
+# 1: Feature name (ie, NETSURF_USE_BMP -> BMP)
+# 2: Human-readable name for the feature
+# 3: Parameters to add to CFLAGS when enabled
+# 4: Parameters to add to LDFLAGS when enabled
+# 5: Parameters to add to CFLAGS when disabled
+# 6: Parameters to add to LDFLAGS when disabled
+define feature_switch
+  ifeq ($$(NETSURF_USE_$(1)),YES)
+    CFLAGS += $(3)
+    CXXFLAGS += $(3)
+    LDFLAGS += $(4)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(2)   enabled       (NETSURF_USE_$(1) := YES))
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),NO)
+    CFLAGS += $(5)
+    CXXFLAGS += $(5)
+    LDFLAGS += $(6)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(2)   disabled      (NETSURF_USE_$(1) := NO))
+    endif
+  else
+    $$(info M.CONFIG: $(4)     error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
+    $$(error NETSURF_USE_$(1) must be YES or NO)
+  endif
+endef
+
+# Extend flags with appropriate values from pkg-config for enabled features
+#
+# 1: pkg-config required modules for feature
+# 2: Human-readable name for the feature
+define pkg_config_find_and_add
+  ifeq ($$(PKG_CONFIG),)
+    $$(error pkg-config is required to auto-detect feature availability)
+  endif
+
+  PKG_CONFIG_$(1)_EXISTS := $$(shell $$(PKG_CONFIG) --exists $(1) && echo yes)
+
+  ifeq ($$(PKG_CONFIG_$(1)_EXISTS),yes)
+      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
+      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(1))
+      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(1))
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info PKG.CNFG: $(2) ($(1))  enabled)
+      endif
+  else
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info PKG.CNFG: $(2) ($(1))    failed)
+      $$(error Unable to find library for: $(2) ($(1)))
+    endif
+  endif
+endef
+
+# Extend flags with appropriate values from pkg-config for enabled features
+#
+# 1: Feature name (ie, NETSURF_USE_RSVG -> RSVG)
+# 2: pkg-config required modules for feature
+# 3: Human-readable name for the feature
+define pkg_config_find_and_add_enabled
+  ifeq ($$(PKG_CONFIG),)
+    $$(error pkg-config is required to auto-detect feature availability)
+  endif
+
+  NETSURF_FEATURE_$(1)_AVAILABLE := $$(shell $$(PKG_CONFIG) --exists $(2) && 
echo yes)
+  NETSURF_FEATURE_$(1)_CFLAGS ?= -DWITH_$(1)
+
+  ifeq ($$(NETSURF_USE_$(1)),YES)
+    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
+      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  enabled       (NETSURF_USE_$(1) := YES))
+      endif
+    else
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  failed        (NETSURF_USE_$(1) := YES))
+        $$(error Unable to find library for: $(3) ($(2)))
+      endif
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),AUTO)
+    ifeq ($$(NETSURF_FEATURE_$(1)_AVAILABLE),yes)
+      CFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      CXXFLAGS += $$(shell $$(PKG_CONFIG) --cflags $(2)) 
$$(NETSURF_FEATURE_$(1)_CFLAGS)
+      LDFLAGS += $$(shell $$(PKG_CONFIG) --libs $(2)) 
$$(NETSURF_FEATURE_$(1)_LDFLAGS)
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  auto-enabled  (NETSURF_USE_$(1) := 
AUTO))
+       NETSURF_USE_$(1) := YES
+      endif
+    else
+      ifneq ($(MAKECMDGOALS),clean)
+        $$(info M.CONFIG: $(3) ($(2))  auto-disabled (NETSURF_USE_$(1) := 
AUTO))
+       NETSURF_USE_$(1) := NO
+      endif
+    endif
+  else ifeq ($$(NETSURF_USE_$(1)),NO)
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(3) ($(2))    disabled      (NETSURF_USE_$(1) := NO))
+    endif
+  else
+    ifneq ($(MAKECMDGOALS),clean)
+      $$(info M.CONFIG: $(3) ($(2))    error         (NETSURF_USE_$(1) := 
$$(NETSURF_USE_$(1))))
+      $$(error NETSURF_USE_$(1) must be YES, NO, or AUTO)
+    endif
+  endif
+endef
diff --git a/frontends/Makefile.hts b/frontends/Makefile.hts
new file mode 100644
index 0000000..1915b35
--- /dev/null
+++ b/frontends/Makefile.hts
@@ -0,0 +1,122 @@
+# -*- mode: makefile-gmake -*-
+##
+## determine the HOST TARGET and SUBTARGET
+##
+
+# Determine host type
+# NOTE: HOST determination on RISC OS could fail because of missing bug fixes
+#      in UnixLib which only got addressed in UnixLib 5 / GCCSDK 4.
+#      When you don't have 'uname' available, you will see:
+#        File 'uname' not found
+#      When you do and using a 'uname' compiled with a buggy UnixLib, you
+#      will see the following printed on screen:
+#        RISC OS
+#      In both cases HOST make variable is empty and we recover from that by
+#      assuming we're building on RISC OS.
+#      In case you don't see anything printed (including the warning), you
+#      have an up-to-date RISC OS build system. ;-)
+HOST := $(shell uname -s)
+
+# Sanitise host
+# TODO: Ideally, we want the equivalent of s/[^A-Za-z0-9]/_/g here
+HOST := $(subst .,_,$(subst -,_,$(subst /,_,$(HOST))))
+
+ifeq ($(HOST),)
+  HOST := riscos
+  $(warning Build platform determination failed but that's a known problem for 
RISC OS so we're assuming a native RISC OS build.)
+else
+  ifeq ($(HOST),RISC OS)
+    # Fixup uname -s returning "RISC OS"
+    HOST := riscos
+  endif
+endif
+ifeq ($(HOST),riscos)
+  # Build happening on RO platform, default target is RO backend
+  ifeq ($(TARGET),)
+    TARGET := riscos
+  endif
+endif
+
+ifeq ($(HOST),BeOS)
+  HOST := beos
+endif
+ifeq ($(HOST),Haiku)
+  # Haiku implements the BeOS API
+  HOST := beos
+endif
+ifeq ($(HOST),beos)
+    # Build happening on BeOS platform, default target is BeOS backend
+    ifeq ($(TARGET),)
+      TARGET := beos
+    endif
+    ifeq ($(TARGET),haiku)
+      override TARGET := beos
+    endif
+endif
+
+ifeq ($(HOST),AmigaOS)
+  HOST := amiga
+  ifeq ($(TARGET),)
+    TARGET := amiga
+  endif
+endif
+
+ifeq ($(HOST),FreeMiNT)
+  HOST := mint
+endif
+ifeq ($(HOST),mint)
+  ifeq ($(TARGET),)
+    TARGET := atari
+  endif
+endif
+
+ifeq ($(findstring MINGW,$(HOST)),MINGW)
+  # MSYS' uname reports the likes of "MINGW32_NT-6.0"
+  HOST := windows
+endif
+ifeq ($(HOST),windows)
+  ifeq ($(TARGET),)
+    TARGET := windows
+  endif
+endif
+
+# Setup (sub)targets
+
+# empty default sub target
+SUBTARGET=
+
+# Default target is GTK 3 backend
+ifeq ($(TARGET),)
+  override TARGET := gtk
+  SUBTARGET = 3
+else
+  ifeq ($(TARGET),gtk)
+    # unspecified gtk is gtk3
+    SUBTARGET = 3
+  else
+    ifeq ($(TARGET),gtk3)
+      # gtk3 is gtk target with subtarget of 3
+      override TARGET := gtk
+      SUBTARGET = 3
+    else
+      ifeq ($(TARGET),gtk2)
+        # gtk2 is gtk target with subtarget of 2
+        override TARGET := gtk
+        SUBTARGET = 2
+      else
+        ifeq ($(TARGET),amigaos3)
+          override TARGET := amiga
+          SUBTARGET = os3      
+        endif
+      endif
+    endif
+  endif
+endif
+
+# valid values for the TARGET
+VLDTARGET := amiga atari beos framebuffer gtk monkey riscos windows
+
+# Check for valid TARGET
+ifeq ($(filter $(VLDTARGET),$(TARGET)),)
+  $(error Unknown TARGET "$(TARGET)", Must be one of $(VLDTARGET))
+endif
diff --git a/frontends/amiga/Makefile.tools b/frontends/amiga/Makefile.tools
new file mode 100644
index 0000000..c169287
--- /dev/null
+++ b/frontends/amiga/Makefile.tools
@@ -0,0 +1,21 @@
+# -*- mode: makefile-gmake -*-
+##
+## amiga target tool setup
+##
+
+ifeq ($(findstring amiga,$(HOST)),amiga)
+  # building for amiga on amiga
+  PKG_CONFIG := pkg-config
+else
+  ifeq ($(SUBTARGET),os3)
+    GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-unknown-amigaos/env
+    GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/m68k-unknown-amigaos/cross/bin
+  else
+    GCCSDK_INSTALL_ENV ?= /opt/netsurf/ppc-amigaos/env
+    GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/ppc-amigaos/cross/bin
+  endif
+
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
+endif
diff --git a/frontends/atari/Makefile.tools b/frontends/atari/Makefile.tools
new file mode 100644
index 0000000..971ab21
--- /dev/null
+++ b/frontends/atari/Makefile.tools
@@ -0,0 +1,19 @@
+# -*- mode: makefile-gmake -*-
+##
+## atari target tool setup
+##
+
+ifeq ($(HOST),atari)
+  PKG_CONFIG := pkg-config
+else
+  ifeq ($(HOST),mint)
+    PKG_CONFIG := pkg-config
+  else
+    GCCSDK_INSTALL_ENV ?= /opt/netsurf/m68k-atari-mint/env
+    GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/m68k-atari-mint/cross/bin
+
+    CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+
+    PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
+  endif
+endif
\ No newline at end of file
diff --git a/frontends/beos/Makefile.tools b/frontends/beos/Makefile.tools
new file mode 100644
index 0000000..0324a28
--- /dev/null
+++ b/frontends/beos/Makefile.tools
@@ -0,0 +1,14 @@
+# -*- mode: makefile-gmake -*-
+##
+## BeOS target tool setup
+##
+
+# Building for BeOS/Haiku
+#ifeq ($(HOST),beos)
+  # Build for BeOS on BeOS
+  GCCSDK_INSTALL_ENV := /boot/develop
+  CC := gcc
+  CXX := g++
+  EXEEXT :=
+  PKG_CONFIG := pkg-config
+#endif
diff --git a/frontends/framebuffer/Makefile.tools 
b/frontends/framebuffer/Makefile.tools
new file mode 100644
index 0000000..80623b1
--- /dev/null
+++ b/frontends/framebuffer/Makefile.tools
@@ -0,0 +1,15 @@
+# -*- mode: makefile-gmake -*-
+##
+## tool setup for the framebuffer target
+##
+
+ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
+  PKG_CONFIG := pkg-config
+else
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config                
+endif
+
+ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
+endif
diff --git a/frontends/gtk/Makefile.tools b/frontends/gtk/Makefile.tools
new file mode 100644
index 0000000..5331dcc
--- /dev/null
+++ b/frontends/gtk/Makefile.tools
@@ -0,0 +1,16 @@
+# -*- mode: makefile-gmake -*-
+##
+## tool setup for the gtk target
+##
+
+# use native package config
+PKG_CONFIG := pkg-config
+
+# gtk target processing
+ifeq ($(SUBTARGET),3)
+  override NETSURF_GTK_MAJOR := 3
+endif
+
+ifeq ($(SUBTARGET),2)
+  override NETSURF_GTK_MAJOR := 2
+endif
diff --git a/frontends/monkey/Makefile.tools b/frontends/monkey/Makefile.tools
new file mode 100644
index 0000000..7546506
--- /dev/null
+++ b/frontends/monkey/Makefile.tools
@@ -0,0 +1,15 @@
+# -*- mode: makefile-gmake -*-
+##
+## monkey target tool setup
+##
+
+ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
+  PKG_CONFIG := pkg-config
+else
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config                
+endif
+
+ifneq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
+endif
diff --git a/frontends/riscos/Makefile.tools b/frontends/riscos/Makefile.tools
new file mode 100644
index 0000000..9ea5c29
--- /dev/null
+++ b/frontends/riscos/Makefile.tools
@@ -0,0 +1,52 @@
+# -*- mode: makefile-gmake -*-
+##
+## RISC OS target tool setup
+##
+
+ifeq ($(HOST),riscos)
+  # Build for RO on RO
+  GCCSDK_INSTALL_ENV := <NSLibs$$Dir>
+  CCRES := ccres
+  TPLEXT :=
+  MAKERUN := makerun
+  SQUEEZE := squeeze
+  RUNEXT :=
+  CC := gcc
+  CXX := g++
+  EXEEXT :=
+  PKG_CONFIG :=
+else
+  # Cross-build for RO (either using GCCSDK 3.4.6 - AOF,
+  # either using GCCSDK 4 - ELF)
+  ifeq ($(origin GCCSDK_INSTALL_ENV),undefined)
+    ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/env),)
+      GCCSDK_INSTALL_ENV := /opt/netsurf/arm-unknown-riscos/env
+    else
+      GCCSDK_INSTALL_ENV := /home/riscos/env
+    endif
+  endif
+   ifeq ($(origin GCCSDK_INSTALL_CROSSBIN),undefined)
+    ifneq ($(realpath /opt/netsurf/arm-unknown-riscos/cross/bin),)
+      GCCSDK_INSTALL_CROSSBIN := /opt/netsurf/arm-unknown-riscos/cross/bin
+    else
+      GCCSDK_INSTALL_CROSSBIN := /home/riscos/cross/bin
+    endif
+  endif
+
+  CCRES := $(GCCSDK_INSTALL_CROSSBIN)/ccres
+  TPLEXT := ,fec
+  MAKERUN := $(GCCSDK_INSTALL_CROSSBIN)/makerun
+  SQUEEZE := $(GCCSDK_INSTALL_CROSSBIN)/squeeze
+  RUNEXT := ,feb
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  ifneq (,$(findstring arm-unknown-riscos-gcc,$(CC)))
+    SUBTARGET := -elf
+    EXEEXT := ,e1f
+    ELF2AIF := $(GCCSDK_INSTALL_CROSSBIN)/elf2aif
+  else
+   SUBTARGET := -aof
+   EXEEXT := ,ff8
+  endif
+  CXX := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*g++)
+  PKG_CONFIG := $(GCCSDK_INSTALL_ENV)/ro-pkg-config
+endif
diff --git a/frontends/windows/Makefile.tools b/frontends/windows/Makefile.tools
new file mode 100644
index 0000000..dff3dfe
--- /dev/null
+++ b/frontends/windows/Makefile.tools
@@ -0,0 +1,19 @@
+# -*- mode: makefile-gmake -*-
+##
+## windows (win32) target tool setup
+##
+
+ifneq ($(HOST),windows)
+  # Set Mingw defaults
+  GCCSDK_INSTALL_ENV ?= /opt/netsurf/i686-w64-mingw32/env
+  GCCSDK_INSTALL_CROSSBIN ?= /opt/netsurf/i686-w64-mingw32/cross/bin
+
+  CC := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*gcc)
+  WINDRES := $(wildcard $(GCCSDK_INSTALL_CROSSBIN)/*windres)
+
+  PKG_CONFIG := PKG_CONFIG_LIBDIR="$(GCCSDK_INSTALL_ENV)/lib/pkgconfig" 
pkg-config
+else
+  # Building on Windows
+  CC := gcc
+  PKG_CONFIG :=
+endif


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- netsurf-commits@netsurf-browser.org
To unsubscribe send an email to netsurf-commits-le...@netsurf-browser.org

Reply via email to