baum

view Makefile @ 24:69a7cf2f0c06

make dist includes now a stripped executable (should we include the exe at all?)
author meillo@marmaro.de
date Wed, 13 Feb 2008 22:04:12 +0100
parents ca56c1b3fb67
children ed3eb4b497e5
line source
1 # baum by meillo@marmaro.de
4 NAME=baum
5 VERSION = 0.1
6 NV=${NAME}-${VERSION}
8 DOCS=LICENSE README ChangeLog TODO examples
10 # paths
11 PREFIX = /usr
12 BINDIR = ${PREFIX}/bin
13 MANDIR = ${PREFIX}/share/man
15 # compile env
16 CC = gcc
17 LD = ${CC}
18 DEBUG = -g
19 CFLAGS = -Wall -c ${DEBUG}
20 LDFLAGS = -Wall ${DEBUG}
22 # files
23 SRC=baum.c actions.c
24 OBJ=$(SRC:.c=.o)
25 DEP = baum.h actions.h
29 all: options build
31 options:
32 @echo build options:
33 @echo "CC = ${CC}"
34 @echo "LD = ${LD}"
35 @echo "CFLAGS = ${CFLAGS}"
36 @echo "LDFLAGS = ${LDFLAGS}"
37 @echo
39 build: ${NAME}
41 ${NAME}: $(OBJ) ${DEP}
42 $(CC) $(LDFLAGS) $(OBJ) -o $@
44 ${OBJ}: ${DEP}
46 car: clean all
48 debug: all
49 gdb ${NAME}
51 strip: ${NAME}
52 @echo stripping ${NAME}
53 @strip ${NAME}
55 dist: build changelog strip
56 @echo "generating tarball"
57 @mkdir -p ${NV}
58 @cp -rf ${NAME} ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
59 @tar -czhof ${NV}.tar.gz ${NV}
60 @rm -rf ${NV}
62 deb: dist
63 @mkdir -p Packages
64 @cp ${NV}.tar.gz Packages/
65 @( \
66 cd Packages/ ;\
67 tar -xzf ${NV}.tar.gz ;\
68 mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\
69 cd ${NV}/ ;\
70 cp -r ../../debian/ . ;\
71 debuild ;\
72 )
73 @rm -rf Packages/${NV}
75 changelog:
76 @echo generating changelog from mercurial log
77 @hg log -v --style changelog > ChangeLog
79 install: build strip
80 @echo installing executable file to ${DESTDIR}${BINDIR}
81 @mkdir -p ${DESTDIR}${BINDIR}
82 @cp ${NAME} ${DESTDIR}${BINDIR}
83 @chmod 755 ${DESTDIR}${BINDIR}/${NAME}
84 @echo installing manual page to ${DESTDIR}${MANDIR}/man1
85 @mkdir -p ${DESTDIR}${MANDIR}/man1
86 @sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1
87 @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
89 uninstall:
90 @echo removing executable file from ${DESTDIR}${BINDIR}
91 @rm -f ${DESTDIR}${BINDIR}/${NAME}
92 @echo removing manual page from ${DESTDIR}${MANDIR}/man1
93 @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
96 clean:
97 rm -f *.o
99 realclean: clean
100 rm -f ${NAME}
102 distclean: realclean
103 @rm -f ${NAME}-*.tar.gz ChangeLog
105 debclean: distclean
106 @cd Packages/${NV}/ ; debuild clean ;
109 .PHONY: all dist deb changelog clean distclean debclean build install uninstall