# Hey Emacs, this is a -*- makefile -*-

# Makefile for the nlsutils
# Copyright (C) 1994 Jochen Hein (Hein@Student.TU-Clausthal.de)

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, 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 General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

CC=gcc
CFLAGS=-O2 -Wall -ansi
LDFLAGS=-s -N
INSTALL=install

DISTFILES=Makefile TODO README ChangeLog \
	COPYING README.gencat Copyright.gencat mknotes locale_create

SUBDIRS=lib src man examples

all: 
	for dir in $(SUBDIRS); do \
		echo making $@ in $$dir ; \
		(cd $$dir; $(MAKE) $@) ; \
	done

install: 
	for dir in $(SUBDIRS); do \
		echo making $@ in $$dir ; \
		(cd $$dir; $(MAKE) $@) ; \
	done

clean:
	rm -f *~
	for dir in $(SUBDIRS); do \
		echo making $@ in $$dir ; \
		(cd $$dir; $(MAKE) $@) ; \
	done

dist: $(DISTFILES)
	echo nlsutils-`sed -e '/version_string/!d' \
	   -e 's/[^0-9.]*\([0-9.a-z]*\).*/\1/' -e q ./src/version.c` > .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	ln $(DISTFILES) `cat .fname`
	for dir in $(SUBDIRS); do \
	  mkdir `cat .fname`/$$dir; \
	  (cd $$dir; $(MAKE) $@); \
	done
	./mknotes nlsutils `sed -e '/version_string/!d' \
           -e 's/[^0-9.]*\([0-9.a-z]*\).*/\1/' -e q ./src/version.c`
	tar --gzip -chvf `cat .fname`.tar.gz `cat .fname`
	rm -rf `cat .fname` .fname

dspmsg: dspmsg.o
