catpoint/Makefile
Hiltjo Posthuma a6db1af027 Makefile: improvements
- Rewrite the Makefile.
  - Remove config.mk
  - Be verbose.
  - Separate CFLAGS, CPPFLAGS and LDFLAGS and respect system compiler flags.
  - Remove default POSIX flags such as ${CC}.
  - make dist: add missing files.
  - make dist: pipe directly to stdin instead of making a tar file.
  - Generalize the name and use ${NAME},${BIN} and ${MAN1} variables.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2020-12-20 16:06:58 +01:00

70 lines
1.4 KiB
Makefile

# catpoint - simple presentation software
# See LICENSE file for copyright and license details.
.POSIX:
NAME = catpoint
VERSION = 1.0
# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
# use system flags.
CATPOINT_CFLAGS = ${CFLAGS}
CATPOINT_CPPFLAGS = ${CPPFLAGS}
CATPOINT_LDFLAGS = ${LDFLAGS} -lncursesw
# Gentoo
#CATPOINT_LDFLAGS = ${LDFLAGS} -lncursesw -ltinfow
SRC = ${NAME}.c
MAN1 = ${NAME}.1
BIN = ${NAME}
OBJ = ${SRC:.c=.o}
all: catpoint
options:
@echo ${NAME} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
config.h:
cp config.def.h config.h
.c.o:
${CC} -c ${CATPOINT_CFLAGS} ${CATPOINT_CPPFLAGS} $<
${OBJ}:
catpoint: ${OBJ}
${CC} -o $@ ${OBJ} ${CATPOINT_LDFLAGS}
clean:
rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz
dist:
mkdir -p ${NAME}-${VERSION}
cp -R LICENSE Makefile README.md TOOLS ${SRC} \
${MAN1} showoff ${NAME}-${VERSION}
tar -cf - "${NAME}-${VERSION}" | \
gzip -c > ${NAME}-${VERSION}.tar.gz
rm -rf ${NAME}-${VERSION}
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/${BIN}
mkdir -p ${DESTDIR}${MANPREFIX}/man1
cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1/${MAN1}
chmod 644 ${DESTDIR}${MANPREFIX}/man1/${MAN1}
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/${BIN}
rm -f ${DESTDIR}${MANPREFIX}/man1/${MAN1}
.PHONY: all options clean dist install uninstall