baum

changeset 20:3c64b5ac821b

added Debian stuff; new Makefile
author meillo@marmaro.de
date Wed, 13 Feb 2008 21:23:21 +0100
parents fb1a879a7c85
children ca56c1b3fb67
files .hgignore Makefile debian/changelog debian/compat debian/control debian/copyright debian/docs debian/rules
diffstat 8 files changed, 211 insertions(+), 24 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Wed Feb 13 20:48:02 2008 +0100
     1.2 +++ b/.hgignore	Wed Feb 13 21:23:21 2008 +0100
     1.3 @@ -4,3 +4,5 @@
     1.4  
     1.5  *.o
     1.6  baum
     1.7 +Packages
     1.8 +test
     2.1 --- a/Makefile	Wed Feb 13 20:48:02 2008 +0100
     2.2 +++ b/Makefile	Wed Feb 13 21:23:21 2008 +0100
     2.3 @@ -1,51 +1,109 @@
     2.4 -# common makefile
     2.5 +# baum by meillo@marmaro.de
     2.6  
     2.7 -# program
     2.8 -PROGRAM = baum
     2.9 -SRC = baum.c actions.c
    2.10 -OBJ = ${SRC:.c=.o}
    2.11 -DEP = baum.h actions.h
    2.12 +
    2.13 +NAME=baum
    2.14 +VERSION = 0.1
    2.15 +NV=${NAME}-${VERSION}
    2.16 +
    2.17 +DOCS=LICENSE README ChangeLog TODO examples
    2.18 +
    2.19 +# paths
    2.20 +PREFIX = /usr
    2.21 +BINDIR = ${PREFIX}/bin
    2.22 +MANDIR = ${PREFIX}/share/man
    2.23  
    2.24  # compile env
    2.25  CC = gcc
    2.26  LD = ${CC}
    2.27  DEBUG = -g
    2.28  CFLAGS = -Wall -c ${DEBUG}
    2.29 -LFLAGS = -Wall ${DEBUG}
    2.30 +LDFLAGS = -Wall ${DEBUG}
    2.31  
    2.32 -####
    2.33 +# files
    2.34 +SRC=baum.c actions.c
    2.35 +OBJ=$(SRC:.c=.o)
    2.36 +DEP = baum.h actions.h
    2.37  
    2.38 -all: options ${PROGRAM}
    2.39 +
    2.40 +
    2.41 +all: options build
    2.42  
    2.43  options:
    2.44  	@echo build options:
    2.45  	@echo "CC     = ${CC}"
    2.46  	@echo "LD     = ${LD}"
    2.47  	@echo "CFLAGS = ${CFLAGS}"
    2.48 -	@echo "LFLAGS = ${LFLAGS}"
    2.49 +	@echo "LDFLAGS = ${LDFLAGS}"
    2.50  	@echo
    2.51  
    2.52 -.cpp.o:
    2.53 -	$(CC) $(CFLAGS) $<
    2.54 +build: ${NAME}
    2.55 +
    2.56 +${NAME}: $(OBJ) ${DEP}
    2.57 +	$(CC) $(LDFLAGS) $(OBJ) -o $@
    2.58  
    2.59  ${OBJ}: ${DEP}
    2.60  
    2.61 -${PROGRAM}: ${OBJ}
    2.62 -	$(LD) $(LFLAGS) ${OBJ} -o $@
    2.63 +car: clean all
    2.64  
    2.65  debug: all
    2.66 -	gdb ${PROGRAM}
    2.67 +	gdb ${NAME}
    2.68  
    2.69 -strip: ${PROGRAM}
    2.70 -	@echo stripping ${PROGRAM}
    2.71 -	@strip ${PROGRAM}
    2.72 +strip: ${NAME}
    2.73 +	@echo stripping ${NAME}
    2.74 +	@strip ${NAME}
    2.75  
    2.76 -tar: clean
    2.77 -	@echo creating archive
    2.78 -	@tar -czvf ${PROGRAM}.tar.gz *
    2.79 +dist: build changelog
    2.80 +	@echo "generating tarball"
    2.81 +	@mkdir -p ${NV}
    2.82 +	@cp -f ${NAME} ${SRC} ${DEP} ${NAME}.1 Makefile ${DOCS} ${NV}
    2.83 +	@tar -czhof ${NV}.tar.gz ${NV}
    2.84 +	@rm -rf ${NV}
    2.85 +
    2.86 +deb: dist
    2.87 +	@mkdir -p Packages
    2.88 +	@cp ${NV}.tar.gz Packages/
    2.89 +	@( \
    2.90 +		cd Packages/ ;\
    2.91 +		tar -xzf ${NV}.tar.gz ;\
    2.92 +		mv ${NV}.tar.gz ${NAME}_${VERSION}.orig.tar.gz ;\
    2.93 +		cd ${NV}/ ;\
    2.94 +		cp -r ../../debian/ . ;\
    2.95 +		debuild ;\
    2.96 +	 )
    2.97 +	@rm -rf Packages/${NV}
    2.98 +
    2.99 +changelog:
   2.100 +	@echo generating changelog from mercurial log
   2.101 +	@hg log -v --style changelog > ChangeLog
   2.102 +
   2.103 +install:
   2.104 +	@echo installing executable file to ${DESTDIR}${BINDIR}
   2.105 +	@mkdir -p ${DESTDIR}${BINDIR}
   2.106 +	@cp ${NAME} ${DESTDIR}${BINDIR}
   2.107 +	@chmod 755 ${DESTDIR}${BINDIR}/${NAME}
   2.108 +	@echo installing manual page to ${DESTDIR}${MANDIR}/man1
   2.109 +	@mkdir -p ${DESTDIR}${MANDIR}/man1
   2.110 +	@sed 's/VERSION/${VERSION}/g' < ${NAME}.1 > ${DESTDIR}${MANDIR}/man1/${NAME}.1
   2.111 +	@chmod 644 ${DESTDIR}${MANDIR}/man1/${NAME}.1
   2.112 +
   2.113 +uninstall:
   2.114 +	@echo removing executable file from ${DESTDIR}${BINDIR}
   2.115 +	@rm -f ${DESTDIR}${BINDIR}/${NAME}
   2.116 +	@echo removing manual page from ${DESTDIR}${MANDIR}/man1
   2.117 +	@rm -f ${DESTDIR}${MANDIR}/man1/${NAME}.1
   2.118 +
   2.119  
   2.120  clean:
   2.121 -	@echo cleaning
   2.122 -	@rm -f ${PROGRAM} ${OBJ}
   2.123 +	rm -f *.o
   2.124  
   2.125 -.PHONY: all options debug strip tar clean
   2.126 +realclean: clean
   2.127 +	rm -f ${NAME}
   2.128 +
   2.129 +distclean: realclean
   2.130 +	@rm -f ${NAME}-*.tar.gz ChangeLog
   2.131 +
   2.132 +debclean: distclean
   2.133 +	@cd Packages/${NV}/ ; debuild clean ;
   2.134 +
   2.135 +
   2.136 +.PHONY: all dist deb changelog clean distclean debclean build install uninstall
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/debian/changelog	Wed Feb 13 21:23:21 2008 +0100
     3.3 @@ -0,0 +1,12 @@
     3.4 +baum (0.1-2) unstable; urgency=low
     3.5 +
     3.6 +  * Initial debian package
     3.7 +
     3.8 + -- markus schnalke <meillo@marmaro.de>  Wed, 13 Feb 2008 21:10:16 +0100
     3.9 +
    3.10 +
    3.11 +baum (0.1-1) unstable; urgency=low
    3.12 +
    3.13 +  * Initial debian package
    3.14 +
    3.15 + -- markus schnalke <meillo@marmaro.de>  Wed, 13 Feb 2008 13:25:55 +0100
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/debian/compat	Wed Feb 13 21:23:21 2008 +0100
     4.3 @@ -0,0 +1,1 @@
     4.4 +5
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/debian/control	Wed Feb 13 21:23:21 2008 +0100
     5.3 @@ -0,0 +1,19 @@
     5.4 +Source: baum
     5.5 +Section: devel
     5.6 +Priority: extra
     5.7 +Maintainer: markus schnalke <meillo@marmaro.de>
     5.8 +Build-Depends: debhelper (>= 5)
     5.9 +Standards-Version: 3.7.2
    5.10 +
    5.11 +Package: baum
    5.12 +Architecture: i386
    5.13 +Depends: ${shlibs:Depends}, ${misc:Depends}, libc6-dev
    5.14 +Description: an esoteric programming language
    5.15 + *** unofficial debian package by meillo@marmaro.de ***
    5.16 + .
    5.17 + baum source code is a representation of a tree in which every node is a
    5.18 + command or data.
    5.19 + .
    5.20 + baum is only an experiment and the functionality is very restricted.
    5.21 + .
    5.22 + Website: http://prog.marmaro.de/baum
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/debian/copyright	Wed Feb 13 21:23:21 2008 +0100
     6.3 @@ -0,0 +1,11 @@
     6.4 +This package was debianized by markus schnalke <meillo@marmaro.de> on
     6.5 +Wed, 13 Feb 2008 13:26:21 +0100
     6.6 +
     6.7 +It was downloaded from http://prog.marmaro.de
     6.8 +
     6.9 +Upstream Author: markus schnalke <meillo@marmaro.de>
    6.10 +
    6.11 +This software is copyright (c) 2008 markus schnalke.
    6.12 +
    6.13 +You are free to distribute this software under the terms of
    6.14 +the MIT-/X-License. See LICENSE for details.
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/debian/docs	Wed Feb 13 21:23:21 2008 +0100
     7.3 @@ -0,0 +1,3 @@
     7.4 +LICENSE
     7.5 +README
     7.6 +TODO
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/debian/rules	Wed Feb 13 21:23:21 2008 +0100
     8.3 @@ -0,0 +1,81 @@
     8.4 +#!/usr/bin/make -f
     8.5 +# Sample debian/rules that uses debhelper.
     8.6 +# GNU copyright 1997 to 1999 by Joey Hess.
     8.7 +
     8.8 +# Uncomment this to turn on verbose mode.
     8.9 +#export DH_VERBOSE=1
    8.10 +
    8.11 +# This is the debhelper compatibility version to use.
    8.12 +#export DH_COMPAT=4
    8.13 +
    8.14 +CFLAGS = -g
    8.15 +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
    8.16 +CFLAGS += -O0
    8.17 +else
    8.18 +CFLAGS += -O2
    8.19 +endif
    8.20 +
    8.21 +build: build-stamp
    8.22 +build-stamp:
    8.23 +	dh_testdir
    8.24 +
    8.25 +	# Add here commands to compile the package.
    8.26 +	$(MAKE) build
    8.27 +
    8.28 +	touch build-stamp
    8.29 +
    8.30 +clean:
    8.31 +	dh_testdir
    8.32 +	dh_testroot
    8.33 +	rm -f build-stamp
    8.34 +
    8.35 +	# Add here commands to clean up after the build process.
    8.36 +	-$(MAKE) clean
    8.37 +
    8.38 +	dh_clean
    8.39 +
    8.40 +install: build
    8.41 +	dh_testdir
    8.42 +	dh_testroot
    8.43 +	dh_clean -k
    8.44 +	dh_installdirs
    8.45 +
    8.46 +	# Add here commands to install the package into debian/gentoo.
    8.47 +	$(MAKE) install DESTDIR=$(CURDIR)/debian/baum
    8.48 +
    8.49 +# Build architecture-independent files here.
    8.50 +binary-indep: build install
    8.51 +# We have nothing to do by default.
    8.52 +
    8.53 +# Build architecture-dependent files here.
    8.54 +binary-arch: build install
    8.55 +	dh_testdir
    8.56 +	dh_testroot
    8.57 +#      dh_installdebconf
    8.58 +	dh_installdocs
    8.59 +	dh_installexamples examples
    8.60 +#	dh_installmenu
    8.61 +#      dh_installlogrotate
    8.62 +#      dh_installemacsen
    8.63 +#      dh_installpam
    8.64 +#      dh_installmime
    8.65 +#      dh_installinit
    8.66 +#	dh_installcron
    8.67 +	dh_installman
    8.68 +#	dh_installinfo
    8.69 +#      dh_undocumented
    8.70 +	dh_installchangelogs ChangeLog
    8.71 +	dh_link
    8.72 +	dh_strip
    8.73 +	dh_compress
    8.74 +	dh_fixperms
    8.75 +#      dh_makeshlibs
    8.76 +	dh_installdeb
    8.77 +#      dh_perl
    8.78 +	dh_shlibdeps
    8.79 +	dh_gencontrol
    8.80 +	dh_md5sums
    8.81 +	dh_builddeb
    8.82 +
    8.83 +binary: binary-indep binary-arch
    8.84 +.PHONY: build clean binary-indep binary-arch binary install