##
## Makefile -- daCode http://www.dacode.org/
## $Id: Makefile,v 1.22.4.6 2002/10/12 18:06:10 ruffy Exp $
## Denis Barbier <barbier@linuxfr.org>
## This program is free software, released under the GNU GPL v2
##

VERSION = 1.4.0

##
##   There is no default target
##

all:
	@:

##
##   Standard utilities
##

FIND = find     # on some systems, GNU find is called gfind
GZIP = gzip
TAR  = tar

php php3 php4 reconf:
	@echo This rule has been superseded by scripts/dacodeconfig.
	@echo Run \`perldoc scripts/dacodeconfig\' for documentation

##
##  Check SQL queries for tainted variables
##
sqlcheck:
	@./scripts/sqlcheck.pl --files --lines --tables --notainted --sqlcommand

##
##  Create tarball
##

TARCUST = tarcust     # free alternative to tardy
USER  = daCode
GROUP = daCode

NAME  = daCode

EXCLUDE_FILES = .*CVS.* .*.cvsignore .scvsrc \
   $(NAME)-.* \
   src/htdocs/cache.* \
   .dacode.* build.* \
   .*config.site .*config.php.*

clean:
	$(FIND) . -name "*~" -o -name ".#*" -o -name "TAGS" -o -name "*.old" | xargs rm -f

bz: clean
	cd ..; rm -fr $(NAME)-$(VERSION); cp -af daCode $(NAME)-$(VERSION)
	cd ../$(NAME)-$(VERSION); rm -fr $(EXCLUDE_FILES); $(FIND) . -type 'd' -name 'CVS' | xargs rm -fr
	cd ..; tar cjf $(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION)

tar:
	#  Sort files alphatebically according to C locale
	export LC_ALL=C; \
   x=`echo $(EXCLUDE_FILES) |\
      sed -e 's#/#\\\\/#g' -e 's/[ 	]\{1,\}/ -x /g'`; \
   $(TAR) cf - * |\
   $(TARCUST) -x $$x -u $(USER) -U 0 -g $(GROUP) -G 0 -p $(NAME)-$(VERSION) |\
   $(GZIP) -9 > $(NAME)-$(VERSION).tar.gz

update-version:
	f=src/htdocs/dacode.php3; \
   sed -e "s/\\(^[ 	]*\$$config->version[ 	]*=\\).*$$/\\1 \"$(VERSION)\";/" $$f > $$f.tmp && mv $$f.tmp $$f

##EOF##
