summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2021-01-17 20:06:24 +0000
committerVincent Sanders <vince@kyllikki.org>2021-01-17 20:06:24 +0000
commit5db541a6d7e1d6ae7792e392f8e7dd5d5b07345f (patch)
treeb50d63dae50a85a7d3095a77bb2bb84c021f6a3e /frontends
parent25c21e5fefc554c1941aa1a99b5b7a6c6ca67589 (diff)
downloadnetsurf-5db541a6d7e1d6ae7792e392f8e7dd5d5b07345f.tar.gz
netsurf-5db541a6d7e1d6ae7792e392f8e7dd5d5b07345f.tar.bz2
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.
Diffstat (limited to 'frontends')
-rw-r--r--frontends/Makefile.hts122
-rw-r--r--frontends/amiga/Makefile.tools21
-rw-r--r--frontends/atari/Makefile.tools19
-rw-r--r--frontends/beos/Makefile.tools14
-rw-r--r--frontends/framebuffer/Makefile.tools15
-rw-r--r--frontends/gtk/Makefile.tools16
-rw-r--r--frontends/monkey/Makefile.tools15
-rw-r--r--frontends/riscos/Makefile.tools52
-rw-r--r--frontends/windows/Makefile.tools19
9 files changed, 293 insertions, 0 deletions
diff --git a/frontends/Makefile.hts b/frontends/Makefile.hts
new file mode 100644
index 000000000..1915b3592
--- /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 000000000..c16928783
--- /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 000000000..971ab21be
--- /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 000000000..0324a2825
--- /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 000000000..80623b164
--- /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 000000000..5331dcc71
--- /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 000000000..7546506ff
--- /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 000000000..9ea5c29f2
--- /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 000000000..dff3dfec3
--- /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