mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-11 03:45:33 +00:00
Add the new builtin types: int64 and uint64.
Support for these new types will need to be bootstrapped over several changes.
This is the first such change and does the following:
- Extends the compiler to recognise 'int64' and 'uint64' as builtin types.
- Extends the set of builtin arithmetic, bitwise and relational operators
to cover the new types.
- Adds the new internal option '--unboxed-int64s' to the compiler; this will be
used to control whether 64-bit integer types are boxed or not.
- Extends all of the code generators to handle the new types.
- Extends the runtimes to support the new types.
- Adds new modules to the standard library intend to contain basic operations
on the new types. (These are currently empty and not documented.)
There are bunch of limitations marks with "XXX INT64"; these will be lifted in
part 2 of this change. Also, 64-bit integer types are currently always boxed,
again this limitation will be lifted in later changes.
compiler/options.m:
Add the new option --unboxed-int64s.
compiler/prog_type.m:
compiler/prog_data.m:
compiler/builtin_lib_types.m:
Recognise int64 and uint64 as builtin types.
compiler/builtin_ops.m:
Add builtin operations for the new types.
compiler/hlds_data.m:
Add new tag types for the new types.
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/export.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_name.m:
compiler/polymorphism.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/rtti.m:
compiler/table_gen.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the above changes to the parse tree and HLDS.
compiler/c_util.m:
Support writing out constants of the new types.
compiler/llds.m:
Add a representation for constants of the new types to the LLDS.
compiler/stack_layout.m:
Add a new field to the stack layout params that records whether
64-bit integers are boxed or not.
compiler/call_gen.:m
compiler/code_info.m:
compiler/disj_gen.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/llds_out_data.m:
compiler/llds_out_instr.m:
compiler/lookup_switch.m:
compiler/mercury_compile_llds_back_end.m:
compiler/prog_rep.m:
compiler/prog_rep_tables.m:
compiler/var_locn.m b/compiler/var_locn.m:
Support the new types in the LLDS code generator.
compiler/mlds.m:
Support constants of the new types in the MLDS.
compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_global_data.m:
compiler/ml_rename_classes.m:
compiler/ml_top_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/mlds_to_target_util.m:
compiler/rtti_to_mlds.m:
Conform to the above changes to the MLDS.
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
Generate the appropriate target code for constants of the new types
and operations involving them.
compiler/bytecode.m:
compiler/bytecode_gen.m:
Handle the new types in the bytecode generator; we just abort if we
encounter them for now.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_call_gen.m:
compiler/erl_code_util.m:
compiler/erl_unify_gen.m:
Handle the new types in the Erlang code generator.
library/private_builtin.m:
Add placeholders for the builtin unify and compare operations for
the new types. Since the bootstrapping compiler will not recognise
the new types we give them polymorphic arguments. These can be
replaced after this change has bootstrapped.
Update the Java list of TypeCtorRep constants here.
library/int64.m:
library/uint64.m:
New modules that will eventually contain builtin operations on the new
types.
library/library.m:
library/MODULES_UNDOC:
Do not include the above modules in the library documentation for now.
library/construct.m:
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
library/table_statistics.m:
deep_profiler/program_representation_utils.m:
mdbcomp/program_representation.m:
Handle the new types.
configure.ac:
runtime/mercury_conf.h.in:
Define the macro MR_BOXED_INT64S. For now it is always defined, support for
unboxed 64-bit integers will be enabled in a later change.
runtime/mercury_dotnet.cs.in:
java/runtime/TypeCtorRep.java:
runtime/mercury_type_info.h:
Update the list of type_ctor reps.
runtime/mercury.h:
runtime/mercury_int.[ch]:
Add macros for int64 / uint64 -> MR_Word conversion, boxing and
unboxing.
Add functions for hashing 64-bit integer types suitable for use
with the tabling mechanism.
runtime/mercury_tabling.[ch]:
Add additional HashTableSlot structs for 64-bit integer types.
Omit the '%' character from the conversion specifiers we pass via
the 'key_format' argument to the macros that generate the table lookup
function. This is so we can use the C99 exact size integer conversion
specifiers (e.g. PRIu64 etc.) directly here.
runtime/mercury_hash_lookup_or_add_body.h:
Add the '%' character that was omitted above to the call to debug_key_msg.
runtime/mercury_memory.h:
Add new builtin allocation sites for boxed 64-bit integer types.
runtime/mercury_builtin_types.[ch]:
runtime/mercury_builitn_types_proc_layouts.h:
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_tabling_preds.h:
runtime/mercury_term_size.c:
runtime/mercury_unify_compare_body.h:
Add the new builtin types and handle them throughout the runtime.
runtime/Mmakefile:
Add mercury_int.c to the list of .c files.
doc/reference_manual.texi:
Add the new types to the list of reserved type names.
Add the mapping from the new types to their target language types.
These are commented out for now.
519 lines
16 KiB
Makefile
519 lines
16 KiB
Makefile
#-----------------------------------------------------------------------------#
|
|
# vim: ts=8 sw=8 noexpandtab ft=make
|
|
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1998-2011 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.
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# This is the Mmakefile for the Mercury runtime library
|
|
|
|
MAIN_TARGET = all
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# All the headers in $(HDRS) should be syntactically well-formed
|
|
# header files, unlike the headers in $(BODY_HDRS).
|
|
# All the headers in $(HDRS) must also be in C (not C++).
|
|
|
|
# Note that $(LIB_GLOBALS_H) cannot be part of $(HDRS), since it depends on
|
|
# lib$(RT_LIB_NAME)$(DLL_DEF_LIB).$A, and $(OBJ): $(HDRS) would create a
|
|
# circular dependency. For similar but different reasons,
|
|
# $(LIB_DLL_H) also cannot be part of $(HDRS).
|
|
|
|
# Please keep this list in alphabetical order.
|
|
HDRS = \
|
|
mercury.h \
|
|
mercury_accurate_gc.h \
|
|
mercury_agc_debug.h \
|
|
mercury_array_macros.h \
|
|
mercury_atomic_ops.h \
|
|
mercury_backjump.h \
|
|
mercury_bitmap.h \
|
|
mercury_builtin_types.h \
|
|
mercury_builtin_types_proc_layouts.h \
|
|
mercury_calls.h \
|
|
mercury_complexity.h \
|
|
mercury_conf.h \
|
|
mercury_conf_param.h \
|
|
mercury_construct.h \
|
|
mercury_context.h \
|
|
mercury_debug.h \
|
|
mercury_deconstruct.h \
|
|
mercury_deconstruct_macros.h \
|
|
mercury_deep_copy.h \
|
|
mercury_deep_profiling.h \
|
|
mercury_deep_profiling_hand.h \
|
|
mercury_dlist.h \
|
|
mercury_dummy.h \
|
|
mercury_dword.h \
|
|
mercury_engine.h \
|
|
mercury_expanding_array.h \
|
|
mercury_file.h \
|
|
mercury_float.h \
|
|
mercury_getopt.h \
|
|
mercury_goto.h \
|
|
mercury_grade.h \
|
|
mercury_hash_table.h \
|
|
mercury_heap.h \
|
|
mercury_heap_profile.h \
|
|
mercury_hgc.h \
|
|
mercury_hlc_types.h \
|
|
mercury_ho_call.h \
|
|
mercury_int.h \
|
|
mercury_imp.h \
|
|
mercury_init.h \
|
|
mercury_label.h \
|
|
mercury_layout_util.h \
|
|
mercury_library_types.h \
|
|
mercury_memory.h \
|
|
mercury_memory_handlers.h \
|
|
mercury_memory_zones.h \
|
|
mercury_minimal_model.h \
|
|
mercury_misc.h \
|
|
mercury_mm_own_stacks.h \
|
|
mercury_overflow.h \
|
|
mercury_par_builtin.h \
|
|
mercury_proc_id.h \
|
|
mercury_prof.h \
|
|
mercury_prof_mem.h \
|
|
mercury_prof_time.h \
|
|
mercury_profiling_builtin.h \
|
|
mercury_reg_workarounds.h \
|
|
mercury_region.h \
|
|
mercury_regs.h \
|
|
mercury_runtime_util.h \
|
|
mercury_signal.h \
|
|
mercury_stack_layout.h \
|
|
mercury_stack_trace.h \
|
|
mercury_stacks.h \
|
|
mercury_std.h \
|
|
mercury_stm.h \
|
|
mercury_string.h \
|
|
mercury_tabling.h \
|
|
mercury_tabling_macros.h \
|
|
mercury_tags.h \
|
|
mercury_term_size.h \
|
|
mercury_thread.h \
|
|
mercury_threadscope.h \
|
|
mercury_timing.h \
|
|
mercury_trace_base.h \
|
|
mercury_trace_term.h \
|
|
mercury_trail.h \
|
|
mercury_type_desc.h \
|
|
mercury_type_info.h \
|
|
mercury_type_tables.h \
|
|
mercury_typeclass_info.h \
|
|
mercury_types.h \
|
|
mercury_univ.h \
|
|
mercury_windows.h \
|
|
mercury_wrapper.h \
|
|
mercury_wsdeque.h
|
|
|
|
# The headers in $(BODY_HDRS) contain code schemes included multiple times
|
|
# in one or more source files. Their dependencies must be explicitly listed.
|
|
# They do not have to be syntactically well-formed.
|
|
|
|
BODY_HDRS = \
|
|
mercury_deep_call_port_body.h \
|
|
mercury_deep_copy_body.h \
|
|
mercury_deep_leave_port_body.h \
|
|
mercury_deep_rec_depth_actions.h \
|
|
mercury_deep_rec_depth_body.h \
|
|
mercury_deep_redo_port_body.h \
|
|
mercury_exception_catch_body.h \
|
|
mercury_hand_compare_body.h \
|
|
mercury_hand_unify_body.h \
|
|
mercury_hash_lookup_or_add_body.h \
|
|
mercury_make_type_info_body.h \
|
|
mercury_ml_arg_body.h \
|
|
mercury_ml_deconstruct_body.h \
|
|
mercury_ml_expand_body.h \
|
|
mercury_ml_functor_body.h \
|
|
mercury_table_int_fix_index_body.h \
|
|
mercury_table_int_start_index_body.h \
|
|
mercury_table_typeinfo_body.h \
|
|
mercury_table_type_body.h \
|
|
mercury_tabling_preds.h \
|
|
mercury_tabling_stats_defs.h \
|
|
mercury_tabling_stats_nodefs.h \
|
|
mercury_tabling_stats_undefs.h \
|
|
mercury_unify_compare_body.h
|
|
|
|
MACHHDRS = \
|
|
machdeps/no_regs.h \
|
|
machdeps/alpha_regs.h \
|
|
machdeps/i386_regs.h \
|
|
machdeps/ia64_regs.h \
|
|
machdeps/mips_regs.h \
|
|
machdeps/pa_regs.h \
|
|
machdeps/rs6000_regs.h \
|
|
machdeps/arm_regs.h \
|
|
machdeps/sparc_regs.h \
|
|
machdeps/x86_64_regs.h
|
|
|
|
# Please keep this list in alphabetical order.
|
|
CFILES = \
|
|
mercury.c \
|
|
mercury_accurate_gc.c \
|
|
mercury_agc_debug.c \
|
|
mercury_atomic_ops.c \
|
|
mercury_backjump.c \
|
|
mercury_bitmap.c \
|
|
mercury_builtin_types.c \
|
|
mercury_construct.c \
|
|
mercury_context.c \
|
|
mercury_debug.c \
|
|
mercury_deconstruct.c \
|
|
mercury_deep_copy.c \
|
|
mercury_deep_profiling.c \
|
|
mercury_dlist.c \
|
|
mercury_dummy.c \
|
|
mercury_engine.c \
|
|
mercury_file.c \
|
|
mercury_float.c \
|
|
mercury_getopt.c \
|
|
mercury_getopt1.c \
|
|
mercury_grade.c \
|
|
mercury_hash_table.c \
|
|
mercury_heap_profile.c \
|
|
mercury_hgc.c \
|
|
mercury_ho_call.c \
|
|
mercury_int.c \
|
|
mercury_label.c \
|
|
mercury_layout_util.c \
|
|
mercury_memory.c \
|
|
mercury_memory_handlers.c \
|
|
mercury_memory_zones.c \
|
|
mercury_minimal_model.c \
|
|
mercury_misc.c \
|
|
mercury_mm_own_stacks.c \
|
|
mercury_overflow.c \
|
|
mercury_par_builtin.c \
|
|
mercury_prof.c \
|
|
mercury_prof_mem.c \
|
|
mercury_prof_time.c \
|
|
mercury_profiling_builtin.c \
|
|
mercury_reg_workarounds.c \
|
|
mercury_region.c \
|
|
mercury_regs.c \
|
|
mercury_runtime_util.c \
|
|
mercury_signal.c \
|
|
mercury_stack_layout.c \
|
|
mercury_stack_trace.c \
|
|
mercury_stacks.c \
|
|
mercury_stm.c \
|
|
mercury_string.c \
|
|
mercury_tabling.c \
|
|
mercury_term_size.c \
|
|
mercury_thread.c \
|
|
mercury_threadscope.c \
|
|
mercury_timing.c \
|
|
mercury_trace_base.c \
|
|
mercury_trace_term.c \
|
|
mercury_trail.c \
|
|
mercury_type_desc.c \
|
|
mercury_type_info.c \
|
|
mercury_type_tables.c \
|
|
mercury_wrapper.c \
|
|
mercury_wsdeque.c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
CHECK_HDRS = $(HDRS)
|
|
CHECK_MHDRS =
|
|
CHECK_OBJS = $(CFILES:.c=.$O)
|
|
ALLOW_LIB_PREFIX=no
|
|
ALLOW_BROWSER_PREFIX=no
|
|
ALLOW_MDBCOMP_PREFIX=no
|
|
ALLOW_SSDB_PREFIX=no
|
|
|
|
MERCURY_DIR=..
|
|
LINK_BOEHM_GC_ONLY=yes
|
|
include $(MERCURY_DIR)/Mmake.common
|
|
-include Mmake.runtime.params
|
|
|
|
# Avoid trying to make this file with `mmc --make' if it doesn't exist.
|
|
Mmake.runtime.params: ;
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
CFLAGS += $(DLL_CFLAGS)
|
|
|
|
# We intentionally compile with C level debugging enabled so that problems
|
|
# in the runtime can be debugged without having to recompile it. The cost
|
|
# of doing this is negligible. The runtime can be compiled without
|
|
# debugging enabled by removing the `--c-debug' flag below.
|
|
MGNUCFLAGS += --c-debug --no-ansi
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
OBJS = $(CFILES:.c=.$O)
|
|
PIC_OBJS = $(CFILES:.c=.$(EXT_FOR_PIC_OBJECTS))
|
|
|
|
LD_LIBFLAGS = -L$(BOEHM_GC_DIR) -L/usr/local/lib
|
|
LDLIBS = $(SHARED_GC_LIBS) $(MATH_LIB)
|
|
|
|
THREADLIBS = \
|
|
` case "$(GRADE)" in \
|
|
*.hlc.par*) echo $(THREAD_LIBS) ;; \
|
|
*.par*) echo "$(THREAD_LIBS) $(HWLOC_LIBS)" ;; \
|
|
esac \
|
|
`
|
|
|
|
CFLAGS += $(HWLOC_CFLAGS)
|
|
|
|
$(HDR_CHECK_OBJS): mercury_conf.h
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Stuff for Windows DLLs.
|
|
# This needs to come after the include of Mmake.common, which defines USE_DLLS.
|
|
|
|
ifeq ($(USE_DLLS),yes)
|
|
|
|
DLL_CFLAGS = -Dlib$(RT_LIB_NAME)_DEFINE_DLL
|
|
|
|
# the following header files are created automatically by Makefile.DLLs
|
|
LIB_DLL_H = lib$(RT_LIB_NAME)_dll.h
|
|
LIB_GLOBALS_H = lib$(RT_LIB_NAME)_globals.h
|
|
|
|
include $(MERCURY_DIR)/Makefile.DLLs
|
|
|
|
else
|
|
|
|
DLL_CFLAGS =
|
|
LIB_DLL_H =
|
|
LIB_GLOBALS_H =
|
|
DLL_DEF_LIB =
|
|
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
$(OBJS) $(PIC_OBJS): $(HDRS) $(MACHHDRS) $(LIB_DLL_H)
|
|
|
|
mercury_builtin_types.$(O): mercury_hand_unify_compare_body.h
|
|
mercury_builtin_types.(O): mercury_hand_unify_body.h mercury_hand_compare_body.h
|
|
mercury_deconstruct.$(O): mercury_ml_expand_body.h
|
|
mercury_deep_copy.$(O): mercury_deep_copy_body.h
|
|
mercury_type_info.$(O): mercury_make_type_info_body.h
|
|
mercury_ho_call.$(O): mercury_unify_compare_body.h
|
|
|
|
mercury_builtin_types.$(EXT_FOR_PIC_OBJECTS): mercury_hand_unify_compare_body.h
|
|
mercury_builtin_types.(EXT_FOR_PIC_OBJECTS): mercury_hand_unify_body.h mercury_hand_compare_body.h
|
|
mercury_deconstruct.$(EXT_FOR_PIC_OBJECTS): mercury_ml_expand_body.h
|
|
mercury_deep_copy.$(EXT_FOR_PIC_OBJECTS): mercury_deep_copy_body.h
|
|
mercury_type_info.$(EXT_FOR_PIC_OBJECTS): mercury_make_type_info_body.h
|
|
mercury_ho_call.$(EXT_FOR_PIC_OBJECTS): mercury_unify_compare_body.h
|
|
|
|
# These files depend on several of the files in $(BODY_HDRS), and it is
|
|
# easier to depend on them all than to specifically list only the ones
|
|
# that mercury_tabling.c actually includes.
|
|
mercury_tabling.$(O): $(BODY_HDRS)
|
|
mercury_tabling.$(EXT_FOR_PIC_OBJECTS): $(BODY_HDRS)
|
|
|
|
# ../tools/make_port_code makes both the .c and the .h file of the
|
|
# mercury_profiling_builtin module.
|
|
mercury_profiling_builtin.c: mercury_profiling_builtin.h
|
|
mercury_profiling_builtin.h: mercury_deep_call_port_body.h \
|
|
mercury_deep_redo_port_body.h \
|
|
mercury_deep_leave_port_body.h \
|
|
../tools/make_port_code
|
|
../tools/make_port_code
|
|
|
|
mercury_ho_call.$(O): mercury_ho_call_codes.i
|
|
mercury_ho_call.$(O): mercury_method_call_codes.i
|
|
mercury_ho_call.$(EXT_FOR_PIC_OBJECTS): mercury_ho_call_codes.i
|
|
mercury_ho_call.$(EXT_FOR_PIC_OBJECTS): mercury_method_call_codes.i
|
|
|
|
# ../tools/make_spec_ho_call generates mercury_ho_call_declares.i
|
|
# and mercury_ho_call_inits.i as side-effects.
|
|
# These seems to be no decent way to express that, and have it work correctly
|
|
# with parallel make.
|
|
mercury_ho_call_codes.i: ../tools/make_spec_ho_call
|
|
../tools/make_spec_ho_call > mercury_ho_call_codes.i
|
|
|
|
# ../tools/make_spec_method_call generates mercury_method_call_declares.i
|
|
# and mercury_method_call_inits.i as side-effects.
|
|
# These seems to be no decent way to express that, and have it work correctly
|
|
# with parallel make.
|
|
mercury_method_call_codes.i: ../tools/make_spec_method_call
|
|
../tools/make_spec_method_call > mercury_method_call_codes.i
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.PHONY: all
|
|
all: runtime $(TAGS_FILE_EXISTS)
|
|
|
|
ifneq "$(filter csharp% java% erlang%,$(GRADE))" ""
|
|
#
|
|
# For these grades, there's nothing to do.
|
|
|
|
.PHONY: runtime
|
|
runtime:
|
|
@echo "No Mercury runtime needed for GRADE=$(GRADE)"
|
|
|
|
else
|
|
|
|
.PHONY: runtime
|
|
runtime: lib$(RT_LIB_NAME).$A lib$(RT_LIB_NAME).$(EXT_FOR_SHARED_LIB)
|
|
runtime: $(RT_LIB_NAME).init
|
|
runtime: $(LIB_DLL_H) $(LIB_GLOBALS_H)
|
|
|
|
lib$(RT_LIB_NAME)$(DLL_DEF_LIB).$A: $(OBJS)
|
|
rm -f lib$(RT_LIB_NAME)$(DLL_DEF_LIB).$A
|
|
$(AR) $(ALL_ARFLAGS) \
|
|
$(AR_LIBFILE_OPT)lib$(RT_LIB_NAME)$(DLL_DEF_LIB).$A $(OBJS)
|
|
$(RANLIB) $(RANLIBFLAGS) lib$(RT_LIB_NAME)$(DLL_DEF_LIB).$A
|
|
|
|
lib$(RT_LIB_NAME).so: $(PIC_OBJS)
|
|
$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) $(LDFLAGS_FOR_SANITIZERS) \
|
|
-o lib$(RT_LIB_NAME).so $(PIC_OBJS) \
|
|
$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_GC_LIB_DIR) \
|
|
$(ALL_LD_LIBFLAGS) $(LDLIBS) $(THREADLIBS) \
|
|
$(SHARED_LIBS)
|
|
|
|
# For Darwin we should pass the -install_name option.
|
|
lib$(RT_LIB_NAME).dylib: $(PIC_OBJS)
|
|
$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED) $(LDFLAGS_FOR_SANITIZERS) \
|
|
-o lib$(RT_LIB_NAME).dylib $(PIC_OBJS) \
|
|
-install_name \
|
|
$(FINAL_INSTALL_MERC_LIB_DIR)/lib$(RT_LIB_NAME).dylib \
|
|
$(ALL_LD_LIBFLAGS) $(LDLIBS) $(THREADLIBS) \
|
|
$(SHARED_LIBS)
|
|
|
|
endif
|
|
|
|
$(RT_LIB_NAME).init: $(CFILES)
|
|
cat `vpath_find $(CFILES)` | grep '^INIT ' > $(RT_LIB_NAME).init
|
|
|
|
mercury_conf.h.date: $(MERCURY_DIR)/config.status mercury_conf.h.in
|
|
if test -f mercury_conf.h ; then \
|
|
mv mercury_conf.h mercury_conf.h.was ; fi
|
|
$(MERCURY_DIR)/config.status --header=mercury_conf.h
|
|
@mv mercury_conf.h mercury_conf.h.tmp
|
|
@sed -e '/Generated by configure/s:mercury_conf:runtime/mercury_conf:' \
|
|
< mercury_conf.h.tmp > mercury_conf.h
|
|
# Check to ensure there were no misspelt autoconf variable names.
|
|
if grep -n '[^$$]@' mercury_conf.h; then false; else true; fi
|
|
# Check if we need to update the file, and if yes, do so.
|
|
if test -f mercury_conf.h.was -a -f mercury_conf.h.date && \
|
|
cmp mercury_conf.h.was mercury_conf.h > /dev/null ; \
|
|
then mv mercury_conf.h.was mercury_conf.h ; \
|
|
fi
|
|
# Update the datestamp to show that mercury_conf.h is now current,
|
|
# even if its modification date is old.
|
|
echo datestamp > mercury_conf.h.date ;
|
|
@-rm -f mercury_conf.h.tmp mercury_conf.h.was
|
|
|
|
mercury_conf.h: mercury_conf.h.date
|
|
@true
|
|
|
|
.PHONY: cs
|
|
cs: $(CFILES)
|
|
|
|
.PHONY: tags
|
|
tags: $(CFILES) $(HDRS) $(BODY_HDRS) $(LIB_DLL_H)
|
|
ctags $(CFILES) $(HDRS) $(BODY_HDRS) $(LIB_DLL_H)
|
|
|
|
.PHONY: tags_file_exists
|
|
tags_file_exists:
|
|
@if test ! -f tags; then echo making tags; \
|
|
ctags $(CFILES) $(HDRS) $(BODY_HDRS) $(LIB_DLL_H); fi
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# installation rules
|
|
|
|
.PHONY: install
|
|
install: install_headers install_lib
|
|
|
|
.PHONY: install_dirs
|
|
install_dirs:
|
|
-[ -d $(INSTALL_INC_DIR)/machdeps ] || \
|
|
mkdir -p $(INSTALL_INC_DIR)/machdeps
|
|
-[ -d $(INSTALL_MODULE_DIR) ] || mkdir -p $(INSTALL_MODULE_DIR)
|
|
-[ -d $(INSTALL_GRADE_MODULE_DIR) ] || \
|
|
mkdir -p $(INSTALL_GRADE_MODULE_DIR)
|
|
-[ -d $(INSTALL_MERC_LIB_DIR) ] || mkdir -p $(INSTALL_MERC_LIB_DIR)
|
|
-[ -d $(INSTALL_CONF_DIR) ] || mkdir -p $(INSTALL_CONF_DIR)
|
|
-[ -d $(INSTALL_RECONF_DIR)/runtime ] || \
|
|
mkdir -p $(INSTALL_RECONF_DIR)/runtime
|
|
|
|
ifneq "$(filter csharp% java% erlang%,$(GRADE))" ""
|
|
|
|
# For non-C grades, the only thing that needs to be done is install the runtime
|
|
# headers (see the comment above the install_headers target for the rationale).
|
|
# The Java version of the Mercury runtime is in ../java/runtime not this
|
|
# directory and it is built and installed by ../library/Mmakefile.
|
|
# The C# version of the Mercury runtime *is* in this directory (in
|
|
# mercury_dotnet.cs.in), but it is included directly in the standard library
|
|
# assembly (mer_std.dll) by ../library/Mmakefile.
|
|
# The Erlang version of the Mercury runtime is in the library directory.
|
|
|
|
.PHONY: install_init
|
|
install_init:
|
|
|
|
.PHONY: install_lib
|
|
install_lib:
|
|
|
|
else
|
|
|
|
.PHONY: install_init
|
|
install_init: $(RT_LIB_NAME).init install_dirs
|
|
cp `vpath_find $(RT_LIB_NAME).init` $(INSTALL_GRADE_MODULE_DIR)
|
|
|
|
.PHONY: install_lib
|
|
install_lib: lib$(RT_LIB_NAME).$A lib$(RT_LIB_NAME).$(EXT_FOR_SHARED_LIB) \
|
|
install_dirs install_init
|
|
cp `vpath_find lib$(RT_LIB_NAME).$A \
|
|
lib$(RT_LIB_NAME).$(EXT_FOR_SHARED_LIB)` \
|
|
$(INSTALL_MERC_LIB_DIR)
|
|
$(RANLIB) $(RANLIBFLAGS) $(INSTALL_MERC_LIB_DIR)/lib$(RT_LIB_NAME).$A
|
|
|
|
endif
|
|
|
|
# NOTE: we install the header files for the C version of the Mercury runtime
|
|
# even in non-C grades. The reason for this is that they are *not* installed
|
|
# by the install_lib target used by the install_grades target in ../Mmakefile.
|
|
# If we don't install them as part of the main install target then they won't
|
|
# ever be installed and installations with non-C grade Mercury compilers that
|
|
# also install the library in C grades will be broken.
|
|
|
|
# mercury_conf.h needs to be in a separate directory so it can be overridden by
|
|
# a different configuration.
|
|
.PHONY: install_headers
|
|
install_headers: $(HDRS) $(BODY_HDRS) $(MACHHDRS) \
|
|
$(LIB_DLL_H) $(LIB_GLOBALS_H) install_dirs
|
|
cp `vpath_find $(HDRS) $(BODY_HDRS) $(LIB_DLL_H) $(LIB_GLOBALS_H)` \
|
|
$(INSTALL_INC_DIR)
|
|
rm -f $(INSTALL_INC_DIR)/mercury_conf.h
|
|
cp `vpath_find mercury_conf.h` $(INSTALL_CONF_DIR)
|
|
-chmod u+w $(INSTALL_CONF_DIR)/mercury_conf.h
|
|
cp `vpath_find mercury_conf.h.in` $(INSTALL_RECONF_DIR)/runtime
|
|
cp `vpath_find $(MACHHDRS)` $(INSTALL_INC_DIR)/machdeps
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
mercury_dotnet.cs: mercury_dotnet.cs.in
|
|
CONFIG_FILES=$@ CONFIG_HEADERS= $(MERCURY_DIR)/config.status
|
|
# check to ensure there were no misspelt autoconf variable names
|
|
if grep -n '[^$$]@.*@' $@; then false; else true; fi
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
clean_local: clean_o clean_check
|
|
|
|
.PHONY: clean_o
|
|
clean_o:
|
|
rm -f $(OBJS) $(PIC_OBJS)
|
|
|
|
.PHONY: realclean_local
|
|
realclean_local:
|
|
rm -f lib$(RT_LIB_NAME).$A lib$(RT_LIB_NAME).so $(RT_LIB_NAME).init
|
|
rm -f mercury_conf.h mercury_conf.h.date mercury_dotnet.cs
|
|
rm -f mercury_profiling_builtin.c mercury_profiling_builtin.h
|
|
|
|
#-----------------------------------------------------------------------------#
|