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