[yocto] include and a library dependency in a recipe which uses a Makefile

Rail Shafigulin rail at esenciatech.com
Fri Dec 1 12:41:14 PST 2017


Somewhat new to Yocto.

I have a relatively simple Makefile which builds a library. The file
is shown below:

LIB=PyAnokiWave

It is shown below
# Add any other object files to this list below
LIB_OBJS = libPyAnokiWave.o
LIB_HEADERS=libPyAnokiWave.h

CFLAGS+=-I/usr/include/python2.7
LDFLAGS+=-lpython2.7 -lAnokiWave
all: build

.PHONY: build
build: $(LIB).a $(LIB).so

$(LIB).a:$(LIB_OBJS)
    $(AR) rcs $@ $(LIB_OBJS)

$(LIB).so:$(LIB_OBJS)
    $(CC) $(LDFLAGS) -shared -g -o $@ $(LIB_OBJS)

%.o: %.c
    $(CC) -c $(CFLAGS) -o $@ $<

I need to use this Makefile in a recipe which but I'm struggling to
figure out how to make it point to correct include folder as well as a
library folder.

Here is what I need to change:

1. CFLAGS+=-I/usr/include/python2.7

Clearly it is not pointing to the right location. How do I make it
point to the include directory of my build (at least I think it should
point to this location)

2. LDFLAGS+=-lpython2.7 -lAnokiWave

I do have a meta-python layer and it builds python2.7 library. I also
have a custom layer which builds a libAnokiWave.so. How do I make
compiler/linker point to the right folders so that these libraries
would be used? I do understand that it has something to do with the
EXTRA_OEMAKE variable, but I wasn't able to find a good example that
would show me how to use it.

At the moment my do_compile task looks like the following:

do_compile () {
    oe_runmake
}

I would greatly appreciate any help with this.
-- 
Rail Shafigulin
Software Engineer
Esencia Technologies

-- 




*ESENCIA TECHNOLOGIES, INC.*3945 Freedom Circle, Suite #360,
Santa Clara CA 95054
________________________________________________________

Phone: +1 408 736 8284 Fax: +1 408 519 3475 
http://www.esenciatech.com | http://www.lnttechservices.com





More information about the yocto mailing list