Makefile (2064B)
1 .POSIX: 2 3 NAME = croptool 4 VERSION = 1.3.0-dev 5 6 PREFIX = /usr/local 7 MANPREFIX = ${PREFIX}/man 8 9 BIN = ${NAME} croptool_crop selectool 10 SRC = ${BIN:=.c} 11 MAN1 = ${BIN:=.1} 12 MISCFILES = Makefile README CHANGELOG LICENSE TODO common.c common.h 13 14 DEBUG = 0 15 SANITIZE = 0 16 17 # Configuration options: 18 19 # comment to disable double buffering 20 DB_CFLAGS = `pkg-config --cflags xext` 21 DB_LDFLAGS = `pkg-config --libs xext` 22 # uncomment to disable double buffering 23 #DB_CFLAGS = -DNODB 24 #DB_LDFLAGS = 25 26 EXTRA_CFLAGS_DEBUG0 = 27 EXTRA_CFLAGS_DEBUG1 = -g 28 EXTRA_FLAGS_SANITIZE0 = 29 EXTRA_FLAGS_SANITIZE1 = -fsanitize=address,undefined 30 31 # Note: Older systems might need `imlib2-config --cflags` and `imlib2-config --libs` instead of pkg-config. 32 CROP_CFLAGS = ${CFLAGS} ${DB_CFLAGS} ${EXTRA_FLAGS_SANITIZE${SANITIZE}} ${EXTRA_CFLAGS_DEBUG${DEBUG}} -Wall -Wextra -pedantic -D_POSIX_C_SOURCE=200809L `pkg-config --cflags x11 imlib2` 33 CROP_LDFLAGS = ${LDFLAGS} ${DB_LDFLAGS} ${EXTRA_FLAGS_SANITIZE${SANITIZE}} `pkg-config --libs x11 imlib2` -lm 34 35 all: ${BIN} 36 37 croptool: croptool.c common.c common.h 38 ${CC} -o $@ croptool.c common.c ${CROP_CFLAGS} ${CROP_LDFLAGS} 39 40 selectool: selectool.c common.c common.h 41 ${CC} -o $@ selectool.c common.c ${CROP_CFLAGS} ${CROP_LDFLAGS} 42 43 croptool_crop: croptool_crop.c 44 ${CC} -o $@ croptool_crop.c ${CROP_CFLAGS} ${CROP_LDFLAGS} 45 46 install: all 47 mkdir -p "${DESTDIR}${PREFIX}/bin" 48 cp -f ${BIN} "${DESTDIR}${PREFIX}/bin" 49 for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done 50 mkdir -p "${DESTDIR}${MANPREFIX}/man1" 51 cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" 52 for m in ${MAN1}; do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done 53 54 uninstall: 55 for f in ${BIN}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done 56 for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done 57 58 clean: 59 rm -f ${BIN} 60 61 dist: 62 rm -rf "${NAME}-${VERSION}" 63 mkdir -p "${NAME}-${VERSION}" 64 cp -f ${MAN1} ${SRC} ${MISCFILES} "${NAME}-${VERSION}" 65 tar cf - "${NAME}-${VERSION}" | gzip -c > "${NAME}-${VERSION}.tar.gz" 66 rm -rf "${NAME}-${VERSION}" 67 68 .PHONY: all clean install uninstall dist