Makefile (1611B)
1 # thinglaunch 2 # See LICENSE file for copyright and license details. 3 4 include config.mk 5 6 SRC = ${NAME}.c 7 8 OBJ = ${SRC:.c=.o} 9 10 all: options ${NAME} 11 12 options: 13 @echo ${NAME} build options: 14 @echo "CFLAGS = ${CFLAGS}" 15 @echo "LDFLAGS = ${LDFLAGS}" 16 @echo "CC = ${CC}" 17 18 config.h: 19 @echo creating $@ from config.def.h 20 @cp config.def.h $@ 21 22 .c.o: 23 @echo CC $< 24 @${CC} -c ${CFLAGS} $< 25 26 ${OBJ}: config.h config.mk 27 28 ${NAME}: ${OBJ} 29 @echo CC -o $@ 30 @${CC} -o $@ ${OBJ} ${LDFLAGS} 31 32 clean: 33 @echo cleaning 34 @rm -f ${NAME} ${OBJ} ${NAME}-${VERSION}.tar.gz 35 36 dist: clean 37 @echo creating dist tarball 38 @mkdir -p ${NAME}-${VERSION} 39 @cp -R LICENSE Makefile ${NAME}.1 config.mk \ 40 ${SRC} *.h ${NAME}-${VERSION} 41 @tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION} 42 @gzip ${NAME}-${VERSION}.tar 43 @rm -rf ${NAME}-${VERSION} 44 45 etc: 46 @echo installing etc files into ${DESTDIR}/etc/${NAME} 47 @mkdir -p ${DESTDIR}/etc/${NAME} 48 @cp -R etc/${NAME}/* ${DESTDIR}/etc/${NAME} 49 50 install: all 51 @echo installing executable file to ${DESTDIR}${PREFIX}/bin 52 @mkdir -p ${DESTDIR}${PREFIX}/bin 53 @cp -f ${NAME} ${DESTDIR}${PREFIX}/bin 54 @chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME} 55 @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 56 @mkdir -p ${DESTDIR}${MANPREFIX}/man1 57 @cp -f ${NAME}.1 ${DESTDIR}${MANPREFIX}/man1 58 @chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}.1 59 60 uninstall: 61 @echo removing executable file from ${DESTDIR}${PREFIX}/bin 62 @rm -f ${DESTDIR}${PREFIX}/bin/${NAME} 63 @echo removing manual page from ${DESTDIR}${PREFIX}/man1 64 @rm -f ${DESTDIR}${MANPREFIX}/man1/${NAME}.1 65 66 .PHONY: all options clean dist install uninstall