From 45898d38267843a8631f9786451ffa3f46279d91 Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Sat, 23 Aug 2014 18:25:18 +0200 Subject: [PATCH] Support mxe build environment for windows cross builds Override all tools with prefixed versions if the CROSS variable has been set. This is the recommended way to enable cross compilation using mxe without touching lots of environment variables first. --- common.mk | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/common.mk b/common.mk index 21172c5..9f27d7a 100644 --- a/common.mk +++ b/common.mk @@ -1,9 +1,17 @@ # makefile variables and rules shared by both gkrellm and gkrellmd -CC ?= gcc -AR ?= ar -PKG_CONFIG ?= pkg-config -WINDRES ?= windres +ifdef CROSS + # enforce overriding tools for mxe cross builds (http://mxe.cc) + CC = $(CROSS)gcc + AR = $(CROSS)ar + PKG_CONFIG = $(CROSS)pkg-config + WINDRES = $(CROSS)windres +else + CC ?= gcc + AR ?= ar + PKG_CONFIG ?= pkg-config + WINDRES ?= windres +endif PREFIX ?= /usr/local INSTALLROOT ?= $(DESTDIR)$(PREFIX)