[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RFH: Passing CFLAGS fails and how to pass LDFLAGS



Hi,

I have a problem in the libfuse-ocaml package I'm writing. To compile
I need to set some CFLAGS and to link some LDFLAGS. My Makefile looks
like this:

SOURCES   = fuse.mli fuse.ml fuse_stubs.c
CFLAGS    = -O2 -g -W -Wall
override CFLAGS += $(shell pkg-config --cflags fuse)
#CLIBS  := $(shell pkg-config --libs fuse)
CLIBS    := fuse
RESULT    = fuse

-include $(OCAMLMAKEFILE)


The override is needed because dpkg-buildpackage sets CFLAGS as
environment variable. Now this works fine and CFLAGS is set. I
verified that with $(info CFLAGS = $(CFLAGS)).

CFLAGS remain set inside the OCAMLMAKEFILE up to the point where it
calls

native-code:            $(PRE_TARGETS)
                        $(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) $(NCRESULT) \
                                REAL_RESULT="$(NCRESULT)" \
                                REAL_OCAMLC="$(OCAMLOPT)" \
                                make_deps=yes

When recursing the CFLAGS get reset to dpkg-buildpackage values. How
am I suposed to set some CFLAGS?


On the same note how do I set LDFLAGS. The CLIBS variable
automatically adds -l to its contents, which does not work well with
pkg-config --libs fuse ==> -pthread -lfuse -lrt -ldl

MfG
        Goswin


Reply to: