Make the makefile bitreich compliant. - hurl - Gopher/HTTP/HTTPS file grabber (HTM) git clone git://git.codemadness.org/hurl (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit cf1cb9bbf57c7721b94100585fa1ae7fbe113164 (DIR) parent 507bbf24b497940404172a65808a0da45df54a55 (HTM) Author: Christoph Lohmann <20h@r-36.net> Date: Mon, 12 Nov 2018 20:25:19 +0100 Make the makefile bitreich compliant. Diffstat: M Makefile | 71 +++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) --- (DIR) diff --git a/Makefile b/Makefile @@ -1,5 +1,70 @@ -build: clean - cc -o hurl hurl.c -ltls ${CFLAGS} ${LDFLAGS} +# hurl – a tiny client for various protocols +# See LICENSE file for copyright and licence details. +.POSIX: + +NAME = hurl +VERSION = 0.01 + +PREFIX = /usr/local +BINDIR = ${PREFIX}/bin +MANDIR = ${PREFIX}/share/man/man1 + +CFLAGS = -O2 -Wall +HURL_CFLAGS = -I. -I/usr/include ${CFLAGS} +HURL_LDFLAGS = -L/usr/lib -L. ${LDFLAGS} + +SRC = hurl.c +OBJ = ${SRC:.c=.o} + +all: options ${NAME} + +options: + @echo ${NAME} build options: + @echo "CFLAGS = ${HURL_CFLAGS}" + @echo "LDFLAGS = ${HURL_LDFLAGS}" + @echo "CC = ${CC}" + +.c.o: + @echo CC $< + @${CC} ${HURL_CFLAGS} -c $< + +${OBJ}: + +${NAME}: ${OBJ} + @echo CC -o $@ + @${CC} -o $@ ${OBJ} ${HURL_LDFLAGS} clean: - rm -f hurl *.o + @echo cleaning + @rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz + +install: all + @echo installing executable to ${DESTDIR}${BINDIR} + @mkdir -p "${DESTDIR}${BINDIR}" + @cp -f ${NAME} "${DESTDIR}${BINDIR}" + @chmod 755 "${DESTDIR}${BINDIR}/${NAME}" +# For later manpage. +# @echo installing manpage to "${DESTDIR}${MANDIR}" +# @mkdir -p "${DESTDIR}${MANDIR}" +# @cp -f ${NAME}.1 "${DESTDIR}${MANDIR}" +# @chmod 644 "${DESTDIR}${MANDIR}/${NAME}.1" + +uninstall: + @echo removing executable file from ${DESTDIR}${BINDIR} + @rm -f "${DESTDIR}${BINDIR}/${NAME}" +# @echo removing manpage from "${DESTDIR}${MANDIR}" +# @rm -f "${DESTDIR}${MANDIR}/${NAME}.1" + +dist: clean + @echo creating dist tarball + @mkdir -p ${NAME}-${VERSION} +# @cp -R README LICENSE Makefile ${NAME}.1 \ +# *.c *.h ${NAME}-${VERSION} + @cp -R README LICENSE Makefile \ + *.c *.h ${NAME}-${VERSION} + @tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} + @gzip ${NAME}-${VERSION}.tar + @mv ${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION}.tgz + @rm -rf "${NAME}-${VERSION}" + +.PHONY: all options clean dist install uninstall