Files
mercury/Mmakefile
Fergus Henderson 8122fe73ef Fix a warning about the rule for making `library/library.init'
Estimated hours taken: 0.5

Fix a warning about the rule for making `library/library.init'
clashing with the default rule for creating a `.init' file
in the automatically-generated `library/library.dep' file.
The initialization for the library is different to the
standard automatically-generated initialization, because
the library contains C code that needs explicit initialization.
(because it has BEGIN_MODULE ... END_MODULE macros in it); this
C code hence has `INIT blah' comments in it naming functions that
need to be inserted in the `.init' file so that they will be called
at initialization time.

Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tools/bootcheck:
tools/linear:
tools/binary:
	s/library.init/libmercury.init/g
1997-07-21 06:26:10 +00:00

332 lines
8.7 KiB
Plaintext

#-----------------------------------------------------------------------------#
# Copyright (C) 1995 University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public Licence - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#
# Mmake - the top-level Mmake file for the Mercury implementation
MAIN_TARGET=all
MERCURY_DIR=.
include Mmake.common
VERSION=0.6
#-----------------------------------------------------------------------------#
SUBDIRS = scripts util boehm_gc runtime library compiler doc profiler
SUBDIR_MMAKE = PATH=../scripts:../util:$$PATH \
MMAKE_VPATH=. \
MMAKE_DIR=../scripts \
../scripts/mmake $(MMAKEFLAGS)
#-----------------------------------------------------------------------------#
# `mmake dep' ensures that the .dep files exist;
# `mmake depend' forces them to be remade to ensure that they are up-to-date.
.PHONY: dep
dep: dep_library dep_compiler dep_profiler
.PHONY: dep_library
dep_library: library/library.dep
library/library.dep:
cd library && $(SUBDIR_MMAKE) depend
.PHONY: dep_compiler
dep_compiler: compiler/mercury_compile.dep
compiler/mercury_compile.dep: library/library.dep
cd compiler && $(SUBDIR_MMAKE) depend
.PHONY: dep_profiler
dep_profiler: profiler/mercury_profile.dep
compiler/mercury_profile.dep: library/library.dep
cd profiler && $(SUBDIR_MMAKE) depend
# depend_library MUST be done before depend_compiler and depend_profiler
.PHONY: depend
depend:
cd library && $(SUBDIR_MMAKE) depend
cd compiler && $(SUBDIR_MMAKE) depend
cd profiler && $(SUBDIR_MMAKE) depend
.PHONY: depend_library
depend_library:
cd library && $(SUBDIR_MMAKE) depend
.PHONY: depend_compiler
depend_compiler:
cd compiler && $(SUBDIR_MMAKE) depend
.PHONY: depend_profiler
depend_profiler:
cd profiler && $(SUBDIR_MMAKE) depend
#-----------------------------------------------------------------------------#
.PHONY: all
all: $(SUBDIRS)
.PHONY: scripts
scripts:
cd scripts && $(SUBDIR_MMAKE)
.PHONY: runtime
runtime: scripts boehm_gc
cd runtime && $(SUBDIR_MMAKE)
.PHONY: boehm_gc
boehm_gc: scripts
case "$$grade" in \
*.prof*) \
prof=_prof \
;; \
*) \
prof= \
;; \
esac; \
cd boehm_gc && $(SUBDIR_MMAKE) PROF=$$prof
.PHONY: library
library: dep_library scripts runtime boehm_gc
cd library && $(SUBDIR_MMAKE)
.PHONY: compiler
compiler: dep_compiler scripts util runtime boehm_gc library
cd compiler && $(SUBDIR_MMAKE)
.PHONY: doc
doc: scripts
cd doc && $(SUBDIR_MMAKE)
.PHONY: util
util: scripts
cd util && $(SUBDIR_MMAKE)
.PHONY: profiler
profiler: dep_profiler scripts util runtime boehm_gc library
cd profiler && $(SUBDIR_MMAKE)
#-----------------------------------------------------------------------------#
.PHONY: tags
tags: tags_compiler tags_profiler tags_library
.PHONY: tags_compiler
tags_compiler:
cd compiler && $(SUBDIR_MMAKE) tags
.PHONY: tags_library
tags_library:
cd library && $(SUBDIR_MMAKE) tags
.PHONY: tags_profiler
tags_profiler:
cd profiler && $(SUBDIR_MMAKE) tags
#-----------------------------------------------------------------------------#
configure: configure.in
autoconf
config.status: configure
if [ -f ./config.status ]; then \
./config.status --recheck; \
else \
echo "======> You need to run configure!"; \
exit 1; \
fi
Mmake.common: Mmake.common.in config.status
./config.status
#-----------------------------------------------------------------------------#
# Generally you should do a `mmake realclean' before doing `mmake tar'.
.PHONY: tar
tar:
touch Mmake.params
cd util && mmake
cd runtime && $(SUBDIR_MMAKE) cs runtime.init
cd library && $(SUBDIR_MMAKE) depend
cd library && $(SUBDIR_MMAKE) ints opts cs libmercury.init tags
cd compiler && $(SUBDIR_MMAKE) depend
cd compiler && $(SUBDIR_MMAKE) ints cs tags
cd profiler && $(SUBDIR_MMAKE) depend
cd profiler && $(SUBDIR_MMAKE) ints cs tags
cd doc && $(SUBDIR_MMAKE) info html dvi
cd bindist && $(SUBDIR_MMAKE) bindist.configure bindist.build_vars
# clean up
cd scripts && mmake realclean
cd util && mmake realclean
cd doc && mmake distclean
-rm -f errs errs2 update.log
-rm -f config.status config.cache config.log configure.log
-rm -f runtime/conf.h
-rm -f Mmake.common
# Package up the mercury directory and the tests directory,
# but with some subdirectories excluded, into a gzipped tar
# archive that will unpack into mercury-$(VERSION).
cd .. && ( \
mv mercury mercury-$(VERSION); \
mv tests mercury-$(VERSION)/tests; \
mkdir stuff-to-exclude; \
mv mercury-$(VERSION)/trial stuff-to-exclude; \
mv mercury-$(VERSION)/bytecode stuff-to-exclude; \
mv mercury-$(VERSION)/lp_solve stuff-to-exclude; \
tar -cf - mercury-$(VERSION) | \
gzip -9 > mercury-$(VERSION).tar.gz; \
mv stuff-to-exclude/* mercury-$(VERSION); \
rmdir stuff-to-exclude; \
mv mercury-$(VERSION)/tests tests; \
mv mercury-$(VERSION) mercury \
)
version:
@echo $(VERSION)
#-----------------------------------------------------------------------------#
.PHONY: install
install: all install_scripts install_util install_runtime install_boehm_gc \
install_library install_compiler install_profiler install_doc \
install_grades
.PHONY: install_scripts
install_scripts: scripts
cd scripts && $(SUBDIR_MMAKE) install
.PHONY: install_util
install_util: util
cd util && $(SUBDIR_MMAKE) install
.PHONY: install_runtime
install_runtime: runtime
cd runtime && $(SUBDIR_MMAKE) install
.PHONY: install_boehm_gc
install_boehm_gc: boehm_gc
case "$$grade" in \
*.prof*) \
prof=_prof \
;; \
*) \
prof= \
;; \
esac; \
cd boehm_gc && $(SUBDIR_MMAKE) install PROF=$$prof
.PHONY: install_library
install_library: dep_library library
cd library && $(SUBDIR_MMAKE) install
.PHONY: install_compiler
install_compiler: dep_compiler compiler
cd compiler && $(SUBDIR_MMAKE) install
.PHONY: install_doc
install_doc: doc
cd doc && $(SUBDIR_MMAKE) install
.PHONY: install_profiler
install_profiler: profiler
cd profiler && $(SUBDIR_MMAKE) install
.PHONY: install_grades
install_grades: scripts dep_library
cd boehm_gc && rm -rf tmp_dir && mkdir tmp_dir && \
{ mv -f *.o *.pic_o *.a *.so tmp_dir || true; }
cd runtime && rm -rf tmp_dir && mkdir tmp_dir && \
{ mv -f *.o *.pic_o *.a *.so tmp_dir || true; }
cd library && rm -rf tmp_dir && mkdir tmp_dir && \
{ mv -f *.o *.pic_o *.a *.so tmp_dir || true; }
for grade in x $(LIBGRADES); do \
if [ "$$grade" != "x" ]; then \
case "$$grade" in \
*.prof*) \
prof=_prof \
;; \
*) \
prof= \
;; \
esac; \
( cd boehm_gc && \
$(SUBDIR_MMAKE) GRADE=$$grade PROF=$$prof install_lib ) && \
( cd runtime && \
$(SUBDIR_MMAKE) GRADE=$$grade install_lib ) && \
( cd library && \
$(SUBDIR_MMAKE) GRADE=$$grade install_library ) && \
( cd boehm_gc && rm -f *.o *.pic_o *.a *.so ) && \
( cd runtime && rm -f *.o *.pic_o *.a *.so ) && \
( cd library && rm -f *.o *.pic_o *.a *.so ) && \
true \
|| exit 1; \
fi; \
done
cd boehm_gc && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
cd runtime && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
cd library && { mv tmp_dir/* . ; rmdir tmp_dir; true; }
.PHONY: install_split_library
install_split_library: scripts dep_library
cd library && \
rm -rf tmp_dir && \
mkdir tmp_dir && \
{ mv -f *.dir *.c *.o *.pic_o *.a *.so tmp_dir || true; } && \
for grade in $(GRADE) $(LIBGRADES); do \
$(SUBDIR_MMAKE) GRADE=$$grade install_split_library || exit 1; \
rm -rf *.dir *.c *.o *.pic_o *.a *.so; \
done && \
{ mv tmp_dir/* . ; rmdir tmp_dir; true; }
#-----------------------------------------------------------------------------#
.PHONY: uninstall
uninstall:
cd scripts; $(SUBDIR_MMAKE) uninstall
cd util; $(SUBDIR_MMAKE) uninstall
cd doc; $(SUBDIR_MMAKE) uninstall
-rm -r $(INSTALL_LIBDIR)
#-----------------------------------------------------------------------------#
.PHONY : bindist
bindist:
cd bindist; mmake binary_distribution
#-----------------------------------------------------------------------------#
clean: clean_subdirs
.PHONY: clean_subdirs
clean_subdirs:
rm -rf runtime/tmp_dir library/tmp_dir
for dir in $(SUBDIRS); do \
if [ "$$dir" = scripts ]; then continue; fi; \
(cd $$dir; $(SUBDIR_MMAKE) clean) \
done
realclean: realclean_subdirs realclean_config
.PHONY: realclean_subdirs
realclean_subdirs: clean_subdirs
rm -rf stage[1-3]
for dir in $(SUBDIRS); do \
if [ "$$dir" = scripts ]; then continue; fi; \
(cd $$dir; $(SUBDIR_MMAKE) realclean) \
done
cd scripts; $(SUBDIR_MMAKE) realclean
.PHONY: realclean_config
realclean_config:
rm -f config.cache config.status config.log
#-----------------------------------------------------------------------------#