Makefile_C_CPP_STATIC_LIB.mk (1214B)
1 # See LICENSE file for copyright and license details. 2 # <++> 3 .POSIX: 4 5 include config.mk 6 7 LIB = <++> 8 DIST = ${LIB}-${VERSION} 9 MAN3 = ${LIB}.3 10 11 SRC = <++> 12 OBJ = ${SRC:.<++>=.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 .<++>.o: 28 ${CC} -c ${CFLAGS} $< 29 30 dist: clean 31 ${MKDIR} ${DIST} 32 ${CP} -R <++> ${DIST} 33 ${TAR} ${DIST}.tar ${DIST} 34 ${GZIP} ${DIST}.tar 35 ${RM_DIR} ${DIST} 36 37 install: all 38 ${MKDIR} ${DESTDIR}${LIB_DIR} ${DESTDIR}${INC_DIR} ${DESTDIR}${MAN_DIR} 39 ${CP} ${LIB}.h ${DESTDIR}${INC_DIR} 40 ${CP} lib${LIB}.a ${DESTDIR}${LIB_DIR} 41 ${CP} ${MAN3} ${DESTDIR}${MAN_DIR} 42 sed "s/VERSION/${VERSION}/g" < ${MAN3} > ${DESTDIR}${MAN_DIR}/${MAN3} 43 chmod 755 ${DESTDIR}${INC_DIR}/${LIB}.h 44 chmod 644 ${DESTDIR}${LIB_DIR}/lib${LIB}.a 45 chmod 644 ${DESTDIR}${MAN_DIR}/${MAN3} 46 47 uninstall: 48 ${RM} ${DESTDIR}${INC_DIR}/${LIB}.h 49 ${RM} ${DESTDIR}${LIB_DIR}/lib${LIB}.a 50 ${RM} ${DESTDIR}${MAN_DIR}/${MAN3} 51 52 clean: 53 ${RM} ${LIB} ${OBJ} lib${LIB}.a ${DIST}.tar.gz 54 55 .PHONY: all options clean dist install uninstall