summaryrefslogtreecommitdiff
path: root/v4l2-apps/lib/libv4l/libv4l2/Makefile
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-08-22 10:34:29 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-08-22 10:34:29 -0300
commit4d3f684d3b6ab28ec9e251fff156d0b0f53d0517 (patch)
treef82a2ae2dc042d6d1de61f62babeb8c5f28b22a1 /v4l2-apps/lib/libv4l/libv4l2/Makefile
parent87eb1f67e4981f3a09825012f16af0107a7adb45 (diff)
parentb5ff2cd5cc913156858a0b15a186144f146c89d7 (diff)
downloadmediapointer-dvb-s2-4d3f684d3b6ab28ec9e251fff156d0b0f53d0517.tar.gz
mediapointer-dvb-s2-4d3f684d3b6ab28ec9e251fff156d0b0f53d0517.tar.bz2
merge: http://linuxtv.org/hg/~mkrufky/sms1xxx
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4l2/Makefile')
-rw-r--r--v4l2-apps/lib/libv4l/libv4l2/Makefile49
1 files changed, 38 insertions, 11 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l2/Makefile b/v4l2-apps/lib/libv4l/libv4l2/Makefile
index 1258e379b..d8ac01c34 100644
--- a/v4l2-apps/lib/libv4l/libv4l2/Makefile
+++ b/v4l2-apps/lib/libv4l/libv4l2/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
-V4L2_OBJS = libv4l2.o log.o ../libv4lconvert/libv4lconvert.so
-V4L2_LIB = libv4l2.so
+V4L2_OBJS = libv4l2.o log.o
V4L2CONVERT = v4l2convert.so
V4L2CONVERT_O = v4l2convert.o libv4l2.so
-TARGETS = $(V4L2_LIB) $(V4L2CONVERT)
+TARGETS = $(V4L2_LIB) libv4l2.pc
INCLUDES = ../include/libv4l2.h
+ifeq ($(LINKTYPE),static)
+V4L2_LIB = libv4l2.a
+else
+V4L2_LIB = libv4l2.so
+V4L2_OBJS += ../libv4lconvert/libv4lconvert.so
+TARGETS += $(V4L2CONVERT)
+CPPFLAGS += -fPIC
+endif
+
ifeq ($(LIB_RELEASE),)
LIB_RELEASE = 0
endif
@@ -33,23 +38,45 @@ $(V4L2_LIB): $(V4L2_OBJS)
$(V4L2CONVERT): $(V4L2CONVERT_O) $(V4L2_LIB)
+libv4l2.pc:
+ @echo prefix=$(PREFIX) > libv4l2.pc
+ @echo libdir=$(LIBDIR) >> libv4l2.pc
+ @echo >> libv4l2.pc
+ @echo 'Name: libv4l2' >> libv4l2.pc
+ @echo 'Description: v4l2 device access library' >> libv4l2.pc
+ @echo 'Version: '$(V4L2_LIB_VERSION) >> libv4l2.pc
+ @echo 'Requires: libv4lconvert' >> libv4l2.pc
+ @echo 'Libs: -L$${libdir} -lv4l2' >> libv4l2.pc
+ @echo 'Libs.private: -lpthread' >> libv4l2.pc
+ @echo 'Cflags: -I$${prefix}/include' >> libv4l2.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 $(V4L2_LIB) $(DESTDIR)$(LIBDIR)
+else
mkdir -p $(DESTDIR)$(LIBDIR)/libv4l
install -m 755 $(V4L2_LIB).$(LIB_RELEASE) $(DESTDIR)$(LIBDIR)
cd $(DESTDIR)$(LIBDIR) && \
ln -f -s $(V4L2_LIB).$(LIB_RELEASE) $(V4L2_LIB)
install -m 755 $(V4L2CONVERT).$(LIB_RELEASE) \
$(DESTDIR)$(LIBDIR)/libv4l/$(V4L2CONVERT)
+endif
+ mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ install -m 644 libv4l2.pc $(DESTDIR)$(LIBDIR)/pkgconfig
clean::
- rm -f *.so* *.o log *~
- rm -f *.d
+ rm -f *.a *.so* *.o *.d libv4l2.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 $@ $^
+