baum
annotate Makefile @ 62:80df58d240b2
merge
author | meillo@marmaro.de |
---|---|
date | Thu, 13 Nov 2008 13:19:42 +0100 |
parents | c31b5bb6d493 |
children |
rev | line source |
---|---|
meillo@20 | 1 # baum by meillo@marmaro.de |
meillo@0 | 2 |
meillo@20 | 3 |
meillo@20 | 4 NAME=baum |
meillo@28 | 5 # extracts VERSION from the sources |
meillo@28 | 6 VERSION=$(shell cat *.c | sed -n '/define VERSION/ s/.*"\([^"]*\)".*/\1/p' ) |
meillo@20 | 7 NV=${NAME}-${VERSION} |
meillo@20 | 8 |
meillo@20 | 9 DOCS=LICENSE README ChangeLog TODO examples |
meillo@20 | 10 |
meillo@20 | 11 # paths |
meillo@58 | 12 PREFIX = /usr/local |
meillo@20 | 13 BINDIR = ${PREFIX}/bin |
meillo@20 | 14 MANDIR = ${PREFIX}/share/man |
meillo@0 | 15 |
meillo@0 | 16 # compile env |
meillo@0 | 17 CC = gcc |
meillo@0 | 18 LD = ${CC} |
meillo@0 | 19 DEBUG = -g |
meillo@0 | 20 CFLAGS = -Wall -c ${DEBUG} |
meillo@20 | 21 LDFLAGS = -Wall ${DEBUG} |
meillo@0 | 22 |
meillo@20 | 23 # files |
meillo@20 | 24 SRC=baum.c actions.c |
meillo@20 | 25 OBJ=$(SRC:.c=.o) |
meillo@47 | 26 DEP = baum.h |
meillo@0 | 27 |
meillo@20 | 28 |
meillo@58 | 29 .PHONY: all |
meillo@58 | 30 all: options $(NAME) |
meillo@20 | 31 |
meillo@58 | 32 .PHONY: options |
meillo@0 | 33 options: |
meillo@0 | 34 @echo build options: |
meillo@0 | 35 @echo "CC = ${CC}" |
meillo@0 | 36 @echo "LD = ${LD}" |
meillo@0 | 37 @echo "CFLAGS = ${CFLAGS}" |
meillo@20 | 38 @echo "LDFLAGS = ${LDFLAGS}" |
meillo@0 | 39 @echo |
meillo@0 | 40 |
meillo@20 | 41 |
meillo@20 | 42 ${NAME}: $(OBJ) ${DEP} |
meillo@20 | 43 $(CC) $(LDFLAGS) $(OBJ) -o $@ |
meillo@0 | 44 |
meillo@58 | 45 |
meillo@0 | 46 ${OBJ}: ${DEP} |
meillo@0 | 47 |
meillo@0 | 48 |
meillo@58 | 49 .PHONY: strip |
meillo@20 | 50 strip: ${NAME} |
meillo@20 | 51 @echo stripping ${NAME} |
meillo@20 | 52 @strip ${NAME} |
meillo@0 | 53 |
meillo@58 | 54 |
meillo@58 | 55 .PHONY: dist |
meillo@58 | 56 dist: all changelog |
meillo@20 | 57 @echo "generating tarball" |
meillo@20 | 58 @mkdir -p ${NV} |
meillo@29 | 59 @cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV} |
meillo@45 | 60 @fakeroot tar -czhof ${NV}.tar.gz ${NV} |
meillo@20 | 61 @rm -rf ${NV} |
meillo@20 | 62 |
meillo@20 | 63 |
meillo@58 | 64 .PHONY: changelog |
meillo@20 | 65 changelog: |
meillo@20 | 66 @echo generating changelog from mercurial log |
meillo@20 | 67 @hg log -v --style changelog > ChangeLog |
meillo@20 | 68 |
meillo@58 | 69 |
meillo@58 | 70 .PHONY: install |
meillo@58 | 71 install: all strip |
meillo@20 | 72 @echo installing executable file to ${DESTDIR}${BINDIR} |
meillo@20 | 73 @mkdir -p ${DESTDIR}${BINDIR} |
meillo@20 | 74 @cp ${NAME} ${DESTDIR}${BINDIR} |
meillo@20 | 75 @chmod 755 ${DESTDIR}${BINDIR}/${NAME} |
meillo@20 | 76 @echo installing manual page to ${DESTDIR}${MANDIR}/man1 |
meillo@20 | 77 @mkdir -p ${DESTDIR}${MANDIR}/man1 |
meillo@58 | 78 @cp ${NAME}.1 ${DESTDIR}${MANDIR}/man1 |
meillo@20 | 79 @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1 |
meillo@20 | 80 |
meillo@58 | 81 |
meillo@58 | 82 .PHONY: uninstall |
meillo@20 | 83 uninstall: |
meillo@20 | 84 @echo removing executable file from ${DESTDIR}${BINDIR} |
meillo@20 | 85 @rm -f ${DESTDIR}${BINDIR}/${NAME} |
meillo@20 | 86 @echo removing manual page from ${DESTDIR}${MANDIR}/man1 |
meillo@20 | 87 @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1 |
meillo@20 | 88 |
meillo@0 | 89 |
meillo@58 | 90 .PHONY: clean |
meillo@0 | 91 clean: |
meillo@20 | 92 rm -f *.o |
meillo@0 | 93 |
meillo@58 | 94 |
meillo@58 | 95 .PHONY: realclean |
meillo@20 | 96 realclean: clean |
meillo@58 | 97 rm -f ${NAME} ChangeLog |