mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Estimated hours taken: 3 samples/tests/Mmakefile: The old version of this file had a bogus SUBDIRS list and a lot of code duplication with Mmake.common.samples. I rewrote it to use Mmake.common.samples. samples/tests/Mmake.common.samples: Add some documentation. Add some missing dependencies for the dep_local target. Automatically set the SUBDIRS variable to the correct value, rather than always setting it to empty. Fix a couple of other bugs (an `ifeq' should have been `ifneq' and in the condition of that test `$(SUBDIRS)' should have been `"$(SUBDIRS)"'). samples/tests/Mmake.common: samples/tests/generate_exp: Delete the code for making .exp files using NU-Prolog. samples/tests/c_interface/c_calls_mercury/Mmakefile: samples/tests/c_interface/cplusplus_calls_mercury/Mmakefile: Fix a bug: add some extra dependencies to ensure that it copies the right files before invoking mmc to make the dependencies.
89 lines
2.2 KiB
Plaintext
89 lines
2.2 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
|
|
# The Mmake file which includes this one should set the following variables:
|
|
# THISDIR relative path of source directory from `samples'
|
|
# DEPTH relative path of `samples/test' directory from current
|
|
# (i.e. . or .. or ../.. or ../../.. etc.)
|
|
# PROGS list of Mercury programs to build and test
|
|
# TESTS additional tests to run
|
|
# EXTRA_FILES additional files to copy from the source directory
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
SOURCEDIR=$(DEPTH)/../$(THISDIR)
|
|
|
|
%.m: $(SOURCEDIR)/%.m
|
|
cp $(SOURCEDIR)/$@ .
|
|
|
|
SOURCEDIR_EXTRA_FILES= $(EXTRA_FILES:%=$(SOURCEDIR)/%)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
SRCS= $(PROGS:%=%.m)
|
|
DEPS= $(PROGS:%=%.dep)
|
|
DEPENDS=$(PROGS:%=%.depend)
|
|
OUTS= $(PROGS:%=%.out) $(TESTS:%=%.out)
|
|
RESS= $(PROGS:%=%.res) $(TESTS:%=%.res)
|
|
|
|
dep_local: extra_files $(SRCS) $(DEPS)
|
|
depend_local: extra_files $(SRCS) $(DEPENDS)
|
|
check_local: $(OUTS) $(RESS)
|
|
all_local: $(PROGS) $(TESTS)
|
|
|
|
clean_local: clean_srcs clean_extra_files
|
|
|
|
clean_srcs:
|
|
rm -f $(SRCS)
|
|
|
|
clean_extra_files:
|
|
rm -f $(EXTRA_FILES)
|
|
|
|
extra_files: $(SOURCEDIR_EXTRA_FILES)
|
|
-{ [ -n "$(SOURCEDIR_EXTRA_FILES)" ] && cp $(SOURCEDIR_EXTRA_FILES) . || true ; }
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
realclean:
|
|
rm -f $(SRCS) $(EXTRA_FILES)
|
|
|
|
SUBMMAKEFILES := $(wildcard */Mmakefile)
|
|
SUBDIRS := $(SUBMMAKEFILES:%/Mmakefile=%)
|
|
|
|
ifneq ("$(SUBDIRS)","")
|
|
|
|
dep_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) dep) || exit 1; \
|
|
done
|
|
|
|
depend_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) depend) || exit 1; \
|
|
done
|
|
|
|
check_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) check) || exit 1; \
|
|
done
|
|
|
|
all_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) all) || exit 1; \
|
|
done
|
|
|
|
clean_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) clean) || exit 1; \
|
|
done
|
|
|
|
realclean_subdirs:
|
|
for dir in $(SUBDIRS); do \
|
|
(cd $$dir && $(SUBDIR_MMAKE) realclean) || exit 1; \
|
|
done
|
|
|
|
else
|
|
|
|
endif
|
|
|
|
#-----------------------------------------------------------------------------#
|