[m-rev.] for review: Put .mh files into Mercury/mhs subdirectory.
Peter Wang
novalazy at gmail.com
Tue Jul 23 15:35:38 AEST 2024
On Tue, 23 Jul 2024 15:15:23 +1000 Julien Fischer <jfischer at opturion.com> wrote:
> Hi Peter,
>
> On Tue, 23 Jul 2024 at 14:33, Peter Wang <novalazy at gmail.com> wrote:
> >
> > Put .mh files into Mercury/mhs subdirectory.
> >
> > Put .mh files into a Mercury/mhs subdirectory when --use-subdirs
> > or --use-grade-subdirs is used.
>
> My guess is that samples/c_interface/standalone_c and possibly some
> of the other examples in samples/c_interface are going to require updating
> as well.
You're right. How does this look to you? mhs_subdir is surely an
implementation detail, but I don't know if it's worth trying
to avoid using it in these examples.
Peter
diff --git a/samples/c_interface/c_calls_mercury/Mmakefile b/samples/c_interface/c_calls_mercury/Mmakefile
index b8015703e..71f91ba77 100644
--- a/samples/c_interface/c_calls_mercury/Mmakefile
+++ b/samples/c_interface/c_calls_mercury/Mmakefile
@@ -19,7 +19,7 @@ MLOBJS=c_main.o
#-----------------------------------------------------------------------------#
-c_main.o: mercury_lib.mh c_main.h
+c_main.o: $(mhs_subdir)mercury_lib.mh c_main.h
# make sure that `mmake clean' removes c_main.o
clean_local:
diff --git a/samples/c_interface/cplusplus_calls_mercury/Mmakefile b/samples/c_interface/cplusplus_calls_mercury/Mmakefile
index d96581de0..746f334d0 100644
--- a/samples/c_interface/cplusplus_calls_mercury/Mmakefile
+++ b/samples/c_interface/cplusplus_calls_mercury/Mmakefile
@@ -28,7 +28,7 @@ MLLIBS=-lstdc++
#-----------------------------------------------------------------------------#
# We also need to add header file dependencies.
-cpp_main.o: cpp_main.h mercury_lib.mh
+cpp_main.o: cpp_main.h $(mhs_subdir)mercury_lib.mh
cpp_main_int.o: cpp_main.h
# Ensure sure that `mmake clean' removes cpp_main.o
diff --git a/samples/c_interface/simpler_c_calls_mercury/Mmakefile b/samples/c_interface/simpler_c_calls_mercury/Mmakefile
index fa9f2eb0b..64ec8358a 100644
--- a/samples/c_interface/simpler_c_calls_mercury/Mmakefile
+++ b/samples/c_interface/simpler_c_calls_mercury/Mmakefile
@@ -25,7 +25,7 @@ MCFLAGS-c_main=--no-warn-nothing-exported
#-----------------------------------------------------------------------------#
-main.o: mercury_lib.mh
+main.o: $(mhs_subdir)mercury_lib.mh
# make sure that `mmake clean' removes main.o
clean_local:
diff --git a/samples/c_interface/simpler_cplusplus_calls_mercury/Mmakefile b/samples/c_interface/simpler_cplusplus_calls_mercury/Mmakefile
index d6beae21d..29f21aeb2 100644
--- a/samples/c_interface/simpler_cplusplus_calls_mercury/Mmakefile
+++ b/samples/c_interface/simpler_cplusplus_calls_mercury/Mmakefile
@@ -33,7 +33,7 @@ MCFLAGS-cpp_main=--no-warn-nothing-exported
#-----------------------------------------------------------------------------#
-main.o: mercury_lib.mh
+main.o: $(mhs_subdir)mercury_lib.mh
# make sure that `mmake clean' removes main.o
clean_local:
diff --git a/samples/c_interface/standalone_c/Makefile b/samples/c_interface/standalone_c/Makefile
index cb7bca1fa..04e335f02 100644
--- a/samples/c_interface/standalone_c/Makefile
+++ b/samples/c_interface/standalone_c/Makefile
@@ -98,7 +98,8 @@ CFLAGS_FOR_GRADE = $(shell $(MMC) $(GRADEOPT) --output-grade-defines)
# tell it where to search for C header files that are part of any Mercury
# libraries we are using (including the standard library).
#
-CFLAGS_FOR_INCLUDES = $(shell $(MMC) $(GRADEOPT) --output-c-include-dir-flags)
+CFLAGS_FOR_INCLUDES = $(shell $(MMC) $(GRADEOPT) --output-c-include-dir-flags) \
+ -IMercury/mhs
# Gather together all the flags to pass to the C compiler.
#
More information about the reviews
mailing list