# Makefile for libshow entire directory
#
#   very top libshow directory

# BUILD VARIABLES
#
##################### LIBRARIES ########################
#
# DIRS:
# This is an ordered list
# Put only the directories that build object files in the list

# make all targets
DIRS = src

ifdef MAC
 INSTALL_PREFIX ?= /usr/local
else
 INSTALL_PREFIX ?= /usr
endif

SRC_INST=$(DESTDIR)$(INSTALL_PREFIX)/share/yumapro/src/libshow


#################### PLATFORM DEFINITIONS ############
all: showall


################################ MAKE RULES #################################
#

clean: showclean

superclean: showsuperclean

distclean: showsuperclean

TARGETS=

ifdef DEBIAN

ifeq "$(PACKAGE)" "DEVELOPER"
TARGETS= libinstall srcinstall
endif # DEVELOPER

ifeq "$(PACKAGE)" "TOOLS"
TARGETS= srcinstall
endif # TOOLS

ifeq "$(PACKAGE)" "CLIENT2"
TARGETS= libinstall srcinstall
endif # CLIENT2

else # not DEBIAN
TARGETS= libinstall srcinstall
endif  # DEBIAN

ifdef LIBSHOW_REAL_INSTALL
TARGETS += real-install
endif


real-install:
	for dir in $(DIRS); do\
	  if [ -f $$dir/dependencies ]; then \
	    cd $$dir && $(MAKE) real-install && cd ..;\
	  fi \
	done

install: $(TARGETS)

uninstall: libuninstall
	rm -rf $(SRC_INST)

showall:
	mkdir -p lib bin
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) && cd ..;\
        done

showclean:
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) clean && cd ..;\
        done

showsuperclean:
	for dir in $(DIRS); do\
	  cd $$dir && $(MAKE) superclean && cd ..;\
        done

libinstall:
	for dir in $(DIRS); do\
	  if [ -f $$dir/dependencies ]; then \
	    cd $$dir && $(MAKE) install && cd ..;\
	  fi \
	done

libuninstall:
	for dir in $(DIRS); do\
	  if [ -f $$dir/dependencies ]; then \
	    cd $$dir && $(MAKE) uninstall && cd ..;\
	  fi \
	done

srcinstall:
	mkdir -p $(SRC_INST)
	mkdir -p $(SRC_INST)/src
	mkdir -p $(SRC_INST)/lib
	mkdir -p $(SRC_INST)/bin
	cp Makefile $(SRC_INST)/
	cp src/*cpp $(SRC_INST)/src/
	cp src/*h $(SRC_INST)/src/
	cp src/Makefile.standalone $(SRC_INST)/src/Makefile


.PHONY: all clean superclean install libinstall real-install \
	showall showclean showsuperclean srcinstall distclean \
	libuninstall


# prevent the make program from choking on all the symbols
# that get generated from autogenerated make rules
.NOEXPORT:
