FLAGS = -fPIC ifeq (armv7-linux-androideabi,$(TARGET)) # Reset TARGET variable because armv7 target name used by Rust is not # the same as the target name needed for the CXX toolchain. TARGET = arm-linux-androideabi FLAGS += -march=armv7-a -mfpu=neon --target=$(TARGET) endif ifneq ($(HOST),$(TARGET)) CXX ?= $(TARGET)-g++ CC ?= $(TARGET)-gcc AR ?= $(TARGET)-ar else CXX ?= g++ CC ?= gcc AR ?= ar endif ifeq ($(DEBUG),true) FLAGS += -g else FLAGS += -O2 endif CFLAGS += $(FLAGS) CXXFLAGS += $(FLAGS) CONFIGURE_FLAGS = \ --prefix=$(OUT_DIR) \ --default-library static \ -Dicu=disabled \ -Dfreetype=disabled \ -Dglib=disabled \ -Dcoretext=auto \ # Create a unique temporary build directory BUILD_DIR := $(shell mktemp -d $(OUT_DIR)/rust_build.XXXXX) all: # Copy source files to BUILD_DIR to avoid changing originals. cp -a $(CARGO_MANIFEST_DIR)/harfbuzz/* $(BUILD_DIR) # Touch in BUILD_DIR avoid regenerating files. $(MAKE) -f $(CARGO_MANIFEST_DIR)/makefile.touch touch HARFBUZZ="$(BUILD_DIR)" # Configure and build in BUILD_DIR, install from BUILD_DIR into OUT_DIR. cd $(BUILD_DIR) && \ CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" meson build $(CONFIGURE_FLAGS) && \ meson compile -C build # Remove the no-longer-needed BUILD_DIR to save space. rm -rf $(BUILD_DIR) .PHONY: all