baum

view Makefile @ 37:29172b6e802a

switched to next version number, updated man page
author meillo@marmaro.de
date Sat, 01 Mar 2008 17:55:42 +0100
parents ed3eb4b497e5
children 0b82169d4129
line source
1 # baum by meillo@marmaro.de
4 NAME=baum
5 # extracts VERSION from the sources
6 VERSION=$(shell cat *.c | sed -n '/define VERSION/ s/.*"\([^"]*\)".*/\1/p' )
7 NV=${NAME}-${VERSION}
9 DOCS=LICENSE README ChangeLog TODO examples
11 # paths
12 PREFIX = /usr
13 BINDIR = ${PREFIX}/bin
14 MANDIR = ${PREFIX}/share/man
16 # compile env
17 CC = gcc
18 LD = ${CC}
19 DEBUG = -g
20 CFLAGS = -Wall -c ${DEBUG}
21 LDFLAGS = -Wall ${DEBUG}
23 # files
24 SRC=baum.c actions.c
25 OBJ=$(SRC:.c=.o)
26 DEP = baum.h actions.h
30 all: options build
32 options:
33 @echo build options:
34 @echo "CC = ${CC}"
35 @echo "LD = ${LD}"
36 @echo "CFLAGS = ${CFLAGS}"
37 @echo "LDFLAGS = ${LDFLAGS}"
38 @echo
40 build: options ${NAME}
42 ${NAME}: $(OBJ) ${DEP}
43 $(CC) $(LDFLAGS) $(OBJ) -o $@
45 ${OBJ}: ${DEP}
47 car: clean all
49 debug: all
50 gdb ${NAME}
52 strip: ${NAME}
53 @echo stripping ${NAME}
54 @strip ${NAME}
56 dist: build changelog
57 @echo "generating tarball"
58 @mkdir -p ${NV}
59 @cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
60 @tar -czhof ${NV}.tar.gz ${NV}
61 @rm -rf ${NV}
63 deb: dist
64 @mkdir -p Packages
65 @cp ${NV}.tar.gz Packages/
66 @( \
67 cd Packages/ ;\
68 tar -xzf ${NV}.tar.gz ;\
69 mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\
70 cd ${NV}/ ;\
71 cp -r ../../debian/ . ;\
72 debuild ;\
73 )
74 @rm -rf Packages/${NV}
76 changelog:
77 @echo generating changelog from mercurial log
78 @hg log -v --style changelog > ChangeLog
80 install: build strip
81 @echo installing executable file to ${DESTDIR}${BINDIR}
82 @mkdir -p ${DESTDIR}${BINDIR}
83 @cp ${NAME} ${DESTDIR}${BINDIR}
84 @chmod 755 ${DESTDIR}${BINDIR}/${NAME}
85 @echo installing manual page to ${DESTDIR}${MANDIR}/man1
86 @mkdir -p ${DESTDIR}${MANDIR}/man1
87 @sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1
88 @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
90 uninstall:
91 @echo removing executable file from ${DESTDIR}${BINDIR}
92 @rm -f ${DESTDIR}${BINDIR}/${NAME}
93 @echo removing manual page from ${DESTDIR}${MANDIR}/man1
94 @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
97 clean:
98 rm -f *.o
100 realclean: clean
101 rm -f ${NAME}
103 distclean: realclean
104 @rm -f ${NAME}-*.tar.gz ChangeLog
106 debclean: distclean
107 @cd Packages/${NV}/ ; debuild clean ;
110 .PHONY: all dist deb changelog clean distclean debclean build install uninstall