[hackers] [farbfeld] Makefile improvements || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sun, 3 Apr 2016 22:07:59 +0200 (CEST)

commit 47a5f38ce9d44b5c3c0dad9e7824c8e2156a203d
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Sun Apr 3 21:44:20 2016 +0200
Commit: FRIGN <dev_AT_frign.de>
CommitDate: Sun Apr 3 22:07:12 2016 +0200

    Makefile improvements
    
    - be verbose by default: don't hide the executed commands.
    - no need to make clean on make dist, but make sure to have a clean directory.
    - define 2ff in ${SCRIPTS}.
    - make dist: gzip directly, don't store intermediate step (faster for make dist
      on floppies).
    - don't cd into directories, just loop each file.

diff --git a/Makefile b/Makefile
index 865e87b..c108e25 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -3,6 +3,7 @@
 include config.mk
 
 BIN = png2ff ff2png jpg2ff ff2jpg ff2ppm
+SCRIPTS = 2ff
 SRC = ${BIN:=.c}
 HDR = arg.h
 MAN1 = 2ff.1 ${BIN:=.1}
_AT_@ -11,49 +12,42 @@ MAN5 = farbfeld.5
 all: ${BIN}
 
 png2ff ff2png:
- _AT_echo CC $@
- _AT_${CC} -o $@ ${CFLAGS} ${CPPFLAGS} -L${PNGLIB} -lpng -I${PNGINC} \
+ ${CC} -o $_AT_ ${CFLAGS} ${CPPFLAGS} -L${PNGLIB} -lpng -I${PNGINC} \
                 ${LDFLAGS} $_AT_.c
 
 jpg2ff ff2jpg:
- _AT_echo CC $@
- _AT_${CC} -o $@ ${CFLAGS} ${CPPFLAGS} -L${JPGLIB} -ljpeg -I${JPGINC} \
+ ${CC} -o $_AT_ ${CFLAGS} ${CPPFLAGS} -L${JPGLIB} -ljpeg -I${JPGINC} \
                 ${LDFLAGS} $_AT_.c
 
 .c:
- _AT_echo CC $@
- _AT_${CC} -o $@ ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $<
+ ${CC} -o $_AT_ ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $<
 
 clean:
- _AT_echo cleaning
- _AT_rm -f ${BIN}
-
-dist: clean
- _AT_echo creating dist tarball
- _AT_mkdir -p farbfeld-${VERSION}
- _AT_cp -R FORMAT LICENSE Makefile README TODO config.mk \
- 2ff ${HDR} ${SRC} ${MAN1} ${MAN5} farbfeld-${VERSION}
- _AT_tar -cf farbfeld-${VERSION}.tar farbfeld-${VERSION}
- _AT_gzip farbfeld-${VERSION}.tar
- _AT_rm -rf farbfeld-${VERSION}
+ rm -f ${BIN}
+
+dist:
+ rm -rf "farbfeld-${VERSION}"
+ mkdir -p "farbfeld-${VERSION}"
+ cp -R FORMAT LICENSE Makefile README TODO config.mk \
+ ${SCRIPTS} ${HDR} ${SRC} ${MAN1} ${MAN5} "farbfeld-${VERSION}"
+ tar -cf - "farbfeld-${VERSION}" | \
+ gzip -c > "farbfeld-${VERSION}.tar.gz"
+ rm -rf "farbfeld-${VERSION}"
 
 install: all
- _AT_echo installing into ${DESTDIR}${PREFIX}/bin
- _AT_mkdir -p "${DESTDIR}${PREFIX}/bin"
- _AT_cp -f 2ff ${BIN} "${DESTDIR}${PREFIX}/bin"
- _AT_echo installing manpages into ${DESTDIR}${MANPREFIX}
- _AT_mkdir -p "${DESTDIR}${MANPREFIX}/man1"
- _AT_cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1"
- _AT_cd "${DESTDIR}${MANPREFIX}/man1" && chmod 644 ${MAN1}
- _AT_mkdir -p "${DESTDIR}${MANPREFIX}/man5"
- _AT_cp -f ${MAN5} "${DESTDIR}${MANPREFIX}/man5"
- _AT_cd "${DESTDIR}${MANPREFIX}/man5" && chmod 644 ${MAN5}
+ mkdir -p "${DESTDIR}${PREFIX}/bin"
+ cp -f ${SCRIPTS} ${BIN} "${DESTDIR}${PREFIX}/bin"
+ for f in $(BIN) $(SCRIPTS); do chmod 755 "${DESTDIR}${PREFIX}/bin/$$f"; done
+ mkdir -p "${DESTDIR}${MANPREFIX}/man1"
+ cp -f ${MAN1} "${DESTDIR}${MANPREFIX}/man1"
+ for m in $(MAN1); do chmod 644 "${DESTDIR}${MANPREFIX}/man1/$$m"; done
+ mkdir -p "${DESTDIR}${MANPREFIX}/man5"
+ cp -f ${MAN5} "${DESTDIR}${MANPREFIX}/man5"
+ for m in $(MAN5); do chmod 644 "${DESTDIR}${MANPREFIX}/man5/$$m"; done
 
 uninstall:
- _AT_echo removing from ${DESTDIR}${PREFIX}/bin
- _AT_cd "${DESTDIR}${PREFIX}/bin" && rm -f 2ff ${BIN}
- _AT_echo removing manpages from ${DESTDIR}${MANPREFIX}
- _AT_cd "${DESTDIR}${MANPREFIX}/man1" && rm -f ${MAN1}
- _AT_cd "${DESTDIR}${MANPREFIX}/man5" && rm -f ${MAN5}
+ for f in $(BIN) $(SCRIPTS); do rm -f "${DESTDIR}${PREFIX}/bin/$$f"; done
+ for m in $(MAN1); do rm -f "${DESTDIR}${MANPREFIX}/man1/$$m"; done
+ for m in $(MAN5); do rm -f "${DESTDIR}${MANPREFIX}/man5/$$m"; done
 
 .PHONY: all clean dist install uninstall
Received on Sun Apr 03 2016 - 22:07:59 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 03 2016 - 22:12:16 CEST