# Emacs, this is a -*- Makefile -*-
#
# Makefile for Korigin.
#
# This is the driver makefile. It just calls make on the actual
# modules.
#
# Each module must provide the following targets:
# - default (i.e. just "make"): build the object file and place
#   it into $(KORIGIN)/lib
# - clean: remove generated files, core files, backups etc
# - doc: build module documentation and place it into
#   $(KORIGIN)/doc
# - install: copy icons etc. to their destinations (icons to
#   $(KDEDIR)/share/apps/korigin (might require root privilegues).
#

include mk.korigin

default:
	(cd ./base && make)
	(cd ./modules && make)
	$(CXX) -o korigin ./lib/*.o -L./lib -lkorigin $(LDFLAGS)

install: #default doc
#	$(INSTALL) -s korigin $(KDEDIR)/bin
	$(INSTALL) -d $(KDEDIR)/share/apps/korigin/pics
	$(INSTALL) ./icons/* $(KDEDIR)/share/apps/korigin/pics
	$(INSTALL) -d $(KDEDIR)/share/config
	$(INSTALL) koriginrc $(KDEDIR)/share/config
	mkdir -p $(HOME)/.kde/config
	cp ./koriginrc $(HOME)/.kde/config
	(cd ./doc && make install)

doc:
	(cd ./base && make doc)
	(cd ./modules && make doc)
	(cd ./doc && make doc)

clean:
	(cd ./base && make clean)
	(cd ./modules && make clean)
	(cd ./lib && make clean)
	(cd ./doc && make clean)
	rm -f core *~
	rm -f korigin
