#
# Pablo System: Visual/Src/Makefile
#
TOP := ../../

override MAKEFLAGS += --no-builtin-rules    # cancel predefined pattern rules
.SUFFIXES:

.PHONY : Makefile $(TOP)/Makefile.defines   # explicitly mark PHONY to save time
include $(TOP)/Makefile.defines

#
# Default target : all
#	Composed of subgoals for various libraries, objects, and executable
#
.PHONY : all audio motif widgets pablo

ifeq ($(strip $(USE_AUDIO)),yes)
SUBGOALS := audio motif widgets pablo
else
SUBGOALS := motif widgets pablo
endif

all:	$(SUBGOALS)

audio: 
	$(MAKE) -C Audio/Build

motif: 
	$(MAKE) -C Motif/Build

widgets: 
	$(MAKE) -C Widgets/Build

pablo: 
	$(MAKE) -C System/Build

#
# Targets install and  clean
#
.PHONY : install clean 

install: 
	$(MAKEDIRHIER) $(PABLOHOME)
	@echo Installing Pablo in $(PABLOHOME)
	$(MAKE) -C System/Build install

	$(MAKEDIRHIER) $(PABLOHELPDIR)
	@echo Installing Pablo Help Files in $(PABLOHELPDIR)
	(cd ../Help; tar clf - . ) | (cd  $(PABLOHELPDIR); tar xlf - )

	$(MAKEDIRHIER) $(PABLOCONFIGDIR)
	@echo Installing Pablo Saved Configuration in $(PABLOCONFIGDIR)
	(cd ./System/Config; tar clf - .) | (cd  $(PABLOCONFIGDIR); tar xlf -)

ifeq ($(strip $(USE_AUDIO)),yes)
	@echo Installing audio software in $(SOUNDDIR)...
	$(MAKE) -C Audio/Build install
endif

clean:
	(cd Motif/Build; makeClean)
	(cd Widgets/Build; makeClean)
	$(MAKE) -C System/Build clean
ifeq ($(strip $(USE_AUDIO)),yes)
	$(MAKE) -C Audio/Build clean
endif
