# Generated automatically from Makefile.in by configure.
#
# Main Makefile for Window Maker
#
# Modifications:
#   Nicolai P Guba
#	- Bit of Housekeeping
#	- Added install support for GNUstep diretcory hierarchy
#         (this could be used for all directory installs later, let's
#	   test this on some live stock first...)
#       - migrated Makefile to Makefile.in.  This now implies that
#         the main Makefile is auto-made/configured.
#
MV	= mv -f
RM	= rm -f
CP	= cp -f

#INSTALL = ../install-sh
INSTALL = /usr/bin/install -c
INSTALL_BIN = ${INSTALL}
INSTALL_CFG = ${INSTALL} -m 644

include Version

# installation prefixes
# 
exec_prefix  = /usr/X11R6
prefix 	     = /usr/X11R6
lib_src      = ./Library

# Support for GNUstep hierarchy
# 
gnustep_base = GNUstep
gnustep_exec = $(gnustep_base)/Apps/WindowMaker.app 
gnustep_lib  = $(gnustep_base)/Library/WindowMaker
gnustep_pix  = $(gnustep_lib)/Pixmaps
gnustep_sty  = $(gnustep_lib)/style 

all: config.status 
	(cd wrlib; $(MAKE) all)
	(cd wmlib; $(MAKE) all)
	(cd src; $(MAKE) all)
	$(CP) src/wmaker .
	(cd util; $(MAKE))
	(cd Documentation; $(MAKE))
	@echo "Done!"

docs: config.status
	(cd Documentation; $(MAKE))

install: 
	(cd wmlib; $(MAKE) install)
	(cd src; $(MAKE) install)
	(cd util; $(MAKE) install)
	(cd Documentation; $(MAKE) install)

gnustepdirs:	
	$(INSTALL_BIN) -d $(exec_prefix)/$(gnustep_pix)
	$(INSTALL_BIN) -d $(exec_prefix)/$(gnustep_sty)
# temporarily disabled until we decide what to do.  copying recursively
# is definitively the lazy option, but who said it has to be hard work ;)
#
# nicolai
	$(CP) -r $(lib_src) $(exec_prefix)/$(gnustep_base)
#'Dump our stuff in there
#	$(INSTALL_BIN) -d $(exec_prefix)/$(gnustep_lib)
#	$(INSTALL_BIN) -d $(exec_prefix)/$(gnustep_lib)
#	$(INSTALL_BIN) -s wmaker $(exec_prefix)/$(gnustep_exec)


clean:
	$(RM) *~ core
	(cd wrlib; $(MAKE) clean)
	(cd wmlib; $(MAKE) clean)
	(cd src; $(MAKE) clean)
	(cd test; $(MAKE) clean)
	(cd util; $(MAKE) clean)
	(cd Documentation; $(MAKE) clean)

distclean: clean 
	$(RM) config.log config.status config.cache wmaker gmon.out
	(cd pixmaps; $(RM) -r .xvpics)
	(cd Library/WindowMaker; $(MAKE) distclean)
	(cd src; $(MAKE) distclean)
	(cd wrlib; $(MAKE) distclean)
	(cd wmlib; $(MAKE) distclean)
	(cd test; $(MAKE) distclean)
	(cd util; $(MAKE) distclean)
	(cd Documentation; $(MAKE) distclean)

config.status: 
	@echo "	You must configure WindowMaker before typing 'make'."
	@echo "	See INSTALL for installation instructions."
	@echo
	@exit 1

dist:    
	rm -f ../WindowMaker-$(VERSION).tar.gz
	mkdir ../WindowMaker-$(VERSION)
	cp -rd * ../WindowMaker-$(VERSION)
	(cd ../WindowMaker-$(VERSION); $(MAKE) distclean)
	(cd ..; tar czf WindowMaker-$(VERSION).tar.gz WindowMaker-$(VERSION)/*)
	rm -fr ../WindowMaker-$(VERSION)
