mk

Makefile templates
git clone git://git.christosmarg.xyz
Log | Files | Refs | README | LICENSE

Makefile_SCRIPT.mk (913B)


      1 # See LICENSE file for copyright and license details.
      2 # <++>
      3 .POSIX:
      4 
      5 # maybe move to config.mk
      6 
      7 BIN = <++>
      8 VERSION = <++>
      9 DIST = ${BIN}-${VERSION}
     10 MAN1 = ${BIN}.1
     11 PREFIX = /usr/local
     12 MAN_DIR = ${PREFIX}/share/man/man1
     13 BIN_DIR = ${PREFIX}/bin
     14 
     15 CP = cp -f
     16 RM = rm -f
     17 RM_DIR = rm -rf
     18 MKDIR = mkdir -p
     19 TAR = tar -cf
     20 GZIP = gzip
     21 
     22 all: ${BIN}
     23 	chmod +x ${BIN}
     24 
     25 dist:
     26 	${MKDIR} ${DIST}
     27 	${CP} -R <++> ${DIST}
     28 	${TAR} ${DIST}.tar ${DIST}
     29 	${GZIP} ${DIST}.tar
     30 	${RM_DIR} ${DIST}
     31 
     32 install: all
     33 	${MKDIR} ${DESTDIR}${BIN_DIR} ${DESTDIR}${MAN_DIR}
     34 	${CP} ${BIN} ${DESTDIR}${BIN_DIR}
     35 	${CP} ${MAN1} ${DESTDIR}${MAN_DIR}
     36 	sed "s/VERSION/${VERSION}/g" < ${MAN1} > ${DESTDIR}${MAN_DIR}/${MAN1}
     37 	chmod 755 ${DESTDIR}${BIN_DIR}/${BIN}
     38 	chmod 644 ${DESTDIR}${MAN_DIR}/${MAN1}
     39 
     40 uninstall:
     41 	${RM} ${DESTDIR}${BIN_DIR}/${BIN}
     42 	${RM} ${DESTDIR}${MAN_DIR}/${MAN1}
     43 
     44 clean:
     45 	${RM} ${DIST}.tar.gz
     46 
     47 .PHONY: all clean dist install uninstall