SHELL		= /bin/sh
MAKE		= make

CC		= cc
CFLAGS		= -DNDEBUG
LDFLAGS		= $(LDFLAGS)

GLEIPNIR_DIR	= gleipnir
CORE_DIR	= core
AIM_DIR		= aim
UICX_DIR	= uicx

all: static

dynamic:
	cd $(UICX_DIR)	&& $(MAKE) dynamic\
				CC="$(CC)"\
				CFLAGS="$(CFLAGS)"\
				LDFLAGS="$(LDFLAGS)"

static:
	cd $(UICX_DIR)	&& $(MAKE) static\
				CC="$(CC)"\
				CFLAGS="$(CFLAGS)"

clean:
	cd $(GLEIPNIR_DIR)	&& $(MAKE) clean
	cd $(CORE_DIR)		&& $(MAKE) clean
	cd $(AIM_DIR)		&& $(MAKE) clean
	cd $(UICX_DIR)		&& $(MAKE) clean

mrproper: clean
	cd $(GLEIPNIR_DIR)	&& $(MAKE) mrproper
	cd $(CORE_DIR)		&& $(MAKE) mrproper
	cd $(AIM_DIR)		&& $(MAKE) mrproper
	cd $(UICX_DIR)		&& $(MAKE) mrproper

clean-dist: mrproper
	cd $(GLEIPNIR_DIR)	&& $(MAKE) clean-roff
	cd $(CORE_DIR)		&& $(MAKE) clean-dist
	cd $(AIM_DIR)		&& $(MAKE) clean-dist
	cd $(UICX_DIR)		&& $(MAKE) clean-dist

dist: clean-dist
	cd $(GLEIPNIR_DIR)	&& $(MAKE) roff
	cd $(CORE_DIR)		&& $(MAKE) dist
	cd $(AIM_DIR)		&& $(MAKE) dist
	cd $(UICX_DIR)		&& $(MAKE) dist

.PHONY: all clean mrproper\
	dynamic static\
	clean-dist dist

