Makefile (1234B)
1 .POSIX: 2 3 NAME = sic 4 VERSION = 1.3 5 6 # paths 7 PREFIX = /usr/local 8 MANPREFIX = ${PREFIX}/share/man 9 10 # use system flags. 11 SIC_CFLAGS = ${CFLAGS} 12 SIC_LDFLAGS = ${LDFLAGS} 13 SIC_CPPFLAGS = ${LDFLAGS} -DVERSION=\"${VERSION}\" -D_GNU_SOURCE 14 15 BIN = sic 16 SRC = ${BIN:=.c} 17 OBJ = ${SRC:.c=.o} 18 MAN1 = ${BIN:=.1} 19 20 all: ${BIN} 21 22 ${BIN}: ${@:=.o} 23 24 ${OBJ}: config.h strlcpy.c util.c 25 26 .o: 27 ${CC} -o $@ $< ${SIC_LDFLAGS} 28 29 .c.o: 30 ${CC} -c ${SIC_CFLAGS} ${SIC_CPPFLAGS} -o $@ -c $< 31 32 config.h: 33 cp config.def.h $@ 34 35 clean: 36 rm -f ${BIN} ${OBJ} "${NAME}-${VERSION}.tar.gz" 37 38 dist: 39 mkdir -p "${NAME}-${VERSION}" 40 cp -fR LICENSE Makefile README arg.h config.def.h \ 41 ${MAN1} ${SRC} util.c strlcpy.c "${NAME}-${VERSION}" 42 tar -cf - "${NAME}-${VERSION}" | \ 43 gzip -c > "${NAME}-${VERSION}.tar.gz" 44 rm -rf "${NAME}-${VERSION}" 45 46 install: all 47 mkdir -p ${DESTDIR}${PREFIX}/bin 48 cp -f ${BIN} "${DESTDIR}${PREFIX}/bin" 49 chmod 755 "${DESTDIR}${PREFIX}/bin/${BIN}" 50 mkdir -p "${DESTDIR}${MANPREFIX}/man1" 51 sed "s/VERSION/${VERSION}/g" < ${MAN1} > "${DESTDIR}${MANPREFIX}/man1/${MAN1}" 52 chmod 644 "${DESTDIR}${MANPREFIX}/man1/${MAN1}" 53 54 uninstall: 55 rm -f \ 56 "${DESTDIR}${PREFIX}/bin/${BIN}"\ 57 "${DESTDIR}${MANPREFIX}/man1/${MAN1}" 58 59 .PHONY: all clean dist install uninstall