# $Id: Makefile,v 6.15 2003/08/01 19:06:41 cher Exp $

# Copyright (C) 1996-2003 Alexander Chernov <cher@ispras.ru>
# Created: Sat Dec  7 16:18:44 1996 by cher (Alexander Chernov) 

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

MM=./runmake.sh
DI=./etc/doinstall.sh

DIRS=etc sources
RDIRS=sources etc

all:
	$(MM) all $(DIRS)
compile:
	$(MM) compile $(DIRS)

install:
	$(MM) all $(DIRS)
	$(DI)

install_only:
	$(DI)

deps:
	$(MM) deps $(DIRS)
genfiles:
	$(MM) genfiles $(DIRS)

# Clear compiled files (arch-dependent)
clean : 
	$(MM) clean $(RDIRS)

# Clear generated files (including deps.make)
genclean:
	$(MM) genclean $(RDIRS)

# Clear configuration files
confclean:
	$(MM) confclean $(RDIRS)

# Distclean rule is to remove all generated and configuration files
# Only released files should left in the directory
distclean: 
	$(MM) distclean $(RDIRS)
	-rm -rf bin libexec lib include share

binclean:
	$(MM) clean $(RDIRS)
	-rm -rf bin libexec lib include/reuse share

# Save copies of generated files
save_genfiles:
	$(MM) save_genfiles $(DIRS)

remove_genfiles:
	-find . -name gen -prune -name gen -exec rm -rf \{\} \; || true

remove_CVS:
	-find . -name CVS -prune -name CVS -exec rm -rf \{\} \; || true

release_win32:
	rm -rf .cvsignore CVS ChangeLog Makefile configure etc *.sh sources

release:
	rm -rf .cvsignore CVS ChangeLog Makefile configure *.sh sources etc/.cfg-* etc/.cvsignore etc/CVS etc/ChangeLog etc/Main.make etc/Makefile etc/doinstall.sh etc/features.sh

# Standard layout assumed, all the files assumed to be compiled
log:
	cvs log -l | sources/tools/o/mkChangeLog sources/reuse/etc/authors ChangeLog ChangeLog

.PHONY : all compile install install_only deps genfiles \
  clean genclean confclean distclean \
  save_genfiles remove_genfiles remove_CVS
