Makefile (1345B)
1 # See LICENSE file for copyright and license details. 2 # cstring - lightweight string library for C 3 .POSIX: 4 5 include config.mk 6 7 LIB = cstring 8 DIST = ${LIB}-${VERSION} 9 MAN3 = ${LIB}.3 10 11 SRC = cstring.c 12 OBJ = ${SRC:.c=.o} 13 14 all: options ${LIB} 15 16 options: 17 @echo ${LIB} build options: 18 @echo "CFLAGS = ${CFLAGS}" 19 @echo "LDFLAGS = ${LDFLAGS}" 20 @echo "ARFLAGS = ${ARFLAGS}" 21 @echo "CC = ${CC}" 22 @echo "AR = ${AR}" 23 24 ${LIB}: ${OBJ} 25 ${AR} ${ARFLAGS} lib${LIB}.a ${OBJ} 26 27 .c.o: 28 ${CC} -c ${CFLAGS} $< 29 30 dist: clean 31 mkdir -p ${DIST} 32 cp -R tests config.mk cstring.3 cstring.c cstring.h LICENSE Makefile \ 33 README ${DIST} 34 tar -cf ${DIST}.tar ${DIST} 35 gzip ${DIST}.tar 36 rm -rf ${DIST} 37 38 install: all 39 mkdir -p ${DESTDIR}${LIBDIR} ${DESTDIR}${INCDIR} ${DESTDIR}${MANPREFIX}/man3 40 cp -f ${LIB}.h ${DESTDIR}${INCDIR} 41 cp -f lib${LIB}.a ${DESTDIR}${LIBDIR} 42 cp -f ${MAN3} ${DESTDIR}${MANPREFIX}/man3 43 sed "s/VERSION/${VERSION}/g" < ${MAN3} > ${DESTDIR}${MANPREFIX}/man3/${MAN3} 44 chmod 755 ${DESTDIR}${INC_DIR}/${LIB}.h 45 chmod 644 ${DESTDIR}${LIB_DIR}/lib${LIB}.a 46 chmod 644 ${DESTDIR}${MANPREFIX}/man3/${MAN3} 47 48 uninstall: 49 rm -f ${DESTDIR}${INCDIR}/${LIB}.h \ 50 ${DESTDIR}${LIBDIR}/lib${LIB}.a \ 51 ${DESTDIR}${MANPREFIX}/man3/${MAN3} 52 53 clean: 54 rm -f ${LIB} ${OBJ} lib${LIB}.a ${DIST}.tar.gz *.core 55 56 .PHONY: all options clean dist install uninstall