baum
annotate Makefile @ 29:88a51653db83
removed binary from dist tarball; new debian package
author | meillo@marmaro.de |
---|---|
date | Fri, 22 Feb 2008 13:55:57 +0100 |
parents | ed3eb4b497e5 |
children | 0b82169d4129 |
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@20 | 12 PREFIX = /usr |
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@20 | 26 DEP = baum.h actions.h |
meillo@0 | 27 |
meillo@20 | 28 |
meillo@20 | 29 |
meillo@20 | 30 all: options build |
meillo@0 | 31 |
meillo@0 | 32 options: |
meillo@0 | 33 @echo build options: |
meillo@0 | 34 @echo "CC = ${CC}" |
meillo@0 | 35 @echo "LD = ${LD}" |
meillo@0 | 36 @echo "CFLAGS = ${CFLAGS}" |
meillo@20 | 37 @echo "LDFLAGS = ${LDFLAGS}" |
meillo@0 | 38 @echo |
meillo@0 | 39 |
meillo@29 | 40 build: options ${NAME} |
meillo@20 | 41 |
meillo@20 | 42 ${NAME}: $(OBJ) ${DEP} |
meillo@20 | 43 $(CC) $(LDFLAGS) $(OBJ) -o $@ |
meillo@0 | 44 |
meillo@0 | 45 ${OBJ}: ${DEP} |
meillo@0 | 46 |
meillo@20 | 47 car: clean all |
meillo@0 | 48 |
meillo@0 | 49 debug: all |
meillo@20 | 50 gdb ${NAME} |
meillo@0 | 51 |
meillo@20 | 52 strip: ${NAME} |
meillo@20 | 53 @echo stripping ${NAME} |
meillo@20 | 54 @strip ${NAME} |
meillo@0 | 55 |
meillo@29 | 56 dist: build 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@20 | 60 @tar -czhof ${NV}.tar.gz ${NV} |
meillo@20 | 61 @rm -rf ${NV} |
meillo@20 | 62 |
meillo@20 | 63 deb: dist |
meillo@20 | 64 @mkdir -p Packages |
meillo@20 | 65 @cp ${NV}.tar.gz Packages/ |
meillo@20 | 66 @( \ |
meillo@20 | 67 cd Packages/ ;\ |
meillo@20 | 68 tar -xzf ${NV}.tar.gz ;\ |
meillo@20 | 69 mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\ |
meillo@20 | 70 cd ${NV}/ ;\ |
meillo@20 | 71 cp -r ../../debian/ . ;\ |
meillo@20 | 72 debuild ;\ |
meillo@20 | 73 ) |
meillo@20 | 74 @rm -rf Packages/${NV} |
meillo@20 | 75 |
meillo@20 | 76 changelog: |
meillo@20 | 77 @echo generating changelog from mercurial log |
meillo@20 | 78 @hg log -v --style changelog > ChangeLog |
meillo@20 | 79 |
meillo@24 | 80 install: build strip |
meillo@20 | 81 @echo installing executable file to ${DESTDIR}${BINDIR} |
meillo@20 | 82 @mkdir -p ${DESTDIR}${BINDIR} |
meillo@20 | 83 @cp ${NAME} ${DESTDIR}${BINDIR} |
meillo@20 | 84 @chmod 755 ${DESTDIR}${BINDIR}/${NAME} |
meillo@20 | 85 @echo installing manual page to ${DESTDIR}${MANDIR}/man1 |
meillo@20 | 86 @mkdir -p ${DESTDIR}${MANDIR}/man1 |
meillo@20 | 87 @sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1 |
meillo@20 | 88 @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1 |
meillo@20 | 89 |
meillo@20 | 90 uninstall: |
meillo@20 | 91 @echo removing executable file from ${DESTDIR}${BINDIR} |
meillo@20 | 92 @rm -f ${DESTDIR}${BINDIR}/${NAME} |
meillo@20 | 93 @echo removing manual page from ${DESTDIR}${MANDIR}/man1 |
meillo@20 | 94 @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1 |
meillo@20 | 95 |
meillo@0 | 96 |
meillo@0 | 97 clean: |
meillo@20 | 98 rm -f *.o |
meillo@0 | 99 |
meillo@20 | 100 realclean: clean |
meillo@20 | 101 rm -f ${NAME} |
meillo@20 | 102 |
meillo@20 | 103 distclean: realclean |
meillo@20 | 104 @rm -f ${NAME}-*.tar.gz ChangeLog |
meillo@20 | 105 |
meillo@20 | 106 debclean: distclean |
meillo@20 | 107 @cd Packages/${NV}/ ; debuild clean ; |
meillo@20 | 108 |
meillo@20 | 109 |
meillo@20 | 110 .PHONY: all dist deb changelog clean distclean debclean build install uninstall |