notmuch/bindings/Makefile.local
Felipe Contreras 3dae253c4f ruby: improve compilation with CFLAGS
The ruby MakeMakefile generates a makefile that is suboptimal, which has
CFLAGS like this:

  CFLAGS   = $(CCDLFLAGS) -march=x86-64 -mtune=generic \
    -O2 -pipe -fno-plt -fPIC $(ARCH_FLAG)

This works as long as the user doesn't modify the Makefile.

Certain flags (namely -fPIC) need to be present regardless of what
CFLAGS are specified.

The Makefile should have done this instead:

  CFLAGS = -march=x86-64 -mtune=generic -O2
  override CFLAGS += $(CCDLFLAGS) -pipe -fno-plt -fPIC $(ARCH_FLAG)

Unfortunately they didn't, so we need to workaround their lack of
foresight.

We can simply add the necessary flags in the parent Makefile so everyone
is happy.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-22 09:17:21 -03:00

31 lines
898 B
Text

# -*- makefile-gmake -*-
dir := bindings
# force the shared library to be built
ruby-bindings: lib/$(LINKER_NAME)
ifeq ($(HAVE_RUBY_DEV),1)
cd $(dir)/ruby && \
EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
NOTMUCH_SRCDIR='$(NOTMUCH_SRCDIR)' \
$(RUBY) extconf.rb --vendor
$(MAKE) -C $(dir)/ruby CFLAGS="$(CFLAGS) -pipe -fno-plt -fPIC"
endif
python-cffi-bindings: lib/$(LINKER_NAME)
ifeq ($(HAVE_PYTHON3_CFFI),1)
cd $(dir)/python-cffi && \
${PYTHON} setup.py build --build-lib build/stage && \
mkdir -p build/stage/tests && cp tests/*.py build/stage/tests
endif
CLEAN += $(patsubst %,$(dir)/ruby/%, \
.RUBYARCHDIR.time \
Makefile database.o directory.o filenames.o\
init.o message.o messages.o mkmf.log notmuch.so query.o \
status.o tags.o thread.o threads.o)
CLEAN += bindings/ruby/.vendorarchdir.time
CLEAN += bindings/python-cffi/build