SHELL=/bin/sh

default: lib apps

all: lib apps demos tests

#all: lib apps demos tests dvi man

.PHONY: lib apps demos tests dvi man

#------------------------------------------------------------------------------
# libraries
#------------------------------------------------------------------------------

lib: .license
	@if [ -f .license ]; then $(MAKE) -C src obj; fi
	@if [ -f shared.mk ]; then $(MAKE) shared; \
	elif [ -f static.mk ]; then $(MAKE) static; fi

objects: .license
	$(MAKE) -C src obj

x11:
	@rm -f src/graphics/mswin/*.o
	@rm -f src/graphics/xx/*.o
	$(MAKE) -C src/graphics/x11

mswin:
	@rm -f src/graphics/x11/*.o
	@rm -f src/graphics/xx/*.o
	$(MAKE) -C src/graphics/mswin 

xx:
	port -k
	@rm -f src/graphics/x11/*.o
	@rm -f src/graphics/mswin/*.o
	@rm -f src/graphics/xx/*.o
	$(MAKE) -C src/graphics/xx 
	$(MAKE) -C app install
	cp libleda.so ~/www/leda1/app


touch: .license
	@if [ -f .license ]; then $(MAKE) -C src   touch; fi
	@if [ -f shared.mk ]; then $(MAKE) shared; \
	elif [ -f static.mk ]; then $(MAKE) static; fi

shared: .license
	@$(MAKE) -f shared.mk

static: .license
	@$(MAKE) -f static.mk


.license:
#	@/bin/sh confdir/util/unix/license.sh
	@touch .license


#------------------------------------------------------------------------------
# programs
#------------------------------------------------------------------------------

apps: .license
	$(MAKE) -C app

demos: .license
	$(MAKE) -C demo

tests: .license
	$(MAKE) -C test

res: .license
	$(MAKE) -C res


#------------------------------------------------------------------------------
# manual
#------------------------------------------------------------------------------

man: .license
	$(MAKE) -C Manual/MANUAL

pdfman: .license
	$(MAKE) -C Manual/MANUAL  pdf

dvi: .license
	$(MAKE) -C Manual/MANUAL  dvi



#------------------------------------------------------------------------------
# cleaning up
#------------------------------------------------------------------------------

del:
	@if [ -d src   ]; then $(MAKE) -C src    clean; fi
	@if [ -d app   ]; then $(MAKE) -C app    del; fi
	@if [ -d demo  ]; then $(MAKE) -C demo   del; fi
	@if [ -d test  ]; then $(MAKE) -C test   del; fi
	@if [ -d prog  ]; then $(MAKE) -C prog   del; fi
	@if [ -d res   ]; then $(MAKE) -C res    del; fi
	rm -f lib*.a lib*.so lib*.sl lib*.lib leda.dll leda.lib

clean:
	@if [ -d src   	]; then $(MAKE) -C src    clean; fi
	@if [ -d app   	]; then $(MAKE) -C app    clean; fi
	@if [ -d demo  	]; then $(MAKE) -C demo   clean; fi
	@if [ -d test  	]; then $(MAKE) -C test   clean; fi
	@if [ -d prog  	]; then $(MAKE) -C prog   clean; fi
	@if [ -d res  	]; then $(MAKE) -C res    clean; fi

