Files
mercury/profiler/Mmakefile
Fergus Henderson 7ebc79e927 Fix some problems with the `--use-subdirs' option.
Estimated hours taken: 6

Fix some problems with the `--use-subdirs' option.
The compiler itself now compiles and bootstraps fine with --use-subdirs.

compiler/modules.m:
	Put `.h' files in the source directory, rather than
	in the `Mercury/hs' subdirectory.

compiler/mercury_compile.m:
scripts/Mmake.rules:
	If `--use-subdirs' is enabled, pass `-I.' to the C compiler,
	so that #include statements work relative to the source directory
	rather than relative to the `Mercury/cs' subdirectory.

scripts/Mmake.vars.in:
	Define $(cs_subdir), $(os_subdir) etc. variables;
	these are set to the directory to use for .c, .o, etc. files,
	(including the trailing `/'), or to the empty string,
	if --use-subdirs is not set.

scripts/Mmake.rules:
	Use $(cs_subdir), $(os_subdir) etc. to avoid the code
	duplication created by my previous change to handle
	--use-subdirs.
	Also add lots of comments, and reorder the code
	in a more logical order.

Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
	Use $(cs_subdir), $(os_subdir) etc. to fix a few hard-coded
	file-names (e.g. *.dep, *_init.[co], tree234.o) that were
	used in some of the rules.

library/Mmakefile:
	Add `rm -f tags' to the rule for `mmake realclean'.

tools/bootcheck:
	Add `--use-subdirs' option (defaults to setting of the
	MMAKE_USE_SUBDIRS environment variable).
	Change the code which compares the stage2 & stage3 C files
	to use the appropriate location for them based on the
	setting of this option.
1998-03-20 02:58:33 +00:00

109 lines
3.6 KiB
Plaintext

#-----------------------------------------------------------------------------#
# Copyright (C) 1995-1998 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public Licence - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#
# Mmake - this is Mmake file for building the Mercury profiler
MERCURY_DIR=..
include $(MERCURY_DIR)/Mmake.common
MAIN_TARGET=mercury_profile
VPATH=$(LIBRARY_DIR)
#-----------------------------------------------------------------------------#
# Specify which compilers to use to compile the compiler.
# Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params
MCD = MERCURY_INT_DIR=. $(MC) --generate-dependencies
MCI = MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --make-interface
MCG = MERCURY_C_INCL_DIR=$(RUNTIME_DIR) \
MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --compile-to-c
MCS = MERCURY_C_INCL_DIR=$(RUNTIME_DIR) \
MERCURY_INT_DIR=$(LIBRARY_DIR) $(MC) --split-c-files -c
MGNUC = MERCURY_C_INCL_DIR=$(RUNTIME_DIR) $(SCRIPTS_DIR)/mgnuc
MGNUCFLAGS = $(EXTRA_MGNUCFLAGS) -I$(BOEHM_GC_DIR) $(EXTRA_CFLAGS)
C2INIT = \
MERCURY_MOD_LIB_MODS="$(RUNTIME_DIR)/runtime.init $(LIBRARY_DIR)/libmercury.init" \
MERCURY_MKINIT=$(UTIL_DIR)/mkinit $(SCRIPTS_DIR)/c2init
ML = MERCURY_C_LIB_DIR=. $(SCRIPTS_DIR)/ml
MLFLAGS = --mercury-libs none $(EXTRA_MLFLAGS)
MLLIBS = $(EXTRA_MLLIBS) $(LIBRARY_DIR)/libmercury.a \
$(RUNTIME_DIR)/libmer.a ` \
case $(GRADE) in \
*.gc*.prof*) echo $(BOEHM_GC_DIR)/libgc_prof.a ;; \
*.gc*) echo $(BOEHM_GC_DIR)/libgc.a ;; \
esac \
` -lm
MSL = MERCURY_SP_LIB_DIR=$(LIBRARY_DIR) $(SCRIPTS_DIR)/msl
MNLFLAGS = -u 6000
MTAGS = $(SCRIPTS_DIR)/mtags
#-----------------------------------------------------------------------------#
.PHONY: depend
depend : mercury_profile.depend
.PHONY: all
all : mercury_profile
#-----------------------------------------------------------------------------#
# Add some additional dependencies, so that Mmake knows to remake the
# profiler if one of the libraries changes.
mercury_profile: $(RUNTIME_DIR)/libmer.a $(LIBRARY_DIR)/libmercury.a
# Should also depend on $(BOEHM_GC_DIR)/libgc(_prof).a, but only
# if in .gc(.prof) grade; GNU make does not support dynamic dependencies,
# so just leave it out.
$(cs_subdir)mercury_profile_init.c: $(UTIL_DIR)/mkinit
#-----------------------------------------------------------------------------#
.PHONY: check
check : mercury_profile.check
.PHONY: ints
ints : mercury_profile.ints
#-----------------------------------------------------------------------------#
tags : $(MTAGS) $(mercury_profile.ms) $(LIBRARY_DIR)/*.m
$(MTAGS) $(mercury_profile.ms) $(LIBRARY_DIR)/*.m
#-----------------------------------------------------------------------------#
.PHONY: dates
dates :
touch $(mercury_profile.dates)
#-----------------------------------------------------------------------------#
.PHONY: os cs
os: $(mercury_profile.os) $(os_subdir)mercury_profile_init.o
cs: $(mercury_profile.cs) $(cs_subdir)mercury_profile_init.c
#-----------------------------------------------------------------------------#
realclean:
rm -f tags
#-----------------------------------------------------------------------------#
# Installation targets
.PHONY: install
install: install_profiler
.PHONY: install_profiler
install_profiler: mercury_profile
-[ -d $(INSTALL_MERC_BIN_DIR) ] || mkdir -p $(INSTALL_MERC_BIN_DIR)
cp `vpath_find mercury_profile` $(INSTALL_MERC_BIN_DIR)
#-----------------------------------------------------------------------------#