Browse Source

Allow cross-compiling plugins by setting CROSS_COMPILE environment variable to a machine triplet.

tags/v2.2.1
Andrew Belt 1 year ago
parent
commit
75f90aa95e
3 changed files with 17 additions and 1 deletions
  1. +5
    -1
      arch.mk
  2. +6
    -0
      compile.mk
  3. +6
    -0
      dep.mk

+ 5
- 1
arch.mk View File

@@ -1,4 +1,8 @@
MACHINE := $(shell $(CC) -dumpmachine)
ifdef CROSS_COMPILE
MACHINE := $(CROSS_COMPILE)
else
MACHINE ?= $(shell $(CC) -dumpmachine)
endif


ifneq (,$(findstring x86_64-,$(MACHINE))) ifneq (,$(findstring x86_64-,$(MACHINE)))
ARCH_X64 := 1 ARCH_X64 := 1


+ 6
- 0
compile.mk View File

@@ -20,6 +20,12 @@ FLAGS += -Wall -Wextra -Wno-unused-parameter
# C++ standard # C++ standard
CXXFLAGS += -std=c++11 CXXFLAGS += -std=c++11


# Define compiler/linker target if cross-compiling
ifdef CROSS_COMPILE
FLAGS += --target=$(MACHINE)
LDFLAGS += --target=$(MACHINE)
endif

# Architecture-independent flags # Architecture-independent flags
ifdef ARCH_X64 ifdef ARCH_X64
FLAGS += -DARCH_X64 FLAGS += -DARCH_X64


+ 6
- 0
dep.mk View File

@@ -10,6 +10,12 @@ DEP_FLAGS += -g -O3
# Static libs don't usually compiled with -fPIC, but since we're including them in a shared library, it's needed. # Static libs don't usually compiled with -fPIC, but since we're including them in a shared library, it's needed.
DEP_FLAGS += -fPIC DEP_FLAGS += -fPIC


# Define compiler/linker target if cross-compiling
ifdef CROSS_COMPILE
DEP_FLAGS += --target=$(MACHINE)
DEP_LDFLAGS += --target=$(MACHINE)
endif

ifdef ARCH_X64 ifdef ARCH_X64
DEP_FLAGS += -march=nehalem DEP_FLAGS += -march=nehalem
endif endif


Loading…
Cancel
Save