Permalink
Browse files

Remove the RM_C mmake variable, which controlled whether the intermed…

…iate

Estimated hours taken: 0.5
Branches: main

Remove the RM_C mmake variable, which controlled whether the intermediate
`.c' files were removed (now they never are).

The implementation was buggy (it didn't work with parallel makes), and
made it difficult to avoid always recompiling the `.c' file with smart
recompilation.

Mmake.common.in:
configure.in:
README.AIX:
bindist/bindist.build_vars.in:
bindist/bindist.configure.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
compiler/modules.m:
tools/bootcheck:
tools/binary_step:
*/Mmakefile:
	Remove references to RM_C, DEFAULT_RM_C and LIBRARY_RM_C.

compiler/modules.m:
	The `.o' and `.pic_o' file now depends only on the `.c' file,
	not on everthing the `.c' file depends on. The extra dependencies
	were only needed because the intermediate `.c' file could
	be removed by RM_C. This change is needed to avoid recompiling
	unchanged `.c' files with smart recompilation.
  • Loading branch information...
1 parent 9ad41dc commit 319df48866dc78f8a14cf09a9503a6d9d869fa55 Simon Taylor committed May 18, 2001
View
@@ -51,13 +51,6 @@ CFLAGS_FOR_PIC = @CFLAGS_FOR_PIC@
# just reuse the .o files.
EXT_FOR_PIC_OBJECTS = @EXT_FOR_PIC_OBJECTS@
-# Set LIBRARY_RM_C as `:' if EXT_FOR_PIC_OBJECTS is `pic_o', or `rm'
-# otherwise. This is used to ensure that in cases when we're building
-# both `.o' and `.pic_o' files, we don't remove the intermediate `.c' files.
-# This avoids compiling things to C twice, and also avoids problems when
-# bootstrapping from the source distribution.
-LIBRARY_RM_C = @LIBRARY_RM_C@
-
# This specifies the path to the so_locations file (or its equivalent),
# which is used by the linker to help it to map different shared objects
# to different virtual memory addresses at static link time, so as to avoid
View
@@ -21,14 +21,7 @@ in resolving them.
This works around a fixed limit on the size of the TOC (Table of Contents)
in the RS/6000 object file format.
-2. Also add the following line to Mmake.params:
-
- RM_C=:
-
- This prevents the intermediate C files from being removed,
- which will make it easier to debug things later.
-
-3. Follow the instructions in the INSTALL file.
+2. Follow the instructions in the INSTALL file.
The last version of Mercury which was known to work on AIX was
Mercury 0.6 -- actually a version just prior to 0.6, namely
@@ -39,7 +32,7 @@ For that version, following the steps above would result in
an error message from the assembler, so the following additional
step was needed.
-4. Change directory to the `compiler' directory, and run the command
+3. Change directory to the `compiler' directory, and run the command
sh ../scripts/rs6000_hack
@@ -33,7 +33,6 @@ CFLAGS_FOR_PIC="@CFLAGS_FOR_PIC@"
SHARED_LIBS='@SHARED_LIBS@'
SHARED_LIBS_SH='@SHARED_LIBS_SH@'
HAVE_DELAY_SLOT="@HAVE_DELAY_SLOT@"
-DEFAULT_RM_C="@DEFAULT_RM_C@"
ERROR_UNDEFINED="@ERROR_UNDEFINED@"
ALLOW_UNDEFINED="@ALLOW_UNDEFINED@"
DL_LIBRARY="@DL_LIBRARY@"
@@ -61,7 +61,6 @@ AC_SUBST(EXT_FOR_PIC_OBJECTS)
AC_SUBST(EXT_FOR_SHARED_LIB)
AC_SUBST(SHARED_LIBS)
AC_SUBST(HAVE_DELAY_SLOT)
-AC_SUBST(DEFAULT_RM_C)
AC_SUBST(ALLOW_UNDEFINED)
AC_SUBST(ERROR_UNDEFINED)
AC_SUBST(DL_LIBRARY)
View
@@ -24,12 +24,6 @@ VPATH=$(LIBRARY_DIR)
#-----------------------------------------------------------------------------#
-# If we're going to generate both `.o' files and `.pic_o' files, then
-# don't remove the intermediate `.c' files.
-RM_C = $(LIBRARY_RM_C)
-
-#-----------------------------------------------------------------------------#
-
# Specify which compilers to use to compile the library.
# Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params.
View
@@ -1710,8 +1710,6 @@
AsmFileName, " ",
PicAsmFileName, " ",
ErrFileName, " ",
- PicObjFileName, " ",
- ObjFileName, " ",
SplitObjPattern, " ",
RLOFileName, " ",
ILFileName, " : ",
@@ -1745,8 +1743,6 @@
CFileName, " ",
TransOptDateFileName, " ",
ErrFileName, " ",
- PicObjFileName, " ",
- ObjFileName, " ",
SplitObjPattern, " :"
]),
@@ -1775,8 +1771,6 @@
"\n\n",
CFileName, " ",
ErrFileName, " ",
- PicObjFileName, " ",
- ObjFileName, " ",
SplitObjPattern, " :"
]),
write_dependencies_list(TransOptDeps,
@@ -1931,28 +1925,6 @@
"\trm -f ", CFileName, "\n",
"\t$(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) ",
"$< > ", ErrFileName, " 2>&1\n",
- "ifneq ($(RM_C),:)\n",
- ObjFileName, " : ", SourceFileName, "\n",
- "\t$(MMAKE_MAKE_CMD) $(MFLAGS) ",
- "MC=""$(MC)"" ",
- "ALL_MCFLAGS=""$(ALL_MCFLAGS)"" ",
- "ALL_GRADEFLAGS=""$(ALL_GRADEFLAGS)"" ",
- CFileName, "\n",
- "\t$(MGNUC) $(ALL_GRADEFLAGS) ",
- "$(ALL_MGNUCFLAGS) -c ", CFileName,
- " -o $@\n",
- "\t$(RM_C) ", CFileName, "\n",
- PicObjFileName, " : ", SourceFileName, "\n",
- "\t$(MMAKE_MAKE_CMD) $(MFLAGS) ",
- "MC=""$(MC)"" ",
- "ALL_MCFLAGS=""$(ALL_MCFLAGS)"" ",
- "ALL_GRADEFLAGS=""$(ALL_GRADEFLAGS)"" ",
- CFileName, "\n",
- "\t$(MGNUC) $(ALL_GRADEFLAGS) ",
- "$(ALL_MGNUCFLAGS) $(CFLAGS_FOR_PIC) ",
- "\\\n",
- "\t\t-c ", CFileName, " -o $@\n",
- "endif # RM_C != :\n",
"ifeq ($(TARGET_ASM),yes)\n",
AsmFileName, " : ", SourceFileName, "\n",
"\trm -f ", AsmFileName, "\n",
@@ -2754,6 +2726,24 @@
write_extra_link_dependencies_list(ExtraLinkObjs, ".$O", DepStream),
io__write_string(DepStream, "\n"),
+ %
+ % $(foo.cs_or_ss) contains the names of the generated intermediate
+ % files between `.m' and `.o' files. This is used in foo.dep
+ % to make sure the intermediate files are generated before the
+ % object files, so that errors are reported as soon as possible.
+ %
+ % If TARGET_ASM=yes, we define $(foo.cs_or_ss) to be $(foo.ss),
+ % otherwise it is defined to be $(foo.cs).
+ %
+ io__write_strings(DepStream, [
+ "ifeq ($(TARGET_ASM),yes)\n",
+ MakeVarName, ".cs_or_ss =$(", MakeVarName, ".ss)\n",
+ "else\n",
+ MakeVarName, ".cs_or_ss =$(", MakeVarName, ".cs)\n",
+ "endif\n\n"
+ ]),
+
+
io__write_string(DepStream, MakeVarName),
io__write_string(DepStream, ".rlos = "),
write_compact_dependencies_list(Modules, "$(rlos_subdir)", ".rlo",
@@ -2992,35 +2982,14 @@
% rather than first spending time compiling C files to .$O,
% which could be a waste of time if the program contains errors.
%
- % But we can only do this if we don't remove the .c files,
- % i.e. if RM_C=:
- % So we define $(foo.maybe_cs) here and use it in the rules below.
- % This needs to be defined here in the .dep file rather than
- % in the .dv file since it depends on the setting of the $(RM_C) file
- % which can be overridden by the user's Mmakefile.
- %
% When compiling to assembler, we want to do the same kind of
% thing, for the same reason, but with the `.s' files rather
- % than the `.c' files. So if TARGET_ASM=yes, we define
- % $(foo.maybe_cs) to be $(foo.ss).
- % XXX The name `.maybe_cs' is a bit misleading in this case.
- % Perhaps we should change it.
+ % than the `.c' files.
%
- module_name_to_file_name(SourceModuleName, "", no, ExeFileName),
- io__write_strings(DepStream, [
- "ifeq ($(TARGET_ASM),yes)\n",
- MakeVarName, ".maybe_cs=$(", MakeVarName, ".ss)\n",
- "else\n",
- " ifeq ($(RM_C),:)\n",
- MakeVarName, ".maybe_cs=$(", MakeVarName, ".cs)\n",
- " else\n",
- MakeVarName, ".maybe_cs=\n",
- " endif\n\n",
- "endif\n\n"
- ]),
+ module_name_to_file_name(SourceModuleName, "", no, ExeFileName),
io__write_strings(DepStream, [
- ExeFileName, " : $(", MakeVarName, ".maybe_cs) ",
+ ExeFileName, " : $(", MakeVarName, ".cs_or_ss) ",
"$(", MakeVarName, ".os) ",
InitObjFileName, " $(MLOBJS) ", All_MLLibsDepString,
"\n",
@@ -3084,7 +3053,7 @@
]),
io__write_strings(DepStream, [
- SharedLibFileName, " : $(", MakeVarName, ".maybe_cs) ",
+ SharedLibFileName, " : $(", MakeVarName, ".cs_or_ss) ",
"$(", MakeVarName, ".pic_os) ",
"$(MLPICOBJS) ", All_MLLibsDepString, "\n",
"\t$(ML) --make-shared-lib $(ALL_GRADEFLAGS) $(ALL_MLFLAGS) ",
@@ -3094,7 +3063,7 @@
]),
io__write_strings(DepStream, [
- LibFileName, " : $(", MakeVarName, ".maybe_cs) ",
+ LibFileName, " : $(", MakeVarName, ".cs_or_ss) ",
"$(", MakeVarName, ".os) $(MLOBJS)\n",
"\trm -f ", LibFileName, "\n",
"\t$(AR) $(ALL_ARFLAGS) $(AR_LIBFILE_OPT)", LibFileName, " ",
View
@@ -2412,33 +2412,6 @@ case "$host" in
;;
esac
-#
-# This sets the default value of RM_C, which should be either `rm' to
-# remove the intermediate C files, or `:' to keep them.
-#
-# If RM_C is set to `rm', then unfortunately Mmake needs to invoke
-# make recursively, and this causes several problems:
-# (1) it causes performance problems, particularly on MS-Windows
-# (2) it can break parallel makes, because there are race
-# conditions involved when you invoke make recursively
-# in a parallel make
-#
-# Therefore by default we currently keep the intermediate C files.
-#
-DEFAULT_RM_C=:
-
-case $EXT_FOR_PIC_OBJECTS in
- o)
- LIBRARY_RM_C=$DEFAULT_RM_C
- ;;
- *)
- # If we're going to be building both `.pic_o' files
- # and `.o' files, then we should not remove the generated `.c'
- # files in the library directory after building the `.o' files.
- LIBRARY_RM_C=:
- ;;
-esac
-
#-----------------------------------------------------------------------------#
case "$host" in
@@ -2467,8 +2440,6 @@ AC_SUBST(EXT_FOR_EXE)
AC_SUBST(USE_DLLS)
AC_SUBST(SHARED_LIBS)
AC_SUBST(SHARED_LIBS_SH)
-AC_SUBST(DEFAULT_RM_C)
-AC_SUBST(LIBRARY_RM_C)
if test $USE_DLLS = "yes"; then
AC_DEFINE(USE_DLLS)
fi
@@ -1,6 +1,4 @@
-#RM_C=:
-
MAIN_TARGET = all
MLOBJS = togl.o
@@ -6,8 +6,6 @@ main_target: check
# This file is copied from the Mercury tests repository
include ./Mmake.common
-
-RM_C=:
#-----------------------------------------------------------------------------#
MORPHINE = ../scripts/morphine --no-banner
@@ -7,7 +7,6 @@
GRADEFLAGS += --use-trail
# enable C debugging
-RM_C = :
MGNUCFLAGS = -g
MLFLAGS = -g
@@ -13,7 +13,6 @@ MCFLAGS = --infer-all
# Enable C debugging
CFLAGS=-g
-RM_C=:
MLFLAGS=-g
# Link in the trailed_update library from ..
@@ -12,7 +12,6 @@ GRADEFLAGS += --use-trail
MCFLAGS = --infer-all
MGNUCFLAGS=-g -I..
-RM_C=:
MLFLAGS=-g
# Link in the trailed_update library from ..
View
@@ -34,12 +34,6 @@ MCFLAGS-set_ordlist += $(TYPE_SPEC_FLAGS)
#-----------------------------------------------------------------------------#
-# If we're going to generate both `.$O' files and `.pic_o' files, then
-# don't remove the intermediate `.c' files.
-RM_C = $(LIBRARY_RM_C)
-
-#-----------------------------------------------------------------------------#
-
# Specify which options to use to compile the library.
# Don't change these without good reason - if you want to
# do a temporary change, change ../Mmake.params.
View
@@ -342,12 +342,6 @@ install_lib: lib$(RT_LIB_NAME).$A lib$(RT_LIB_NAME).$(EXT_FOR_SHARED_LIB) \
endif
-
-#-----------------------------------------------------------------------------#
-
-# prevent Mmake from removing C files
-RM_C=:
-
#-----------------------------------------------------------------------------#
clean_local: clean_o clean_check
@@ -28,5 +28,3 @@ clean_local:
rm -f c_main.o mercury_lib.h
#-----------------------------------------------------------------------------#
-
-RM_C=:
@@ -30,9 +30,6 @@ CXXFLAGS=-g
MGNUCFLAGS=-g
MLFLAGS=-g
-# tell Mmake not to remove the `.c' files, so we can look at them (e.g. in gdb)
-RM_C=:
-
# tell the Mercury linker to link in cpp_main.o and mercury_lib.o
MLLIBS=cpp_main.o mercury_lib.o
@@ -23,9 +23,6 @@ MGNUCFLAGS=-g
# not a main program
C2INITFLAGS=--library
-# keep the `.c' files around, for debugging
-RM_C=:
-
#-----------------------------------------------------------------------------#
c_main.o: mercury_lib.h c_main.c
@@ -35,9 +35,6 @@ MLFLAGS=-g
# not a main program
C2INITFLAGS=--library
-# tell Mmake not to remove the `.c' files, so we can look at them (e.g. in gdb)
-RM_C=:
-
OBJECTS = cpp_main.o mercury_lib_init.o $(mercury_lib.os)
#-----------------------------------------------------------------------------#
View
@@ -224,29 +224,6 @@ $(os_subdir)%.dll : %.il
$(MS_ILASM) $(ALL_MS_ILASMFLAGS) /dll /quiet /OUT=$@ $<
endif
-# If we are removing the .c files, we need to tell Make that we're
-# generating the .$O files directly from the .m files, but
-# in order to avoid remaking the .c files if they're already there,
-# we need to invoke mmake recursively for each .c file.
-# This can be pretty inefficient.
-
-ifneq ($(RM_C),:)
-
-$(os_subdir)%.$O : %.m
- $(MMAKE_MAKE_CMD) $(MFLAGS) MC="$(MC)" ALL_MCFLAGS="$(ALL_MCFLAGS)" \
- ALL_GRADEFLAGS="$(ALL_GRADEFLAGS)" $(cs_subdir)$*.c
- $(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS) -c $(cs_subdir)$*.c \
- $(OBJFILE_OPT)$@
- $(RM_C) $(cs_subdir)$*.c
-
-$(os_subdir)%.pic_o : %.m
- $(MMAKE_MAKE_CMD) $(MFLAGS) MC="$(MC)" ALL_MCFLAGS="$(ALL_MCFLAGS)" \
- ALL_GRADEFLAGS="$(ALL_GRADEFLAGS)" $(cs_subdir)$*.c
- $(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS) $(CFLAGS_FOR_PIC) \
- -c $(cs_subdir)$*.c $(OBJFILE_OPT)$@
-
-endif # RM_C != :
-
# For --split-c-files, we generate the .$O files directly from the .m files.
# (One reason for this is that there's no easy of telling Make how many
# `.$O' files it should make, since the number of them depends on what's
View
@@ -256,11 +256,6 @@ EXT_FOR_PIC_OBJECTS = @EXT_FOR_PIC_OBJECTS@
# shared libraries.
EXT_FOR_SHARED_LIB = @EXT_FOR_SHARED_LIB@
-# Set `RM_C' to `:' if you want to keep the intermediate `.c' files,
-# or to `rm' if you want Mmake to remove them. Beware that RM_C=rm
-# causes some potential race conditions if you use parallel make.
-RM_C = @DEFAULT_RM_C@
-
# lists of targets that depend on $(MLOBJS) and $(MLPICOBJS)
MLOBJS_DEPS =
MLPICOBJS_DEPS =
Oops, something went wrong.

0 comments on commit 319df48

Please sign in to comment.