bday

diff Makefile @ 3:dc2f94280b01

new Makefile; removed MinWarn and MaxWarn; adjusted manpage
author meillo@marmaro.de
date Mon, 17 Dec 2007 11:28:40 +0100
parents 8534f0e3a0db
children 5af6bf2cb271
line diff
     1.1 --- a/Makefile	Mon Dec 17 08:02:15 2007 +0100
     1.2 +++ b/Makefile	Mon Dec 17 11:28:40 2007 +0100
     1.3 @@ -1,34 +1,80 @@
     1.4 -######################################################################
     1.5 -# birthday. Reminder of birthdays and other events in the near future.
     1.6 -# $Id: Makefile.in,v 1.3 2000/01/02 19:17:33 andy Exp $
     1.7 +# bday by meillo@marmaro.de
     1.8  
     1.9  
    1.10 +NAME=bday
    1.11 +VERSION = 0.1
    1.12 +NV=${NAME}-${VERSION}
    1.13 +
    1.14 +DOCS=COPYRIGHT ChangeLog TODO
    1.15 +
    1.16 +# paths
    1.17 +PREFIX = /usr
    1.18 +BINDIR = ${PREFIX}/bin
    1.19 +MANDIR = ${PREFIX}/share/man
    1.20 +
    1.21 +SRC=birthday.c bdengine.c
    1.22 +OBJ=$(SRC:.c=.o)
    1.23 +
    1.24  CFLAGS=-O2 -Wall -Wstrict-prototypes
    1.25  
    1.26 +all:
    1.27 +	@echo usage: make [un]install
    1.28  
    1.29 -SRC=birthday.c bdengine.c
    1.30 -OBJ=$(SRC:.c=.o)
    1.31 -EXE=bday
    1.32 +build: ${NAME}
    1.33  
    1.34 -all: ${EXE}
    1.35 -
    1.36 -${EXE}: $(OBJ)
    1.37 +${NAME}: $(OBJ)
    1.38  	$(CC) $(LDFLAGS) $(OBJ) -o $@
    1.39  
    1.40 +dist: build changelog
    1.41 +	@mkdir -p ${NV}
    1.42 +	@cp -f ${NAME} ${NAME}.1 Makefile ${DOCS} ${NV}
    1.43 +	@tar -czhof ${NV}.tar.gz ${NV}
    1.44 +	@rm -rf ${NV}
    1.45  
    1.46 -install: all
    1.47 -	@echo "installing program in $(DESTDIR)/usr/bin"
    1.48 -	mkdir -p $(DESTDIR)/usr/bin
    1.49 -	cp ${EXE} $(DESTDIR)/usr/bin/${EXE}
    1.50 -	chmod 0755 $(DESTDIR)/usr/bin/${EXE}
    1.51 -	@echo "installing manpage in $(DESTDIR)/usr/share/man/man1"
    1.52 -	mkdir -p $(DESTDIR)/usr/share/man/man1
    1.53 -	cp ${EXE}.1 $(DESTDIR)/usr/share/man/man1/${EXE}.1
    1.54 -	chmod 0644 $(DESTDIR)/usr/share/man/man1/${EXE}.1
    1.55 +deb: dist
    1.56 +	@mkdir -p Packages
    1.57 +	@cp ${NV}.tar.gz Packages/
    1.58 +	@( \
    1.59 +		cd Packages/ ;\
    1.60 +		tar -xzf ${NV}.tar.gz ;\
    1.61 +		mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\
    1.62 +		cd ${NV}/ ;\
    1.63 +		cp -r ../../debian/ . ;\
    1.64 +		debuild ;\
    1.65 +	 )
    1.66 +
    1.67 +changelog:
    1.68 +	@echo generating changelog from mercurial log
    1.69 +	@hg log -v --style changelog > ChangeLog
    1.70 +
    1.71 +install:
    1.72 +	@echo installing executable file to ${DESTDIR}${BINDIR}
    1.73 +	@mkdir -p ${DESTDIR}${BINDIR}
    1.74 +	@cp ${NAME} ${DESTDIR}${BINDIR}
    1.75 +	@chmod 755 ${DESTDIR}${BINDIR}/${NAME}
    1.76 +	@echo installing manual page to ${DESTDIR}${MANDIR}/man1
    1.77 +	@mkdir -p ${DESTDIR}${MANDIR}/man1
    1.78 +	@sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1
    1.79 +	@chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
    1.80 +
    1.81 +uninstall:
    1.82 +	@echo removing executable file from ${DESTDIR}${BINDIR}
    1.83 +	@rm -f ${DESTDIR}${BINDIR}/${NAME}
    1.84 +	@echo removing manual page from ${DESTDIR}${MANDIR}/man1
    1.85 +	@rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
    1.86  
    1.87  
    1.88  clean:
    1.89  	rm -f *.o
    1.90  
    1.91  realclean: clean
    1.92 -	rm -f ${EXE}
    1.93 +	rm -f ${NAME}
    1.94 +
    1.95 +distclean: realclean
    1.96 +	@rm -f ${NAME}-*.tar.gz ChangeLog
    1.97 +
    1.98 +debclean: distclean
    1.99 +	@cd Packages/${NV}/ ; debuild clean ;
   1.100 +
   1.101 +
   1.102 +.PHONY: all dist deb changelog clean distclean debclean build install uninstall