1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
UNAME := $(shell uname)
PYTHON ?= python3
VERBOSE ?=
PREFIX ?= /usr/local
SRCS = $(wildcard src/libinsane/*.c)
HEADERS = $(wildcard include/libinsane/*.h)
ifeq ($(UNAME), Linux)
CFLAGS=-O2 -D_FORTIFY_SOURCE=2
else
CFLAGS=
endif
all: build check test
build: build_c build_py
install: install_py install_c
uninstall: uninstall_py uninstall_c
build_py:
build/build.ninja:
mkdir -p build
echo "Uname: " $(UNAME)
echo "CFLAGS: " $(CFLAGS)
(cd build && CFLAGS="$(CFLAGS)" meson --werror --warnlevel 2 --prefix=${PREFIX} ..)
build_c: build/build.ninja
(cd build && ninja)
version:
doc: build/build.ninja
# Libinsane doc
(cd build && ninja subprojects/libinsane/doc/doc_out)
# Libinsane-gobject doc (Meson 0.37.1 || Meson 0.47.1)
(cd build ; ninja libinsane-gobject-doc || ninja libinsane-gobject@@libinsane-gobject-doc)
rm -rf doc/build
mkdir -p doc/build
mv build/doc/html doc/build/libinsane
mv build/subprojects/libinsane-gobject/doc/html doc/build/libinsane-gobject
cp doc/index.html doc/build
echo "Documentation is available in doc/build/"
check: build_c
! command -v sparse || python3 ./check_sparse.py build/compile_commands.json
# Debian / Ubuntu
(cd build ; ! command -v run-clang-tidy-4.0.py || ! (run-clang-tidy-4.0.py | grep warning 2>&1))
(cd build ; ! command -v run-clang-tidy-7 || ! (run-clang-tidy-7 | grep warning 2>&1))
# Fedora
(cd build ; [ ! -f /usr/share/clang/run-clang-tidy.py ] || ! (/usr/share/clang/run-clang-tidy.py | grep warning 2>&1))
test: build/build.ninja
(cd build && ninja test)
test_hw:
rm -rf test_hw_out
subprojects/libinsane-gobject/tests/test_hw.py test_hw_out
linux_exe:
windows_exe:
release:
ifeq (${RELEASE}, )
@echo "You must specify a release version ($(MAKE) release RELEASE=1.2.3)"
else
@echo "Will release: ${RELEASE}"
@echo "Checking release is in ChangeLog ..."
grep ${RELEASE} ChangeLog
@echo "Checking release is in meson.build ..."
grep ${RELEASE} meson.build
@echo "Checking release is in subprojects/libinsane/meson.build ..."
grep ${RELEASE} subprojects/libinsane/meson.build
@echo "Checking release is in subprojects/libinsane-gobject/meson.build ..."
grep ${RELEASE} subprojects/libinsane-gobject/meson.build
@echo "Releasing ..."
git tag -a ${RELEASE} -m ${RELEASE}
git push origin ${RELEASE}
@echo "All done"
endif
clean:
rm -rf build
rm -rf doc/build
rm -rf subprojects/libinsane-gobject/generated
mkdir -p subprojects/libinsane-gobject/generated
touch subprojects/libinsane-gobject/generated/.notempty
install_py:
install_c: build/build.ninja
(cd build && ninja install)
uninstall_py:
uninstall_c:
(cd build && ninja uninstall)
help:
@echo "make build || make build_c || make build_py"
@echo "make check"
@echo "make doc"
@echo "make help: display this message"
@echo "make install || make install_py"
@echo "make release"
@echo "make test"
@echo "make uninstall || make uninstall_py"
.PHONY: \
build \
build_c \
build_py \
check \
doc \
linux_exe \
windows_exe \
help \
install \
install_c \
install_py \
release \
test \
uninstall \
uninstall_c \
uninstall_py \
version
|