#
#	Toplevel Makefile for MiNT-Net, a networking extension based on
#	the MiNT multitasking operating system extension for Atari
#	Computers.
#

SUBDIRS = net lib tool test

all: netdev library tools

library:
	$(MAKE) -C lib

netdev:
	$(MAKE) -C net

tests:
	$(MAKE) -C test

tools:
	$(MAKE) -C tool

install:
	@for i in $(SUBDIRS); do $(MAKE) -C $$i install; done;

install.lib:
	$(MAKE) -C lib install

install.net:
	$(MAKE) -C net install

install.tool:
	$(MAKE) -C tool install

clean:
	@for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done;

depend:
	@find . -name depend -exec rm \{\} \;
	@for i in $(SUBDIRS); do $(MAKE) -C $$i depend; done;

crlf:
	@find . -name '*.[chs]' -exec crlf -s \{\} \;
	@find . -name Makefile -exec crlf -s \{\} \;
	@find . -name depend -exec crlf -s \{\} \;

dist:
	cp -rl ../net-??? /tmp
	( cd /tmp/net-???; make clean; cd ..; tar czf `echo -n net-???`.tgz net-??? )
	mv /tmp/net-???.tgz ../
	rm -rf /tmp/net-???

# Quick hack for transferring files after cross-compiling.
# Note you have to specify -print for compatibility reasons.
# (Slowaris says "no operation specified" for example...)
# Ignore, remove or improve this target.

bindist:
	tar czvf `echo -n ../net-???`.tgz \
	lib/*.olb net/sockdev.xdd net/drivers/*.xif \
	`find tool -type f -perm -111 -print` `find lib -name '*.h' -print`

tarit:
	( cd ..; tar czf `echo -n net-???`.tgz net-??? )
