Makefile (1063B)
1 # See LICENSE file for copyright and license details. 2 3 include config.mk 4 5 SRC = ${NAME}.c 6 OBJ = ${SRC:.c=.o} 7 8 all: options ${NAME} 9 10 options: 11 @echo ${NAME} build options: 12 @echo "CFLAGS = ${CFLAGS}" 13 @echo "LDFLAGS = ${LDFLAGS}" 14 @echo "CC = ${CC}" 15 16 .c.o: 17 @echo CC $< 18 @${CC} -c ${CFLAGS} $< 19 20 ${OBJ}: config.mk 21 22 ${NAME}: ${OBJ} 23 @echo CC -o $@ 24 @${CC} -o $@ ${OBJ} ${LDFLAGS} 25 26 clean: 27 @echo cleaning 28 @rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz 29 30 dist: clean 31 @echo creating dist tarball 32 @mkdir -p ${NAME}-${VERSION} 33 @cp -R Makefile config.mk LICENSE \ 34 ${SRC} ${NAME}-${VERSION} 35 @tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} 36 @gzip ${NAME}-${VERSION}.tar 37 @rm -rf ${NAME}-${VERSION} 38 39 install: all 40 @echo installing executable file to ${DESTDIR}${PREFIX}/bin 41 @mkdir -p ${DESTDIR}${PREFIX}/bin 42 @cp -f ${NAME} ${DESTDIR}${PREFIX}/bin 43 @chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME} 44 45 uninstall: 46 @echo removing executable file from ${DESTDIR}${PREFIX}/bin 47 @rm -f ${DESTDIR}${PREFIX}/bin/${NAME} 48 49 .PHONY: all options clean dist install uninstall