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@20: PREFIX = /usr 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@20: DEP = baum.h actions.h meillo@0: meillo@20: meillo@20: meillo@20: all: options build meillo@0: 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: build: ${NAME} meillo@20: meillo@20: ${NAME}: $(OBJ) ${DEP} meillo@20: $(CC) $(LDFLAGS) $(OBJ) -o $@ meillo@0: meillo@0: ${OBJ}: ${DEP} meillo@0: meillo@20: car: clean all meillo@0: meillo@0: debug: all meillo@20: gdb ${NAME} meillo@0: meillo@20: strip: ${NAME} meillo@20: @echo stripping ${NAME} meillo@20: @strip ${NAME} meillo@0: meillo@24: dist: build changelog strip meillo@20: @echo "generating tarball" meillo@20: @mkdir -p ${NV} meillo@21: @cp -rf ${NAME} ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV} meillo@20: @tar -czhof ${NV}.tar.gz ${NV} meillo@20: @rm -rf ${NV} meillo@20: meillo@20: deb: dist meillo@20: @mkdir -p Packages meillo@20: @cp ${NV}.tar.gz Packages/ meillo@20: @( \ meillo@20: cd Packages/ ;\ meillo@20: tar -xzf ${NV}.tar.gz ;\ meillo@20: mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\ meillo@20: cd ${NV}/ ;\ meillo@20: cp -r ../../debian/ . ;\ meillo@20: debuild ;\ meillo@20: ) meillo@20: @rm -rf Packages/${NV} meillo@20: meillo@20: changelog: meillo@20: @echo generating changelog from mercurial log meillo@20: @hg log -v --style changelog > ChangeLog meillo@20: meillo@24: install: build 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@20: @sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1 meillo@20: @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1 meillo@20: 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@0: clean: meillo@20: rm -f *.o meillo@0: meillo@20: realclean: clean meillo@20: rm -f ${NAME} meillo@20: meillo@20: distclean: realclean meillo@20: @rm -f ${NAME}-*.tar.gz ChangeLog meillo@20: meillo@20: debclean: distclean meillo@20: @cd Packages/${NV}/ ; debuild clean ; meillo@20: meillo@20: meillo@20: .PHONY: all dist deb changelog clean distclean debclean build install uninstall