baum

view Makefile @ 62:80df58d240b2

merge
author meillo@marmaro.de
date Thu, 13 Nov 2008 13:19:42 +0100
parents c31b5bb6d493
children
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/local
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
29 .PHONY: all
30 all: options $(NAME)
32 .PHONY: options
33 options:
34 @echo build options:
35 @echo "CC = ${CC}"
36 @echo "LD = ${LD}"
37 @echo "CFLAGS = ${CFLAGS}"
38 @echo "LDFLAGS = ${LDFLAGS}"
39 @echo
42 ${NAME}: $(OBJ) ${DEP}
43 $(CC) $(LDFLAGS) $(OBJ) -o $@
46 ${OBJ}: ${DEP}
49 .PHONY: strip
50 strip: ${NAME}
51 @echo stripping ${NAME}
52 @strip ${NAME}
55 .PHONY: dist
56 dist: all changelog
57 @echo "generating tarball"
58 @mkdir -p ${NV}
59 @cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
60 @fakeroot tar -czhof ${NV}.tar.gz ${NV}
61 @rm -rf ${NV}
64 .PHONY: changelog
65 changelog:
66 @echo generating changelog from mercurial log
67 @hg log -v --style changelog > ChangeLog
70 .PHONY: install
71 install: all strip
72 @echo installing executable file to ${DESTDIR}${BINDIR}
73 @mkdir -p ${DESTDIR}${BINDIR}
74 @cp ${NAME} ${DESTDIR}${BINDIR}
75 @chmod 755 ${DESTDIR}${BINDIR}/${NAME}
76 @echo installing manual page to ${DESTDIR}${MANDIR}/man1
77 @mkdir -p ${DESTDIR}${MANDIR}/man1
78 @cp ${NAME}.1 ${DESTDIR}${MANDIR}/man1
79 @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
82 .PHONY: uninstall
83 uninstall:
84 @echo removing executable file from ${DESTDIR}${BINDIR}
85 @rm -f ${DESTDIR}${BINDIR}/${NAME}
86 @echo removing manual page from ${DESTDIR}${MANDIR}/man1
87 @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
90 .PHONY: clean
91 clean:
92 rm -f *.o
95 .PHONY: realclean
96 realclean: clean
97 rm -f ${NAME} ChangeLog