meillo@20: # baum by meillo@marmaro.de meillo@0: meillo@20: meillo@20: NAME=baum meillo@28: # extracts VERSION from the sources meillo@28: VERSION=$(shell cat *.c | sed -n '/define VERSION/ s/.*"\([^"]*\)".*/\1/p' ) meillo@20: NV=${NAME}-${VERSION} meillo@20: meillo@20: DOCS=LICENSE README ChangeLog TODO examples meillo@20: meillo@20: # paths meillo@58: PREFIX = /usr/local meillo@20: BINDIR = ${PREFIX}/bin meillo@20: MANDIR = ${PREFIX}/share/man meillo@0: meillo@0: # compile env meillo@0: CC = gcc meillo@0: LD = ${CC} meillo@0: DEBUG = -g meillo@0: CFLAGS = -Wall -c ${DEBUG} meillo@20: LDFLAGS = -Wall ${DEBUG} meillo@0: meillo@20: # files meillo@20: SRC=baum.c actions.c meillo@20: OBJ=$(SRC:.c=.o) meillo@47: DEP = baum.h meillo@0: meillo@20: meillo@58: .PHONY: all meillo@58: all: options $(NAME) meillo@20: meillo@58: .PHONY: options meillo@0: options: meillo@0: @echo build options: meillo@0: @echo "CC = ${CC}" meillo@0: @echo "LD = ${LD}" meillo@0: @echo "CFLAGS = ${CFLAGS}" meillo@20: @echo "LDFLAGS = ${LDFLAGS}" meillo@0: @echo meillo@0: meillo@20: meillo@20: ${NAME}: $(OBJ) ${DEP} meillo@20: $(CC) $(LDFLAGS) $(OBJ) -o $@ meillo@0: meillo@58: meillo@0: ${OBJ}: ${DEP} meillo@0: meillo@0: meillo@58: .PHONY: strip meillo@20: strip: ${NAME} meillo@20: @echo stripping ${NAME} meillo@20: @strip ${NAME} meillo@0: meillo@58: meillo@58: .PHONY: dist meillo@58: dist: all changelog meillo@20: @echo "generating tarball" meillo@20: @mkdir -p ${NV} meillo@29: @cp -rf ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV} meillo@45: @fakeroot tar -czhof ${NV}.tar.gz ${NV} meillo@20: @rm -rf ${NV} meillo@20: meillo@20: meillo@58: .PHONY: changelog meillo@20: changelog: meillo@20: @echo generating changelog from mercurial log meillo@20: @hg log -v --style changelog > ChangeLog meillo@20: meillo@58: meillo@58: .PHONY: install meillo@58: install: all strip meillo@20: @echo installing executable file to ${DESTDIR}${BINDIR} meillo@20: @mkdir -p ${DESTDIR}${BINDIR} meillo@20: @cp ${NAME} ${DESTDIR}${BINDIR} meillo@20: @chmod 755 ${DESTDIR}${BINDIR}/${NAME} meillo@20: @echo installing manual page to ${DESTDIR}${MANDIR}/man1 meillo@20: @mkdir -p ${DESTDIR}${MANDIR}/man1 meillo@58: @cp ${NAME}.1 ${DESTDIR}${MANDIR}/man1 meillo@20: @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1 meillo@20: meillo@58: meillo@58: .PHONY: uninstall meillo@20: uninstall: meillo@20: @echo removing executable file from ${DESTDIR}${BINDIR} meillo@20: @rm -f ${DESTDIR}${BINDIR}/${NAME} meillo@20: @echo removing manual page from ${DESTDIR}${MANDIR}/man1 meillo@20: @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1 meillo@20: meillo@0: meillo@58: .PHONY: clean meillo@0: clean: meillo@20: rm -f *.o meillo@0: meillo@58: meillo@58: .PHONY: realclean meillo@20: realclean: clean meillo@58: rm -f ${NAME} ChangeLog