[m-rev.] diff: simplify compiler/Mmakefile

Julien Fischer jfischer at opturion.com
Fri Jan 18 02:59:46 AEDT 2013


Build system cleanups for the compiler.

main.c:
    Delete this - it was only ever needed for the GCC backend.

compiler/Mmakefile:
    Delete targets for building the compiler as a library --
    this was only required by the GCC backend.

    Don't link against ../main.o.

    Delete rules for preprocessing .pp files.
    We don't currently have any files that need to be preprocssed
    and this particular Mmakefile is complicated enough with
    additional clutter in it.

tools/bootcheck.m:
    Conform to the removal of main.c

    Don't set GCC_SRC_DIR in the stage 2 Mmake.params file.

Julien.

diff --git a/compiler/Mmakefile b/compiler/Mmakefile
index 68f8809..91f7174 100644
--- a/compiler/Mmakefile
+++ b/compiler/Mmakefile
@@ -42,8 +42,7 @@ VPATH = \
 MCFLAGS	     += --flags COMP_FLAGS $(CONFIG_OVERRIDE)

 ifeq ("$(filter il% csharp% java% erlang%,$(GRADE))","")
-MLOBJS       := ../main.$O \
-		../trace/lib$(EVENTSPEC_LIB_NAME).$A \
+MLOBJS       := ../trace/lib$(EVENTSPEC_LIB_NAME).$A \
 		$(MLOBJS)
 MLLIBS       += $(THREAD_LIBS)
 else
@@ -51,7 +50,7 @@ MLOBJS =
 endif

 ALL_MLLIBS    = $(MLLIBS) $(EXTRA_MLLIBS)
-MLFLAGS      += --no-main --shared
+MLFLAGS      += --shared
 C2INITARGS   += $(MDBCOMP_DIR)/$(MDBCOMP_LIB_NAME).init

 #
@@ -79,34 +78,6 @@ endif

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

-# Rules for preprocessing `.pp' files.
-# `.pp_date' files are used as timestamps as for interface files.
-
-#
-# Rule to generate foo.m from foo.pp by applying `sed $(PP_SED_EXPR)'
-#
-# Note that we set hash="#" for use in $(PP_SED_EXPR).
-# This seems to be the easiest way to get a "#" character;
-# we can't just use a Make variable since "#" is a comment character
-# in Make and so its hard to create a variable with that value.
-#
-$(dates_subdir)%.pp_date: %.pp
-	-hash="#"; \
-	m_file=$(<:.pp=.m); \
-	[ ! -f $$m_file ] || chmod +w $$m_file; \
-	sed $(PP_SED_EXPR) $< > $$m_file.tmp && \
-	mercury_update_interface -v $$m_file && \
-	touch $@ && \
-	chmod -w $$m_file
-
-#
-# Define $(PP_SED_EXPR) appropriately for each preprocessed module.
-#
-PP_SED_EXPR			= $(PP_SED_EXPR-$*)
-
-
-#-----------------------------------------------------------------------------#
-
 # targets

 # specify the name of the top-level module to build
@@ -132,9 +103,6 @@ all:		mercury $(TAGS_FILE_EXISTS)
 .PHONY: mercury
 mercury:	mercury_compile

-.PHONY: libmmc
-libmmc:		libmercury_compile.a mercury_compile_init.$O
-
 # The executable was previous known as `mercury_compile',
 # but now we generate it as `top_level'.  For compatibility with
 # various existing code, we make links to the old names.
@@ -156,16 +124,6 @@ ifeq ($(findstring il,$(GRADE)),il)
 	cp ../browser/*.dll .
 endif

-libmercury_compile.a: lib$(MC_PROG).a
-	rm -f libmercury_compile.a
-	cp lib$(MC_PROG).a libmercury_compile.a
-	ar d libmercury_compile.a main.o
-
-mercury_compile_init.$O: $(MC_PROG)_init.$O
-	rm -f mercury_compile_init.$O
-	$(LN) $(MC_PROG)_init.$O mercury_compile_init.$O || \
-		cp $(MC_PROG)_init.$O mercury_compile_init.$O
-
 #-----------------------------------------------------------------------------#

 # Tell the C# compiler where the stdlib and mdbcomp assemblies are.
@@ -187,7 +145,6 @@ CSCFLAGS=/lib
 %.il: opts
 else
 ifeq ("$(filter csharp% java% erlang%,$(GRADE))","")
-$(MC_PROG): ../main.$O
 $(MC_PROG): $(RUNTIME_DIR)/lib$(RT_LIB_NAME).$A
 $(MC_PROG): $(LIBRARY_DIR)/lib$(STD_LIB_NAME).$A
 $(MC_PROG): $(MDBCOMP_DIR)/lib$(MDBCOMP_LIB_NAME).$A
@@ -200,8 +157,6 @@ $(MC_PROG): $(TRACE_DIR)/lib$(EVENTSPEC_LIB_NAME).$A
 endif
 endif

-$(MC_PROG)_init.c: $(UTIL_DIR)/mkinit$(EXT_FOR_EXE)
-
 #-----------------------------------------------------------------------------#

 .PHONY: check
@@ -254,13 +209,11 @@ dates:
 ifneq ($(MMAKE_USE_MMC_MAKE),yes)
 os: $($(MC_PROG).os)
 cs: $($(MC_PROG).cs)
-ss: $($(MC_PROG).ss)
 ils: $($(MC_PROG).ils)
 opts: $($(MC_PROG).opts)
 else
 os: $(MC_PROG).os
 cs: $(MC_PROG).cs
-ss: $(MC_PROG).ss
 ils: $(MC_PROG).ils
 opts: $(MC_PROG).opts
 endif
diff --git a/main.c b/main.c
deleted file mode 100644
index d233139..0000000
--- a/main.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-** Copyright (C) 2000 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.
-*/
-
-/*
-** main.c
-**
-** This file defines the main() function for the `compiler/mercury_compile'
-** executable.  We define main() separately here,
-** because compiler/mercury_compile is built as a library;
-** this is necessary for the GCC back-end port, where the
-** mercury_compile library is linked together with the
-** GCC back-end into the `cc1mercury' program,
-** whose main() function is defined in gcc/toplev.c.
-**
-** The main() function here just calls mercury_main().
-** mercury_main() is defined in compiler/mercury_compile_init.c,
-** which is automatically generated (by scripts/c2init,
-** which invokes mkinit, whose source is in util/mkinit.c).
-** It initializes the Mercury runtime and then calls the
-** main/2 predicate, which is defined compiler/mercury_compile.m.
-**
-** For general information about the design of the Mercury compiler,
-** see compiler/notes/compiler_design.html.
-*/
-
-extern int mercury_main(int argc, char *argv[]);
-
-int
-main(int argc, char *argv[])
-{
-	return mercury_main(argc, argv);
-}
diff --git a/tools/bootcheck b/tools/bootcheck
index 6023bcf..829b8c2 100755
--- a/tools/bootcheck
+++ b/tools/bootcheck
@@ -658,7 +658,6 @@ then
         set +x
         echo linking stage 2... 1>&2
         cd $stage2dir
-        $LN_S $root/main.c .
         mkdir compiler
         cd compiler
         # Break up the links into several chunks.
@@ -898,7 +897,6 @@ then
         then
             echo "GRADE = $grade" >> Mmake.params
         fi
-        echo 'GCC_SRC_DIR := ../$(GCC_SRC_DIR)' >> Mmake.params
         cd $root

         set -x
@@ -1163,7 +1161,6 @@ then
     echo linking stage 3... 1>&2
     set +x
     cd $stage3dir
-    $LN_S $root/main.c .
     mkdir compiler
     cd compiler
     # Break up the links into several chunks.



More information about the reviews mailing list