baum
diff Makefile @ 20:3c64b5ac821b
added Debian stuff; new Makefile
author | meillo@marmaro.de |
---|---|
date | Wed, 13 Feb 2008 21:23:21 +0100 |
parents | 557fa4df2bcd |
children | ca56c1b3fb67 |
line diff
1.1 --- a/Makefile Wed Feb 13 20:48:02 2008 +0100 1.2 +++ b/Makefile Wed Feb 13 21:23:21 2008 +0100 1.3 @@ -1,51 +1,109 @@ 1.4 -# common makefile 1.5 +# baum by meillo@marmaro.de 1.6 1.7 -# program 1.8 -PROGRAM = baum 1.9 -SRC = baum.c actions.c 1.10 -OBJ = ${SRC:.c=.o} 1.11 -DEP = baum.h actions.h 1.12 + 1.13 +NAME=baum 1.14 +VERSION = 0.1 1.15 +NV=${NAME}-${VERSION} 1.16 + 1.17 +DOCS=LICENSE README ChangeLog TODO examples 1.18 + 1.19 +# paths 1.20 +PREFIX = /usr 1.21 +BINDIR = ${PREFIX}/bin 1.22 +MANDIR = ${PREFIX}/share/man 1.23 1.24 # compile env 1.25 CC = gcc 1.26 LD = ${CC} 1.27 DEBUG = -g 1.28 CFLAGS = -Wall -c ${DEBUG} 1.29 -LFLAGS = -Wall ${DEBUG} 1.30 +LDFLAGS = -Wall ${DEBUG} 1.31 1.32 -#### 1.33 +# files 1.34 +SRC=baum.c actions.c 1.35 +OBJ=$(SRC:.c=.o) 1.36 +DEP = baum.h actions.h 1.37 1.38 -all: options ${PROGRAM} 1.39 + 1.40 + 1.41 +all: options build 1.42 1.43 options: 1.44 @echo build options: 1.45 @echo "CC = ${CC}" 1.46 @echo "LD = ${LD}" 1.47 @echo "CFLAGS = ${CFLAGS}" 1.48 - @echo "LFLAGS = ${LFLAGS}" 1.49 + @echo "LDFLAGS = ${LDFLAGS}" 1.50 @echo 1.51 1.52 -.cpp.o: 1.53 - $(CC) $(CFLAGS) $< 1.54 +build: ${NAME} 1.55 + 1.56 +${NAME}: $(OBJ) ${DEP} 1.57 + $(CC) $(LDFLAGS) $(OBJ) -o $@ 1.58 1.59 ${OBJ}: ${DEP} 1.60 1.61 -${PROGRAM}: ${OBJ} 1.62 - $(LD) $(LFLAGS) ${OBJ} -o $@ 1.63 +car: clean all 1.64 1.65 debug: all 1.66 - gdb ${PROGRAM} 1.67 + gdb ${NAME} 1.68 1.69 -strip: ${PROGRAM} 1.70 - @echo stripping ${PROGRAM} 1.71 - @strip ${PROGRAM} 1.72 +strip: ${NAME} 1.73 + @echo stripping ${NAME} 1.74 + @strip ${NAME} 1.75 1.76 -tar: clean 1.77 - @echo creating archive 1.78 - @tar -czvf ${PROGRAM}.tar.gz * 1.79 +dist: build changelog 1.80 + @echo "generating tarball" 1.81 + @mkdir -p ${NV} 1.82 + @cp -f ${NAME} ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV} 1.83 + @tar -czhof ${NV}.tar.gz ${NV} 1.84 + @rm -rf ${NV} 1.85 + 1.86 +deb: dist 1.87 + @mkdir -p Packages 1.88 + @cp ${NV}.tar.gz Packages/ 1.89 + @( \ 1.90 + cd Packages/ ;\ 1.91 + tar -xzf ${NV}.tar.gz ;\ 1.92 + mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\ 1.93 + cd ${NV}/ ;\ 1.94 + cp -r ../../debian/ . ;\ 1.95 + debuild ;\ 1.96 + ) 1.97 + @rm -rf Packages/${NV} 1.98 + 1.99 +changelog: 1.100 + @echo generating changelog from mercurial log 1.101 + @hg log -v --style changelog > ChangeLog 1.102 + 1.103 +install: 1.104 + @echo installing executable file to ${DESTDIR}${BINDIR} 1.105 + @mkdir -p ${DESTDIR}${BINDIR} 1.106 + @cp ${NAME} ${DESTDIR}${BINDIR} 1.107 + @chmod 755 ${DESTDIR}${BINDIR}/${NAME} 1.108 + @echo installing manual page to ${DESTDIR}${MANDIR}/man1 1.109 + @mkdir -p ${DESTDIR}${MANDIR}/man1 1.110 + @sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1 1.111 + @chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1 1.112 + 1.113 +uninstall: 1.114 + @echo removing executable file from ${DESTDIR}${BINDIR} 1.115 + @rm -f ${DESTDIR}${BINDIR}/${NAME} 1.116 + @echo removing manual page from ${DESTDIR}${MANDIR}/man1 1.117 + @rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1 1.118 + 1.119 1.120 clean: 1.121 - @echo cleaning 1.122 - @rm -f ${PROGRAM} ${OBJ} 1.123 + rm -f *.o 1.124 1.125 -.PHONY: all options debug strip tar clean 1.126 +realclean: clean 1.127 + rm -f ${NAME} 1.128 + 1.129 +distclean: realclean 1.130 + @rm -f ${NAME}-*.tar.gz ChangeLog 1.131 + 1.132 +debclean: distclean 1.133 + @cd Packages/${NV}/ ; debuild clean ; 1.134 + 1.135 + 1.136 +.PHONY: all dist deb changelog clean distclean debclean build install uninstall