2012-05-04 02:58:42 +02:00
|
|
|
# quirc -- QR-code recognition library
|
|
|
|
# Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com>
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
|
|
# copyright notice and this permission notice appear in all copies.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
CC ?= gcc
|
|
|
|
PREFIX ?= /usr/local
|
2023-03-22 08:09:03 +01:00
|
|
|
SDL_CFLAGS := $(shell pkg-config --cflags sdl 2>&1)
|
|
|
|
SDL_LIBS = $(shell pkg-config --libs sdl)
|
2012-05-04 02:58:42 +02:00
|
|
|
|
2023-03-22 08:09:03 +01:00
|
|
|
LIB_VERSION = 1.2
|
2012-05-04 02:58:42 +02:00
|
|
|
|
2016-08-11 12:25:08 +02:00
|
|
|
CFLAGS ?= -O3 -Wall -fPIC
|
2016-08-11 00:29:21 +02:00
|
|
|
QUIRC_CFLAGS = -Ilib $(CFLAGS) $(SDL_CFLAGS)
|
2012-05-04 02:58:42 +02:00
|
|
|
LIB_OBJ = \
|
|
|
|
lib/decode.o \
|
|
|
|
lib/identify.o \
|
|
|
|
lib/quirc.o \
|
|
|
|
lib/version_db.o
|
|
|
|
DEMO_OBJ = \
|
|
|
|
demo/camera.o \
|
|
|
|
demo/mjpeg.o \
|
2021-03-18 09:17:58 +01:00
|
|
|
demo/convert.o
|
|
|
|
DEMO_UTIL_OBJ = \
|
2012-05-04 02:58:42 +02:00
|
|
|
demo/dthash.o \
|
|
|
|
demo/demoutil.o
|
|
|
|
|
2023-03-22 08:09:03 +01:00
|
|
|
OPENCV_CFLAGS := $(shell pkg-config --cflags opencv4 2>&1)
|
|
|
|
OPENCV_LIBS = $(shell pkg-config --libs opencv4)
|
2021-03-18 09:17:58 +01:00
|
|
|
QUIRC_CXXFLAGS = $(QUIRC_CFLAGS) $(OPENCV_CFLAGS) --std=c++17
|
|
|
|
|
2021-08-26 07:11:12 +02:00
|
|
|
.PHONY: all v4l sdl opencv install uninstall clean
|
|
|
|
|
|
|
|
all: libquirc.so qrtest
|
|
|
|
|
|
|
|
v4l: quirc-scanner
|
|
|
|
|
|
|
|
sdl: inspect quirc-demo
|
|
|
|
|
|
|
|
opencv: inspect-opencv quirc-demo-opencv
|
2012-05-04 02:58:42 +02:00
|
|
|
|
|
|
|
qrtest: tests/dbgutil.o tests/qrtest.o libquirc.a
|
2016-08-11 11:35:55 +02:00
|
|
|
$(CC) -o $@ tests/dbgutil.o tests/qrtest.o libquirc.a $(LDFLAGS) -lm -ljpeg -lpng
|
2012-05-04 02:58:42 +02:00
|
|
|
|
|
|
|
inspect: tests/dbgutil.o tests/inspect.o libquirc.a
|
2016-08-11 11:35:55 +02:00
|
|
|
$(CC) -o $@ tests/dbgutil.o tests/inspect.o libquirc.a $(LDFLAGS) -lm -ljpeg -lpng $(SDL_LIBS) -lSDL_gfx
|
2012-05-04 02:58:42 +02:00
|
|
|
|
2021-04-08 04:11:37 +02:00
|
|
|
inspect-opencv: tests/dbgutil.o tests/inspect_opencv.o libquirc.a
|
|
|
|
$(CXX) -o $@ tests/dbgutil.o tests/inspect_opencv.o libquirc.a $(LDFLAGS) -lm -ljpeg -lpng $(OPENCV_LIBS)
|
|
|
|
|
2021-03-18 09:17:58 +01:00
|
|
|
quirc-demo: $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/demo.o libquirc.a
|
|
|
|
$(CC) -o $@ $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/demo.o libquirc.a $(LDFLAGS) -lm -ljpeg $(SDL_LIBS) -lSDL_gfx
|
|
|
|
|
|
|
|
quirc-demo-opencv: $(DEMO_UTIL_OBJ) demo/demo_opencv.o libquirc.a
|
2021-04-08 02:39:44 +02:00
|
|
|
$(CXX) -o $@ $(DEMO_UTIL_OBJ) demo/demo_opencv.o libquirc.a $(LDFLAGS) -lm $(OPENCV_LIBS)
|
2012-05-04 02:58:42 +02:00
|
|
|
|
2021-03-18 09:17:58 +01:00
|
|
|
quirc-scanner: $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/scanner.o libquirc.a
|
|
|
|
$(CC) -o $@ $(DEMO_OBJ) $(DEMO_UTIL_OBJ) demo/scanner.o libquirc.a $(LDFLAGS) -lm -ljpeg
|
2012-05-04 02:58:42 +02:00
|
|
|
|
|
|
|
libquirc.a: $(LIB_OBJ)
|
|
|
|
rm -f $@
|
2016-08-11 11:35:55 +02:00
|
|
|
ar cru $@ $(LIB_OBJ)
|
2012-05-04 02:58:42 +02:00
|
|
|
ranlib $@
|
|
|
|
|
2016-08-11 00:32:09 +02:00
|
|
|
.PHONY: libquirc.so
|
|
|
|
libquirc.so: libquirc.so.$(LIB_VERSION)
|
|
|
|
|
|
|
|
libquirc.so.$(LIB_VERSION): $(LIB_OBJ)
|
2016-08-11 11:35:55 +02:00
|
|
|
$(CC) -shared -o $@ $(LIB_OBJ) $(LDFLAGS) -lm
|
2012-05-04 02:58:42 +02:00
|
|
|
|
2016-08-11 11:34:13 +02:00
|
|
|
.c.o:
|
2016-08-11 12:25:08 +02:00
|
|
|
$(CC) $(QUIRC_CFLAGS) -o $@ -c $<
|
2012-05-04 02:58:42 +02:00
|
|
|
|
2021-03-18 09:17:58 +01:00
|
|
|
.SUFFIXES: .cxx
|
|
|
|
.cxx.o:
|
|
|
|
$(CXX) $(QUIRC_CXXFLAGS) -o $@ -c $<
|
|
|
|
|
2016-08-11 00:32:09 +02:00
|
|
|
install: libquirc.a libquirc.so.$(LIB_VERSION) quirc-demo quirc-scanner
|
2012-05-04 02:58:42 +02:00
|
|
|
install -o root -g root -m 0644 lib/quirc.h $(DESTDIR)$(PREFIX)/include
|
|
|
|
install -o root -g root -m 0644 libquirc.a $(DESTDIR)$(PREFIX)/lib
|
2016-08-11 00:32:09 +02:00
|
|
|
install -o root -g root -m 0755 libquirc.so.$(LIB_VERSION) \
|
|
|
|
$(DESTDIR)$(PREFIX)/lib
|
2012-05-04 02:58:42 +02:00
|
|
|
install -o root -g root -m 0755 quirc-demo $(DESTDIR)$(PREFIX)/bin
|
2021-03-18 09:17:58 +01:00
|
|
|
# install -o root -g root -m 0755 quirc-demo-opencv $(DESTDIR)$(PREFIX)/bin
|
2012-05-04 02:58:42 +02:00
|
|
|
install -o root -g root -m 0755 quirc-scanner $(DESTDIR)$(PREFIX)/bin
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/include/quirc.h
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/lib/libquirc.so.$(LIB_VERSION)
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/lib/libquirc.a
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/quirc-demo
|
2021-03-18 09:17:58 +01:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/quirc-demo-opencv
|
2012-05-04 02:58:42 +02:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/quirc-scanner
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f */*.o
|
|
|
|
rm -f */*.lo
|
|
|
|
rm -f libquirc.a
|
2016-08-11 00:32:09 +02:00
|
|
|
rm -f libquirc.so.$(LIB_VERSION)
|
2012-05-04 02:58:42 +02:00
|
|
|
rm -f qrtest
|
|
|
|
rm -f inspect
|
2021-04-08 04:11:37 +02:00
|
|
|
rm -f inspect-opencv
|
2012-05-04 02:58:42 +02:00
|
|
|
rm -f quirc-demo
|
2021-03-18 09:17:58 +01:00
|
|
|
rm -f quirc-demo-opencv
|
2012-05-04 02:58:42 +02:00
|
|
|
rm -f quirc-scanner
|