# Makefile for libsystem entire directory
#
#   very top libsystem 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/libsystem

ALLTARG=
ifndef BASIC
ALLTARG=systemall
endif

#################### PLATFORM DEFINITIONS ############
all: $(ALLTARG)


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

clean: systemclean

superclean: systemsuperclean

distclean: systemdistclean

LIBINST=
ifndef BASIC
LIBINST=libinstall
endif

TARGETS=

ifdef DEBIAN
 ifeq "$(PACKAGE)" "DEVELOPER"
TARGETS= $(LIBINST) srcinstall
 endif # DEVELOPER

 ifeq "$(PACKAGE)" "SERVER"
TARGETS= $(LIBINST)
 endif # SERVER

 ifeq "$(PACKAGE)" "USER"
TARGETS= $(LIBINST)
 endif # SERVER

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

else # not DEBIAN
TARGETS= $(LIBINST) srcinstall
endif  # DEBIAN

real-install: $(TARGETS)
	for dir in $(DIRS); do\
          cd $$dir && $(MAKE) real-install && cd ..;\
        done

install: $(TARGETS)

uninstall: libuninstall
	rm -rf $(SRC_INST)

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

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

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

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

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

libuninstall:
	for dir in $(DIRS); do\
          cd $$dir && $(MAKE) uninstall && cd ..;\
        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/*c $(SRC_INST)/src/
	cp src/*h $(SRC_INST)/src/
	cp src/Makefile $(SRC_INST)/src/


.PHONY: all clean superclean install libinstall real-install \
	systemall systemclean systemsuperclean srcinstall \
	distclean systemdistclean libuninstall


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