Makefile (2365B)
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 # DEV can be set to 1 to enable debugging information. 15 # SANITIZE can be set to 1 to enable -fsanitize=address,undefined 16 17 # Can't be called "DEBUG" because that messes with the 18 # default variables on OpenBSD (${DEBUG} is appended to ${CFLAGS}, 19 # which messes everything up when ${DEBUG} is just set to 0 or 1). 20 DEV = 0 21 SANITIZE = 0 22 23 # Configuration options: 24 25 # comment to disable double buffering 26 DB_CFLAGS = `pkg-config --cflags xext` 27 DB_LDFLAGS = `pkg-config --libs xext` 28 # uncomment to disable double buffering 29 #DB_CFLAGS = -DNODB 30 #DB_LDFLAGS = 31 32 EXTRA_CFLAGS_DEV0 = 33 EXTRA_CFLAGS_DEV1 = -g 34 EXTRA_FLAGS_SANITIZE0 = 35 EXTRA_FLAGS_SANITIZE1 = -fsanitize=address,undefined 36 37 # Note: Older systems might need `imlib2-config --cflags` and `imlib2-config --libs` instead of pkg-config. 38 CROP_CFLAGS = ${CFLAGS} ${DB_CFLAGS} ${EXTRA_FLAGS_SANITIZE${SANITIZE}} ${EXTRA_CFLAGS_DEV${DEV}} -Wall -Wextra -pedantic -D_POSIX_C_SOURCE=200809L `pkg-config --cflags x11 imlib2` 39 CROP_LDFLAGS = ${LDFLAGS} ${DB_LDFLAGS} ${EXTRA_FLAGS_SANITIZE${SANITIZE}} `pkg-config --libs x11 imlib2` -lm 40 41 all: ${BIN} 42 43 croptool: croptool.c common.c common.h 44 ${CC} -o $@ croptool.c common.c ${CROP_CFLAGS} ${CROP_LDFLAGS} 45 46 selectool: selectool.c common.c common.h 47 ${CC} -o $@ selectool.c common.c ${CROP_CFLAGS} ${CROP_LDFLAGS} 48 49 croptool_crop: croptool_crop.c 50 ${CC} -o $@ croptool_crop.c ${CROP_CFLAGS} ${CROP_LDFLAGS} 51 52 install: all 53 mkdir -p "${DESTDIR}${PREFIX}/bin" 54 cp -f ${BIN} "${DESTDIR}${PREFIX}/bin" 55 for f in ${BIN}; do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done 56 mkdir -p "${DESTDIR}${MANPREFIX}/man1" 57 cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1" 58 for m in ${MAN1}; do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done 59 60 uninstall: 61 for f in ${BIN}; do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done 62 for m in ${MAN1}; do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done 63 64 clean: 65 rm -f ${BIN} 66 67 dist: 68 rm -rf "${NAME}-${VERSION}" 69 mkdir -p "${NAME}-${VERSION}" 70 cp -f ${MAN1} ${SRC} ${MISCFILES} "${NAME}-${VERSION}" 71 tar cf - "${NAME}-${VERSION}" | gzip -c > "${NAME}-${VERSION}.tar.gz" 72 rm -rf "${NAME}-${VERSION}" 73 74 .PHONY: all clean install uninstall dist