new file mode 100755
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+function help() {
+ cat << __END__
+Usage: $0 --host <cross-compiler-prefix> [--strip] [target]
+
+ --host <cross-compiler-prefix> The toolchain prefix, for example: arm-linux-gnueabi
+ If required, you can define the complete path
+ --strip Strip binaries (optional)
+ --with-jpeg-dir Complete path to jpeg library installation (optional)
+ --static Make compilation static (good for test on embedded systems)
+ (optional)
+ target The makefile target (clean, all, etc...)
+
+__END__
+}
+
+while [ "$END" == "" ] ; do
+ case "$1" in
+ --host)
+ shift;
+ HOST="$1"
+ shift;
+ ;;
+ --strip)
+ shift
+ STRIP="-s"
+ ;;
+ --static)
+ OPT_LINKTYPE="LINKTYPE=static";
+ shift;
+ ;;
+ --with-jpeg-dir)
+ shift
+ OPT_JPEG_INCLUDE="-I$1/include"
+ OPT_JPEG_LIB="-L$1/lib"
+ shift
+ ;;
+ --help)
+ help $0
+ shift
+ exit 1
+ ;;
+ *)
+ END=y
+ ;;
+ esac
+done
+
+if [ "$HOST" == "" ] ; then
+ echo "--host is mandatory. $0 help to have assistance."
+ exit 1
+fi
+
+make CC="$HOST-gcc" LD="$HOST-g++" CXX="$HOST-g++" CFLAGS="$OPT_JPEG_INCLUDE" CPPFLAGS="$OPT_JPEG_INCLUDE" $OPT_LINKTYPE LDFLAGS="$STRIP $OPT_JPEG_LIB" NOQT4=y $@
+
@@ -5,6 +5,7 @@ all install:
$(MAKE) -C $$i $@ || exit 1; \
done
+ifneq ($(NOQT4),y)
# Test whether qmake is installed, and whether it is for qt4.
@if which qmake-qt4 >/dev/null 2>&1; then \
QMAKE=qmake-qt4; \
@@ -19,6 +20,7 @@ all install:
$(MAKE) -C qv4l2 -f Makefile.install $@; \
fi \
fi
+endif
sync-with-kernel:
$(MAKE) -C keytable $@
@@ -1,12 +1,16 @@
TARGETS = v4l2-compliance
+ifeq ($(LINKTYPE),static)
+ EXTRA_LIBS=-ljpeg
+endif
+
all: $(TARGETS)
-include *.d
v4l2-compliance: v4l2-compliance.o v4l2-test-debug.o v4l2-test-input-output.o \
v4l2-test-controls.o v4l2-test-io-config.o v4l2-test-formats.o
- $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt
+ $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt $(EXTRA_LIBS)
install: $(TARGETS)
mkdir -p $(DESTDIR)$(PREFIX)/bin
@@ -2,18 +2,22 @@ override CPPFLAGS += -DV4L_UTILS_VERSION=\"$(V4L_UTILS_VERSION)\"
TARGETS = cx18-ctl ivtv-ctl v4l2-ctl
+ifeq ($(LINKTYPE),static)
+ EXTRA_LIBS=-ljpeg
+endif
+
all: $(TARGETS)
-include *.d
cx18-ctl: cx18-ctl.o
- $(CC) $(LDFLAGS) -o $@ $^
+ $(CC) $(LDFLAGS) -o $@ $^ $(EXTRA_LIBS)
ivtv-ctl: ivtv-ctl.o
- $(CC) $(LDFLAGS) -o $@ $^ -lm
+ $(CC) $(LDFLAGS) -o $@ $^ -lm $(EXTRA_LIBS)
v4l2-ctl: v4l2-ctl.o
- $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt
+ $(CXX) $(LDFLAGS) -o $@ $^ -lv4l2 -lv4lconvert -lrt $(EXTRA_LIBS)
install: $(TARGETS)
mkdir -p $(DESTDIR)$(PREFIX)/bin