#-----------------------------------------------------------------------------#

# Mmake - Mmake file for Hans Boehm's conservative garbage collector.

MAIN_TARGET=libgc

MERCURY_DIR=..
include ../Mmake.common

#-----------------------------------------------------------------------------#

.PHONY: libgc
libgc: submake

libgc.a: submake

libgc.so: submake

	# We need to export MAKEFLAGS="" to avoid passing the `-r' (suppress
	# builtin rules) supplied by Mmake to the boehm_gc Makefile, which
	# needs the builtin rules. 
	# We don't use `unset', since the Ultrix /bin/sh doesn't have `unset'.
submake: force
	MAKEFLAGS=""; export MAKEFLAGS; \
	$(MAKE) $(MMAKEFLAGS) libgc.a libgc.$(SO)

.PHONY: force
force:

#-----------------------------------------------------------------------------#

# installation rules

.PHONY: install
install: install_headers install_lib

.PHONY: install_headers
install_headers: gc.h
	-[ -d $(INSTALL_INC_DIR) ] || mkdir -p $(INSTALL_INC_DIR)/machdeps
	cp `vpath_find gc.h` $(INSTALL_INC_DIR)

.PHONY: install_lib
install_lib: libgc.a libgc.$(SO)
	-[ -d $(INSTALL_MERC_GC_LIB_DIR) ] || \
		mkdir -p $(INSTALL_MERC_GC_LIB_DIR)
	cp `vpath_find libgc.a libgc.$(SO)` $(INSTALL_MERC_GC_LIB_DIR)

#-----------------------------------------------------------------------------#
