#
# Copyright (c) 2007 Aconex.  All Rights Reserved.
#
ifndef _BUILDRULES_INCLUDED_
_BUILDRULES_INCLUDED_ = 1

include $(TOPDIR)/src/include/builddefs

clean clobber : $(SUBDIRS)
	@rm -f $(DIRT)
	@rm -fr $(DIRDIRT)
	$(SUBDIRS_MAKERULE)

# Never blow away subdirs
ifdef SUBDIRS
.PRECIOUS: $(SUBDIRS)
$(SUBDIRS):
	$(SUBDIRS_MAKERULE)
endif

#
# Standard targets
#

ifeq ($(PKG_PLATFORM),darwin)
PLATFORM_BUILD = xcodebuild -configuration Debug
BINARY =  build/Debug/$(COMMAND).app/Contents/MacOS/$(COMMAND)
LNMAKE = test ! -f $(BINARY) -o -L $(COMMAND) || $(LN_S) $(BINARY) $(COMMAND)
WINDOW = mac
else
PLATFORM_BUILD = $(MAKE) -f Makefile
BINARY =  $(COMMAND)
LNMAKE =
WINDOW = x11
endif

QTMAKE = $(QMAKE) && $(PLATFORM_BUILD)

ifdef ICONLINKS
iconlinks:
	@for l in $(ICONLINKS) ; do \
	    if [ ! -L $$l ] ; then \
		$(LN_S) $(TOPDIR)/images/$$l $$l ; \
	    fi \
	done
endif

ifdef WINDOWLINKS
windowlinks:
	@for l in $(WINDOWLINKS) ; do \
	    if [ ! -L $$l ] ; then \
		$(LN_S) $(WINDOW)_$$l $$l ; \
	    fi \
	done
endif

source :
	$(SOURCE_MAKERULE)

endif # _BUILDRULES_INCLUDED_

$(_FORCE):

.PHONY : depend
