Makefile (1500B)
1 # cgol 2 # See LICENSE file for copyright and license details. 3 4 include config.mk 5 6 APPNAME=cgol 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.mk 23 24 ${APPNAME}: ${OBJ} 25 @echo CC -o $@ 26 @${CC} -o $@ ${OBJ} ${LDFLAGS} 27 28 clean: 29 @echo cleaning 30 @rm -f ${APPNAME} ${OBJ} ${APPNAME}-${VERSION}.tar.gz 31 32 dist: clean 33 @echo creating dist tarball 34 @mkdir -p ${APPNAME}-${VERSION} 35 @cp -R LICENSE Makefile README config.mk \ 36 ${APPNAME}.1 ${SRC} ${APPNAME}-${VERSION} 37 @tar -cf ${APPNAME}-${VERSION}.tar ${APPNAME}-${VERSION} 38 @gzip ${APPNAME}-${VERSION}.tar 39 @rm -rf ${APPNAME}-${VERSION} 40 41 install: all 42 @echo installing executable file to ${DESTDIR}${PREFIX}/bin 43 @mkdir -p ${DESTDIR}${PREFIX}/bin 44 @cp -f ${APPNAME} ${DESTDIR}${PREFIX}/bin 45 @chmod 755 ${DESTDIR}${PREFIX}/bin/${APPNAME} 46 @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 47 @mkdir -p ${DESTDIR}${MANPREFIX}/man1 48 @sed "s/VERSION/${VERSION}/g" < ${APPNAME}.1 > ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1 49 @chmod 644 ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1 50 51 uninstall: 52 @echo removing executable file from ${DESTDIR}${PREFIX}/bin 53 @rm -f ${DESTDIR}${PREFIX}/bin/${APPNAME} 54 @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 55 @rm -f ${DESTDIR}${MANPREFIX}/man1/${APPNAME}.1 56 57 .PHONY: all options clean dist install uninstall