
# Makefile targets that can be made before running ./configure

###############################################################################
# show make targets
#
.PHONY: help
help:
	@echo ""
	@echo ""
	@echo "In addition to the standard make targets (all, install, clean, ...), "
	@echo "the following make targets may be supported (at this level):"
	@echo ""
	@echo "    make help        - print this text"
	@echo "    make DIST        - dist + a Makefile that calls ./configure"
	@echo "    make DOXY        - create Doxygen documentation"
	@echo "    make RPM         - create (source and binary) RPMs"
	@echo "    make DEB         - create Debian packages"
	@echo ""
	@echo "    make SVNUP       - update from SVN and ./configure"
	@echo ""
	@echo "NOTE: The RPM and DEB targets may fail because they require additional tools" 
	@echo "that may not be present on your machine. Don't worry if that happens, unless"
	@echo "you really need the RPM and/or Debian packages."
	@echo ""
	@echo "The following targets are shortcuts for lazy developers (like the GNU APL "
	@echo "author) and are not very useful for normal users:"
	@echo ""
	@echo "    make develop     - enable full dependency tracking"
	@echo "    make gprof       - make develop + enable gprof profiling"
	@echo "    make python      - make develop + build python module"
	@echo "    make parallel    - enable multi-core APL (buggy and experimental!)"
	@echo "    make parallel1   - make parallel for benchmarking"
	@echo "    make VPATH_clean - prepare for VPATH build"
	@echo ""

###############################################################################
# a shortcut to ./configure for developing and troubleshooting
#
.PHONY: develop
develop:
	CXXFLAGS="-fstrict-aliasing -rdynamic -gdwarf-2" \
        ./configure  --enable-maintainer-mode        \
                     DEVELOP_WANTED=yes              \
                     CXX_WERROR=yes
	make all

###############################################################################
# a shortcut to ./configure for compiling the python library
#
.PHONY: python
python:
	./configure  --enable-maintainer-mode DEVELOP_WANTED=yes --with-python
	make all


###############################################################################
# a shortcut to ./configure for profiling using gprof
#
# running apl (in e.g. src) will then produce a file gmon.out which can then be
# analyzed with gprof apl gmon.out
#
.PHONY: gprof
gprof:
	./configure  --enable-maintainer-mode        \
                 PERFORMANCE_COUNTERS_WANTED=yes \
                 GPROF_WANTED=yes
	make all

###############################################################################
# a shortcut to ./configure for devloping and troubleshooting libapl
#
.PHONY: develop_lib
develop_lib:
	./configure  --enable-maintainer-mode DEVELOP_WANTED=yes --with-libapl
	make all

# a shortcut to configure for benchmarking parallel execution
#
.PHONY: parallel
parallel:
	./configure --enable-maintainer-mode            \
                    VALUE_CHECK_WANTED=no               \
                    VALUE_HISTORY_WANTED=no             \
                    PERFORMANCE_COUNTERS_WANTED=no      \
                    DYNAMIC_LOG_WANTED=yes              \
                    ASSERT_LEVEL_WANTED=0               \
                    CORE_COUNT_WANTED=-3
	make all

# a shortcut to configure for benchmarking parallel execution but with
# performance counters
#
.PHONY: parallel1
parallel1:
	./configure --enable-maintainer-mode            \
                    VALUE_CHECK_WANTED=no               \
                    VALUE_HISTORY_WANTED=no             \
                    PERFORMANCE_COUNTERS_WANTED=yes     \
                    DYNAMIC_LOG_WANTED=yes              \
                    ASSERT_LEVEL_WANTED=0               \
                    CORE_COUNT_WANTED=-3
	make all

.PHONY: VPATH_clean
VPATH_clean: clean
	echo "Making VPATH_clean..."
	rm -f config.status config.h
	make make distclean || true
	echo "Done VPATH_clean..."

