diff options
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4l1/Makefile')
-rw-r--r-- | v4l2-apps/lib/libv4l/libv4l1/Makefile | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l1/Makefile b/v4l2-apps/lib/libv4l/libv4l1/Makefile index 8cb064cd4..c92731daa 100644 --- a/v4l2-apps/lib/libv4l/libv4l1/Makefile +++ b/v4l2-apps/lib/libv4l/libv4l1/Makefile @@ -1,20 +1,25 @@ -CC = gcc -LD = gcc - -CPPFLAGS = -fPIC -I../include -I../../../../linux/include +CPPFLAGS = -I../include -I../../../../linux/include CFLAGS := -g -O1 CFLAGS += -Wall -W -Wno-unused -Wpointer-arith -Wstrict-prototypes -LDFLAGS = -shared +LIBS = -lpthread -V4L1_OBJS = libv4l1.o log.o ../libv4l2/libv4l2.so -V4L1_LIB = libv4l1.so +V4L1_OBJS = libv4l1.o log.o V4L1COMPAT = v4l1compat.so V4L1COMPAT_O = v4l1compat.o libv4l1.so -TARGETS = $(V4L1_LIB) $(V4L1COMPAT) +TARGETS = $(V4L1_LIB) libv4l1.pc INCLUDES = ../include/libv4l1.h +ifeq ($(LINKTYPE),static) +V4L1_LIB = libv4l1.a +else +V4L1_LIB = libv4l1.so +V4L1_OBJS += ../libv4l2/libv4l2.so +TARGETS += $(V4L1COMPAT) +CPPFLAGS += -fPIC +endif + ifeq ($(LIB_RELEASE),) LIB_RELEASE = 0 endif @@ -34,23 +39,45 @@ $(V4L1_LIB): $(V4L1_OBJS) $(V4L1COMPAT): $(V4L1COMPAT_O) $(V4L1_LIB) +libv4l1.pc: + @echo prefix=$(PREFIX) > libv4l1.pc + @echo libdir=$(LIBDIR) >> libv4l1.pc + @echo >> libv4l1.pc + @echo 'Name: libv4l1' >> libv4l1.pc + @echo 'Description: v4l1 compatibility library' >> libv4l1.pc + @echo 'Version: '$(V4L2_LIB_VERSION) >> libv4l1.pc + @echo 'Requires: libv4l2' >> libv4l1.pc + @echo 'Libs: -L$${libdir} -lv4l1' >> libv4l1.pc + @echo 'Libs.private: -lpthread' >> libv4l1.pc + @echo 'Cflags: -I$${prefix}/include' >> libv4l1.pc + install: all mkdir -p $(DESTDIR)$(PREFIX)/include install -p -m 644 $(INCLUDES) $(DESTDIR)$(PREFIX)/include +ifeq ($(LINKTYPE),static) + mkdir -p $(DESTDIR)$(LIBDIR) + install -m 644 $(V4L1_LIB) $(DESTDIR)$(LIBDIR) +else mkdir -p $(DESTDIR)$(LIBDIR)/libv4l install -m 755 $(V4L1_LIB).$(LIB_RELEASE) $(DESTDIR)$(LIBDIR) cd $(DESTDIR)$(LIBDIR) && \ ln -f -s $(V4L1_LIB).$(LIB_RELEASE) $(V4L1_LIB) install -m 755 $(V4L1COMPAT).$(LIB_RELEASE) \ $(DESTDIR)$(LIBDIR)/libv4l/$(V4L1COMPAT) +endif + mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig + install -m 644 libv4l1.pc $(DESTDIR)$(LIBDIR)/pkgconfig clean:: - rm -f *.so* *.o log *~ - rm -f *.d + rm -f *.a *.so* *.o *.d libv4l1.pc log *~ %.o: %.c $(CC) -c -MMD $(CPPFLAGS) $(CFLAGS) -o $@ $< %.so: - $(CC) $(LDFLAGS) -Wl,-soname,$@.$(LIB_RELEASE) -o $@.$(LIB_RELEASE) $^ + $(CC) -shared $(LDFLAGS) -Wl,-soname,$@.$(LIB_RELEASE) -o $@.$(LIB_RELEASE) $^ $(LIBS) ln -f -s $@.$(LIB_RELEASE) $@ + +%.a: + $(AR) cqs $@ $^ + |