[m-rev.] diff: various fixes for the extras

Julien Fischer jfischer at opturion.com
Mon Jan 17 21:14:15 AEDT 2022


Has mmake's handling of the MGNUCFLAGS option changed recently?

Many of the extras that are built as libraries have sample programs
that attempt to build against in-situ version of that library; as
part of their Mmakefiles set a bunch of variables to point to where
the various files making up the library are.  Quite a lot of them
attempt to something like:

     MGNUCFLAGS = -I$(DIR_WHERE_LIB_LIVES)

in order to tell the C compiler where the library's C header files
are.  This doesn't work and has the effect of halting option processing
in the mgnuc script (-I is not an option that script recognises).  This
is causing the mgnuc script to construct incorrect command lines when
invoking the C compiler

Using MGNUCFLAGS instead of CFLAGS looks wrong anyway, but this is
usage is so prevelant that it must (and if IIRC) did work in the past.

----------------------------

Various fixes for the extras.

extras/complex_numbers/*.m:
     Rename files containing submodules so that we can (correctly) build
     this library without first building a source file mapping.

extras/complex_numbers/samples/Mmakefile:
extras/complex_numbers/tests/Mmakefile:
     Tell the C compiler where the header files for libcomplex_numbers
     are.

extras/curs/samples/Mmakefile:
     Pass the -I option to the C compiler via the CFLAGS variable, not
     the MGNUCFLAGS variable; the latter just causes the mgnuc script
     to halt option processing and construct an invalid command line
     for the C compiler.

extras/curses/*.m:
     Rename files containing submodules so that we can (correctly) build
     this library without first building a source file mapping.

extras/curses/mcurses.m:
     Style and formatting fixes.

extras/curses/sample/Mmakefile:
      Pass the -I option to the C compiler via the CFLAGS variable.

Julien

diff --git a/extras/complex_numbers/complex.m b/extras/complex_numbers/complex_numbers.complex.m
similarity index 100%
rename from extras/complex_numbers/complex.m
rename to extras/complex_numbers/complex_numbers.complex.m
diff --git a/extras/complex_numbers/complex_float.m b/extras/complex_numbers/complex_numbers.complex_float.m
similarity index 100%
rename from extras/complex_numbers/complex_float.m
rename to extras/complex_numbers/complex_numbers.complex_float.m
diff --git a/extras/complex_numbers/complex_imag.m b/extras/complex_numbers/complex_numbers.complex_imag.m
similarity index 100%
rename from extras/complex_numbers/complex_imag.m
rename to extras/complex_numbers/complex_numbers.complex_imag.m
diff --git a/extras/complex_numbers/float_complex.m b/extras/complex_numbers/complex_numbers.float_complex.m
similarity index 100%
rename from extras/complex_numbers/float_complex.m
rename to extras/complex_numbers/complex_numbers.float_complex.m
diff --git a/extras/complex_numbers/float_imag.m b/extras/complex_numbers/complex_numbers.float_imag.m
similarity index 100%
rename from extras/complex_numbers/float_imag.m
rename to extras/complex_numbers/complex_numbers.float_imag.m
diff --git a/extras/complex_numbers/imag.m b/extras/complex_numbers/complex_numbers.imag.m
similarity index 100%
rename from extras/complex_numbers/imag.m
rename to extras/complex_numbers/complex_numbers.imag.m
diff --git a/extras/complex_numbers/imag_complex.m b/extras/complex_numbers/complex_numbers.imag_complex.m
similarity index 100%
rename from extras/complex_numbers/imag_complex.m
rename to extras/complex_numbers/complex_numbers.imag_complex.m
diff --git a/extras/complex_numbers/imag_float.m b/extras/complex_numbers/complex_numbers.imag_float.m
similarity index 100%
rename from extras/complex_numbers/imag_float.m
rename to extras/complex_numbers/complex_numbers.imag_float.m
diff --git a/extras/complex_numbers/samples/Mmakefile b/extras/complex_numbers/samples/Mmakefile
index d073018ce..17f4a44d5 100644
--- a/extras/complex_numbers/samples/Mmakefile
+++ b/extras/complex_numbers/samples/Mmakefile
@@ -9,6 +9,7 @@ COMPLEX_NUMBERS_DIR = ..
  # The following stuff tells Mmake to use the complex number library
  VPATH = $(COMPLEX_NUMBERS_DIR):$(MMAKE_VPATH)
  MCFLAGS = -I$(COMPLEX_NUMBERS_DIR)
+CFLAGS = -I$(COMPLEX_NUMBERS_DIR)
  MLFLAGS = -R$(COMPLEX_NUMBERS_DIR) -L$(COMPLEX_NUMBERS_DIR)
  MLLIBS = -lcomplex_numbers
  C2INITARGS = $(COMPLEX_NUMBERS_DIR)/complex_numbers.init
diff --git a/extras/complex_numbers/tests/Mmakefile b/extras/complex_numbers/tests/Mmakefile
index afd74af29..2c756cf4a 100644
--- a/extras/complex_numbers/tests/Mmakefile
+++ b/extras/complex_numbers/tests/Mmakefile
@@ -9,6 +9,7 @@ COMPLEX_NUMBERS_DIR = ..
  # The following stuff tells Mmake to use the complex number library
  VPATH = $(COMPLEX_NUMBERS_DIR):$(MMAKE_VPATH)
  MCFLAGS = -I$(COMPLEX_NUMBERS_DIR) $(EXTRA_MCFLAGS)
+CFLAGS = -I$(COMPLEX_NUMBERS_DIR)
  MLFLAGS = -R$(COMPLEX_NUMBERS_DIR) -L$(COMPLEX_NUMBERS_DIR) $(EXTRA_MLFLAGS)
  MLLIBS = -lcomplex_numbers $(EXTRA_MLLIBS)
  C2INITARGS = $(COMPLEX_NUMBERS_DIR)/complex_numbers.init
diff --git a/extras/curs/samples/Mmakefile b/extras/curs/samples/Mmakefile
index f9388ba72..ead0f1d34 100644
--- a/extras/curs/samples/Mmakefile
+++ b/extras/curs/samples/Mmakefile
@@ -23,7 +23,7 @@ demos: $(DEMOS)
  # The following stuff tells Mmake to use the two libraries
  VPATH = $(CURS_DIR):$(MMAKE_VPATH)
  MCFLAGS = -I$(CURS_DIR) $(EXTRA_MCFLAGS)
-MGNUCFLAGS = -I$(CURS_DIR)
+CFLAGS = -I$(CURS_DIR)
  MLFLAGS = -R$(CURS_DIR) $(EXTRA_MLFLAGS) \
            -L$(CURS_DIR)
  MLLIBS = -lcurs -lpanel -lncurses $(EXTRA_MLLIBS)
diff --git a/extras/curses/basics.m b/extras/curses/mcurses.basics.m
similarity index 100%
rename from extras/curses/basics.m
rename to extras/curses/mcurses.basics.m
diff --git a/extras/curses/mcurses.m b/extras/curses/mcurses.m
index 985e53c6b..693b70d5d 100644
--- a/extras/curses/mcurses.m
+++ b/extras/curses/mcurses.m
@@ -2,11 +2,9 @@
  % Copyright (C) 1994-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.
-%----------------------------------------------------------------------------%
-
  %----------------------------------------------------------------------------%
  %
-% top level of the curses binding
+% Top-level of the curses binding
  %
  % Please note that this is still a partial binding; it does not provide
  % complete curses functionality.
@@ -17,6 +15,14 @@
  %     * Colour on a character by character basis.
  %
  %----------------------------------------------------------------------------%
+
  :- module mcurses.
  :- interface.
-:- include_module basics, user, misc.
+
+:- include_module basics.
+:- include_module misc.
+:- include_module user.
+
+%----------------------------------------------------------------------------%
+:- end_module mcurses.
+%----------------------------------------------------------------------------%
diff --git a/extras/curses/misc.m b/extras/curses/mcurses.misc.m
similarity index 100%
rename from extras/curses/misc.m
rename to extras/curses/mcurses.misc.m
diff --git a/extras/curses/user.m b/extras/curses/mcurses.user.m
similarity index 100%
rename from extras/curses/user.m
rename to extras/curses/mcurses.user.m
diff --git a/extras/curses/sample/Mmakefile b/extras/curses/sample/Mmakefile
index dc4ddab1d..5195cbd3b 100644
--- a/extras/curses/sample/Mmakefile
+++ b/extras/curses/sample/Mmakefile
@@ -8,7 +8,7 @@ MCURSES_DIR = ..
  # Tell mmake to use the mcurses library
  VPATH = 	$(MCURSES_DIR):$(MMAKE_VPATH)
  MCFLAGS = 	-I$(MCURSES_DIR) $(EXTRA_MCFLAGS)
-MGNUCFLAGS = 	-I$(MCURSES_DIR) $(EXTRA_MGNUCFLAGS)
+CFLAGS = 	-I$(MCURSES_DIR)
  MLFLAGS = 	-R$(MCURSES_DIR) $(EXTRA_MLFLAGS) \
  		-L$(MCURSES_DIR)



More information about the reviews mailing list