summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-01 11:08:28 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2014-05-01 11:08:28 (GMT)
commit3a09bf7c6b3afcf911624001cc55dacfd04d8f6e (patch)
treea037a1b982d4130cf02927c334c8cdfe0ad50edd
parentd65dba6f6e4d4c35b9db3c8036913e48809fad2e (diff)
downloadnetsurf-all-3a09bf7c6b3afcf911624001cc55dacfd04d8f6e.tar.gz
netsurf-all-3a09bf7c6b3afcf911624001cc55dacfd04d8f6e.tar.bz2
make host tool build depend on target
-rw-r--r--Makefile47
1 files changed, 37 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index eef87cb..f8d0343 100644
--- a/Makefile
+++ b/Makefile
@@ -6,51 +6,78 @@
COMPONENT := netsurf-all
COMPONENT_VERSION := 3.1
-.PHONY: build install clean release-checkout dist
-
-export TARGET ?= gtk
-export PKG_CONFIG_PATH = $(TMP_PREFIX)/lib/pkgconfig
-TMP_PREFIX := $(CURDIR)/inst-$(TARGET)
+# Targets
+# Netsurf target
NETSURF_TARG := netsurf
# nsgenbind host tool
NSGENBIND_TARG := nsgenbind
-NSLIB_ALL_TARG := buildsystem libwapcaplet libparserutils libcss libhubbub libdom libnsbmp libnsgif librosprite libsvgtiny
+# Library targets
+NSLIB_ALL_TARG := buildsystem libwapcaplet libparserutils libcss libhubbub libdom libnsbmp libnsgif librosprite libsvgtiny
NSLIB_FB_TARG := libnsfb
NSLIB_RO_TARG := librufl libpencil
+
+# Build Environment
+export TARGET ?= gtk
+export PKG_CONFIG_PATH = $(TMP_PREFIX)/lib/pkgconfig
+TMP_PREFIX := $(CURDIR)/inst-$(TARGET)
+HOST := $(shell uname -s)
+
# only build what we require for the target
ifeq ($(TARGET),riscos)
NSLIB_TARG := $(NSLIB_ALL_TARG) $(NSLIB_RO_TARG)
+ NSHOST_TARG := $(NSGENBIND_TARG)
else
ifeq ($(TARGET),framebuffer)
NSLIB_TARG := $(NSLIB_ALL_TARG) $(NSLIB_FB_TARG)
+ NSHOST_TARG := $(NSGENBIND_TARG)
else
ifeq ($(TARGET),amiga)
NSLIB_TARG := $(NSLIB_ALL_TARG)
- NETSURF_CONFIG := NETSURF_USE_MOZJS=YES
+ NSHOST_TARG := $(NSGENBIND_TARG)
+ NETSURF_CONFIG := NETSURF_USE_MOZJS=YES
else
- NSLIB_TARG := $(NSLIB_ALL_TARG)
+ ifeq ($(TARGET),cocoa)
+ NSLIB_TARG := $(NSLIB_ALL_TARG)
+ else
+ NSLIB_TARG := $(NSLIB_ALL_TARG)
+ NSHOST_TARG := $(NSGENBIND_TARG)
+ endif
endif
endif
endif
+.PHONY: build install clean release-checkout dist
+
# clean macro for each sub target
define do_clean
$(MAKE) distclean --directory=$1 TARGET=$(TARGET)
endef
+# clean macro for each host sub target
+define do_host_clean
+ $(MAKE) distclean --directory=$1 TARGET=$(HOST)
+
+endef
+
# prefixed install macro for each sub target
define do_prefix_install
$(MAKE) install --directory=$1 TARGET=$(TARGET) PREFIX=$(TMP_PREFIX) DESTDIR=
endef
+# prefixed install macro for each host sub target
+define do_host_prefix_install
+ $(MAKE) install --directory=$1 TARGET=$(HOST) PREFIX=$(TMP_PREFIX) DESTDIR=
+
+endef
+
build: $(TMP_PREFIX)/build-stamp
$(TMP_PREFIX)/build-stamp:
@@ -58,7 +85,7 @@ $(TMP_PREFIX)/build-stamp:
mkdir -p $(TMP_PREFIX)/lib
mkdir -p $(TMP_PREFIX)/bin
$(foreach L,$(NSLIB_TARG),$(call do_prefix_install,$(L)))
- $(MAKE) install --directory=$(NSGENBIND_TARG) PREFIX=$(TMP_PREFIX) TARGET=$(shell uname -s)
+ $(foreach L,$(NSHOST_TARG),$(call do_prefix_install,$(L)))
$(MAKE) --directory=$(NETSURF_TARG) PREFIX=$(PREFIX) TARGET=$(TARGET) $(NETSURF_CONFIG)
touch $@
@@ -71,7 +98,7 @@ install: $(TMP_PREFIX)/build-stamp
clean:
$(RM) -r $(TMP_PREFIX)
$(foreach L,$(NSLIB_TARG),$(call do_clean,$(L)))
- $(MAKE) clean --directory=$(NSGENBIND_TARG) TARGET=$(TARGET)
+ $(foreach L,$(NSHOST_TARG),$(call do_host_clean,$(L)))
$(MAKE) clean --directory=$(NETSURF_TARG) TARGET=$(TARGET)
release-checkout: $(NSLIB_TARG) $(NETSURF_TARG) $(NSGENBIND_TARG) $(NSLIB_RO_TARG)