#-----------------------------------------------------------------------------#
# Copyright (C) 1995-1997 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#

# Mmake - Mmake file for the Mercury utilities directory

MAIN_TARGET=all

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

MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common

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

MGNUC   = MERCURY_C_INCL_DIR=$(RUNTIME_DIR) $(SCRIPTS_DIR)/mgnuc
CFLAGS	= -I$(RUNTIME_DIR) $(EXTRA_CFLAGS)
# we need -I ../runtime for "getopt.h"

PROGS=mkinit mdemangle

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

all: $(PROGS)

.c:
	$(MGNUC) --grade $(GRADE) $(CFLAGS) -o $@ $<

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

.PHONY: install
install: $(PROGS)
	[ -d $(INSTALL_BINDIR) ] || mkdir -p $(INSTALL_BINDIR)
	cp `vpath_find $(PROGS)` $(INSTALL_BINDIR)

.PHONY: uninstall
uninstall:
	-cd $(INSTALL_BINDIR) && rm $(PROGS)

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

realclean:
	-rm -f $(PROGS)

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