more changes for `--use-subdirs'
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Mar 20 02:41:54 AEDT 1998
Estimated hours taken: 5
Fix some problems with the `--use-subdirs' option.
With this change, the compiler itself now compiles
and bootstraps fine with MMAKE_USE_SUBDIRS=yes.
compiler/modules.m:
Put `.h' files in the source directory, rather than
in the `Mercury/hs' subdirectory.
compiler/mercury_compile.m:
scripts/Mmake.rules:
If `--use-subdirs' is enabled, pass `-I.' to the C compiler,
so that #include statements work relative to the source directory
rather than relative to the `Mercury/cs' subdirectory.
scripts/Mmake.vars.in:
Define $(cs_subdir), $(os_subdir) etc. variables;
these are set to the directory to use for .c, .o, etc. files,
(including the trailing `/'), or to the empty string,
if --use-subdirs is not set.
scripts/Mmake.rules.in:
Use $(cs_subdir), $(os_subdir) etc. to avoid the code
duplication created by my previous change to handle
--use-subdirs.
Also add lots of comments, and reorder the code
in a more logical order.
Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
Use $(cs_subdir), $(os_subdir) etc. to fix a few hard-coded
file-names (*.dep, *_init.[co], tree234.o) that were
used in some of the rules.
library/Mmakefile:
Add `rm -f tags' to the rule for `mmake realclean'.
tools/bootcheck:
Add `--use-subdirs' option (defaults to setting of the
MMAKE_USE_SUBDIRS environment variable).
Change the code which compares the stage2 & stage3 C files
to use the appropriate location for them based on the
setting of this option.
cvs diff Mmakefile compiler/Mmakefile compiler/mercury_compile.m compiler/modules.m library/Mmakefile profiler/Mmakefile scripts/Mmake.rules scripts/Mmake.rules.in scripts/Mmake.vars.in tools/bootcheck
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.19
diff -u -r1.19 Mmakefile
--- Mmakefile 1998/03/18 04:28:34 1.19
+++ Mmakefile 1998/03/19 15:05:49
@@ -35,21 +35,21 @@
dep: dep_library dep_compiler dep_profiler
.PHONY: dep_library
-dep_library: library/library.dep
+dep_library: library/$(dep_subdir)library.dep
library/library.dep:
cd library && $(SUBDIR_MMAKE) depend
.PHONY: dep_compiler
-dep_compiler: compiler/mercury_compile.dep
+dep_compiler: compiler/$(dep_subdir)mercury_compile.dep
-compiler/mercury_compile.dep: library/library.dep
+compiler/$(dep_subdir)mercury_compile.dep: library/$(dep_subdir)library.dep
cd compiler && $(SUBDIR_MMAKE) depend
.PHONY: dep_profiler
-dep_profiler: profiler/mercury_profile.dep
+dep_profiler: profiler/$(dep_subdir)mercury_profile.dep
-profiler/mercury_profile.dep: library/library.dep
+profiler/$(dep_subdir)mercury_profile.dep: library/$(dep_subdir)library.dep
cd profiler && $(SUBDIR_MMAKE) depend
# depend_library MUST be done before depend_compiler and depend_profiler
Index: compiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
retrieving revision 1.9
diff -u -r1.9 Mmakefile
--- Mmakefile 1998/03/11 05:56:39 1.9
+++ Mmakefile 1998/03/19 14:13:03
@@ -123,8 +123,8 @@
#-----------------------------------------------------------------------------#
.PHONY: os cs
-os: $(mercury_compile.os) mercury_compile_init.o
-cs: $(mercury_compile.cs) mercury_compile_init.c
+os: $(mercury_compile.os) $(os_subdir)mercury_compile_init.o
+cs: $(mercury_compile.cs) $(cs_subdir)mercury_compile_init.c
#-----------------------------------------------------------------------------#
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.78
diff -u -r1.78 mercury_compile.m
--- mercury_compile.m 1998/03/18 08:07:40 1.78
+++ mercury_compile.m 1998/03/19 11:31:50
@@ -1890,6 +1890,15 @@
globals__io_lookup_accumulating_option(cflags, C_Flags_List),
{ join_string_list(C_Flags_List, "", "", " ", CFLAGS) },
+ globals__io_lookup_bool_option(use_subdirs, UseSubdirs),
+ { UseSubdirs = yes ->
+ % the file will be compiled in the "Mercury/cs" subdir,
+ % so we need to add `-I.' so it can
+ % include header files in the source directory.
+ SubDirInclOpt = "-I. "
+ ;
+ SubDirInclOpt = ""
+ },
globals__io_lookup_string_option(c_include_directory, C_INCL),
{ C_INCL = "" ->
InclOpt = ""
@@ -2034,7 +2043,8 @@
% e.g. CFLAGS_FOR_REGS must come after OptimizeOpt so that
% it can override -fomit-frame-pointer with -fno-omit-frame-pointer.
% Also be careful that each option is separated by spaces.
- { string__append_list([CC, " ", InclOpt, SplitOpt, OptimizeOpt,
+ { string__append_list([CC, " ", SubDirInclOpt, InclOpt,
+ SplitOpt, OptimizeOpt,
RegOpt, GotoOpt, AsmOpt,
CFLAGS_FOR_REGS, " ", CFLAGS_FOR_GOTOS, " ",
GC_Opt, ProfileCallsOpt, ProfileTimeOpt, ProfileMemoryOpt,
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.64
diff -u -r1.64 modules.m
--- modules.m 1998/03/18 17:30:35 1.64
+++ modules.m 1998/03/19 11:08:22
@@ -430,6 +430,7 @@
; Ext = ".sicstus"
; Ext = ".sicstus.debug"
% output files intended for use by the user
+ ; Ext = ".h"
; Ext = ".err"
; Ext = ".ugly"
; Ext = ".hlds_dump"
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.25
diff -u -r1.25 Mmakefile
--- Mmakefile 1998/03/18 08:09:47 1.25
+++ Mmakefile 1998/03/19 14:12:31
@@ -201,7 +201,7 @@
.PHONY: libmercury
# the following dependency is just there to improve compilation speed;
# making tree234.o first improves effective parallelism with parallel makes.
-libmercury : tree234.o
+libmercury : $(os_subdir)tree234.o
libmercury : libmercury.a libmercury.$(EXT_FOR_SHARED_LIB) libmercury.init
libmercury$(DLL_DEF_LIB).a : $(library.os)
@@ -218,7 +218,7 @@
$(LDFLAGS) $(LDLIBS) \
$(SHARED_LIBS)
-libmercury.init: library.dep
+libmercury.init: $(deps_subdir)library.dep
for file in $(library.ms); do \
grep '^INIT ' $$file; \
echo "INIT mercury__`basename $$file .m`__init"; \
@@ -280,6 +280,7 @@
realclean:
rm -f libmercury.a libmercury.so libmercury.init
rm -f sicstus_saved_state sicstus_compile sp_builtin.pl
+ rm -f tags
#-----------------------------------------------------------------------------#
Index: profiler/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/profiler/Mmakefile,v
retrieving revision 1.6
diff -u -r1.6 Mmakefile
--- Mmakefile 1998/03/11 05:57:51 1.6
+++ Mmakefile 1998/03/19 14:13:27
@@ -61,7 +61,7 @@
# if in .gc(.prof) grade; GNU make does not support dynamic dependencies,
# so just leave it out.
-mercury_profile_init.c: $(UTIL_DIR)/mkinit
+$(cs_subdir)mercury_profile_init.c: $(UTIL_DIR)/mkinit
#-----------------------------------------------------------------------------#
@@ -85,8 +85,8 @@
#-----------------------------------------------------------------------------#
.PHONY: os cs
-os: $(mercury_profile.os) mercury_profile_init.o
-cs: $(mercury_profile.cs) mercury_profile_init.c
+os: $(mercury_profile.os) $(os_subdir)mercury_profile_init.o
+cs: $(mercury_profile.cs) $(cs_subdir)mercury_profile_init.c
#-----------------------------------------------------------------------------#
Index: scripts/Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.54
diff -u -r1.54 Mmake.rules
--- Mmake.rules 1998/03/19 08:51:29 1.54
+++ Mmake.rules 1998/03/19 15:34:10
@@ -22,166 +22,112 @@
.i .s .pic_s \
.ql .pl
+#-----------------------------------------------------------------------------#
+#
+# Code to set variables based on the setting of MMAKE_USE_SUBDIRS
+# (i.e. --use-subdirs).
+#
+
ifeq ($(MMAKE_USE_SUBDIRS),yes)
MCFLAGS += --use-subdirs
+MGNUCFLAGS += -I.
-SUBDIR=Mercury/
-# SUBDIR=
-
-.PRECIOUS: $(SUBDIR)date0s/%.date0
-.PRECIOUS: $(SUBDIR)dates/%.date
-.PRECIOUS: $(SUBDIR)date3s/%.date3
-.PRECIOUS: $(SUBDIR)optdates/%.optdate
-.PRECIOUS: $(SUBDIR)trans_opt_dates/%.trans_opt_date
-
-$(SUBDIR)nos/%.no : %.m
- $(MNC) $(MNCFLAGS) -o $@ $<
-
-$(SUBDIR)nos/%.no : %.nl
- $(MNC) $(MNCFLAGS) -o $@ $<
-
-$(SUBDIR)nos/%.ql : %.m
- $(MSC) $(MSCFLAGS) -o $@ $<
-
-$(SUBDIR)nos/%.ql : %.nl
- $(MSC) $(MSCFLAGS) -o $@ $<
-
-$(SUBDIR)date0s/%.date0 : %.m
- $(MCPI) $(MCPIFLAGS) $<
-
-$(SUBDIR)dates/%.date : %.m
- $(MCI) $(MCIFLAGS) $<
-
-$(SUBDIR)date3s/%.date3 : %.m
- $(MCSI) $(MCSIFLAGS) $<
+endif
-$(SUBDIR)optdates/%.optdate : %.m
- $(MCOI) $(MCOIFLAGS) $<
+#-----------------------------------------------------------------------------#
-$(SUBDIR)trans_opt_dates/%.trans_opt_date : %.m
- $(MCTOI) $(MCTOIFLAGS) $<
+.PRECIOUS: $(date0s_subdir)%.date0
+.PRECIOUS: $(dates_subdir)%.date
+.PRECIOUS: $(date3s_subdir)%.date3
+.PRECIOUS: $(optdates_subdir)%.optdate
+.PRECIOUS: $(trans_opt_dates_subdir)%.trans_opt_date
-# Be very careful about changing the following rules.
-# The `@:' is a silent do-nothing command.
-# It is used to force GNU Make to recheck the timestamp
-# on the target file. (It is a pity that GNU Make doesn't
-# have a way of handling these sorts of rules in a nicer manner.)
+#-----------------------------------------------------------------------------#
+#
+# Rules for NU-Prolog and SICStus Prolog.
+#
-$(SUBDIR)int0s/%.int0 : $(SUBDIR)date0s/%.date0
- @:
+.m.pl:
+ sicstus_conv $<
-$(SUBDIR)ints/%.int : $(SUBDIR)dates/%.date
- @:
+.nl.pl:
+ sicstus_conv $<
-$(SUBDIR)int2s/%.int2 : $(SUBDIR)dates/%.date
- @:
+$(nos_subdir)%.no : %.m
+ $(MNC) $(MNCFLAGS) -o $@ $<
-$(SUBDIR)int3s/%.int3 : $(SUBDIR)date3s/%.date3
- @:
+$(nos_subdir)%.no : %.nl
+ $(MNC) $(MNCFLAGS) -o $@ $<
-$(SUBDIR)opts/%.opt : $(SUBDIR)opt_dates/%.opt_date
- @:
+$(qls_subdir)%.ql : %.m
+ $(MSC) $(MSCFLAGS) -o $@ $<
-$(SUBDIR)trans_opts/%.trans_opt : $(SUBDIR)trans_opt_dates/%.trans_opt_date
- @:
+$(qls_subdir)%.ql : %.nl
+ $(MSC) $(MSCFLAGS) -o $@ $<
-%.dep : $(SUBDIR)deps/%.dep
+#-----------------------------------------------------------------------------#
+#
+# Rules for building dependency files
+#
-$(SUBDIR)deps/%.dep: %.m
+$(deps_subdir)%.dep: %.m
+ @-[ ! -f $(deps_subdir)$*.dep ] || chmod +w $(deps_subdir)$*.dep
$(MCD) $(MCDFLAGS) $<
-# When creating the dependencies, we need to create the `dates' directory
+# When creating the dependencies with `--use-subdirs' enabled,
+# we need to create the `Mercury/dates' directory manually
# in order to get things started. This should not be necessary,
# but there is a bug in GNU Make with regard to directory caching.
# I have sent off a bug report to the GNU Make maintainers (19 March 1998).
# -fjh.
+.PHONY: %.depend
%.depend : %.m
$(MCD) $(MCDFLAGS) $<
- -rm -f $(SUBDIR)cs/$*_init.c
+ -rm -f $(cs_subdir)$*_init.c
+ifeq ($(MMAKE_USE_SUBDIRS),yes)
+ # the following mkdirs work around a bug in GNU Make
+ [ -d Mercury/ints ] || mkdir Mercury/ints
+ [ -d Mercury/int0s ] || mkdir Mercury/int0s
+ [ -d Mercury/int3s ] || mkdir Mercury/int3s
+ [ -d Mercury/opts ] || mkdir Mercury/opts
+ [ -d Mercury/trans_opts ] || mkdir Mercury/trans_opts
[ -d Mercury/dates ] || mkdir Mercury/dates
+ [ -d Mercury/date0s ] || mkdir Mercury/date0s
+ [ -d Mercury/date3s ] || mkdir Mercury/date3s
+ [ -d Mercury/optdates ] || mkdir Mercury/optdates
+ [ -d Mercury/trans_opt_dates ] || mkdir Mercury/trans_opt_dates
+endif
+
+# The `.doit' files are helpful when using Prolog.
-%.doit : $(SUBDIR)deps/%.dep
+%.doit : $(deps_subdir)%.dep
sed -e ':a' -e '/\\/N' -e 's/\\\n //' -e 't a' $< | \
- tee tmp | \
- grep 'srcs *=' | \
+ grep '\.ms *=' | \
sed -e 's/.*=/:-[ '\''nu_library.doit'\'', /' \
- -e 's/\.nl/,/g' \
+ -e 's/\.m/,/g' \
-e 's/$$/ portray ]./' \
> $@
-$(SUBDIR)cs/%.c : %.m
- rm -f $(SUBDIR)cs/$*.c
- $(MCG) $(GRADEFLAGS) $(MCGFLAGS) $< > $*.err 2>&1
-
-$(SUBDIR)os/%.o : $(SUBDIR)cs/%.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $< -o $@
-
-# If we aren't removing the .c files, we generate .pic_o files
-# without invoking mmake.
-ifeq ($(RM_C),:)
-$(SUBDIR)os/%.pic_o : $(SUBDIR)cs/%.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $< -o $@
-endif
-
-%.s: $(SUBDIR)cs/%.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -S $< -o $@
-
-%.pic_s: $(SUBDIR)cs/%.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -S $< -o $@
-
-%.i: $(SUBDIR)cs/%.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -E $< > $@
-
-# If we aren't removing the .c files, we don't need to invoke mmake
-# for each .c file
-ifneq ($(RM_C),:)
-$(SUBDIR)os/%.o : %.m
- $(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $(SUBDIR)cs/$*.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $(SUBDIR)cs/$*.c -o $@
- $(RM_C) $(SUBDIR)cs/$*.c
-
-$(SUBDIR)os/%.pic_o : %.m
- $(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $(SUBDIR)cs/$*.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) \
- -c $(SUBDIR)cs/$*.c -o $@
-
-endif
-
-$(SUBDIR)dirs/%.dir/*.o: %.m
- rm -f $@
- $(MCS) $(GRADEFLAGS) $(MCSFLAGS) $<
-
-else # USE_SUBDIRS=no
-
-.PRECIOUS: %.date0 %.date %.date3 %.optdate %.trans_opt_date
-
-.m.no:
- $(MNC) $(MNCFLAGS) -o $@ $<
-
-.nl.no:
- $(MNC) $(MNCFLAGS) -o $@ $<
-
-.m.ql:
- $(MSC) $(MSCFLAGS) -o $@ $<
-
-.nl.ql:
- $(MSC) $(MSCFLAGS) -o $@ $<
+#-----------------------------------------------------------------------------#
+#
+# Rules for building interface files
+#
-.m.date0:
+$(date0s_subdir)%.date0 : %.m
$(MCPI) $(MCPIFLAGS) $<
-.m.date:
+$(dates_subdir)%.date : %.m
$(MCI) $(MCIFLAGS) $<
-.m.date3:
+$(date3s_subdir)%.date3 : %.m
$(MCSI) $(MCSIFLAGS) $<
-.m.optdate:
+$(optdates_subdir)%.optdate : %.m
$(MCOI) $(MCOIFLAGS) $<
-.m.trans_opt_date:
+$(trans_opt_dates_subdir)%.trans_opt_date : %.m
$(MCTOI) $(MCTOIFLAGS) $<
# Be very careful about changing the following rules.
@@ -190,55 +136,85 @@
# on the target file. (It is a pity that GNU Make doesn't
# have a way of handling these sorts of rules in a nicer manner.)
-.date0.int0:
+$(int0s_subdir)%.int0 : $(SUBDIR)date0s_subdir)%.date0
@:
-.date.int:
+$(ints_subdir)%.int : $(dates_subdir)%.date
@:
-.date.int2:
+$(int2s_subdir)%.int2 : $(dates_subdir)%.date
@:
-.date3.int3:
+$(int3s_subdir)%.int3 : $(date3s_subdir)%.date3
@:
-.optdate.opt:
+$(opts_subdir)%.opt : $(optdates_subdir)%.optdate
@:
-.trans_opt_date.trans_opt:
+$(trans_opts_subdir)%.trans_opt : $(trans_opt_dates_subdir)%.trans_opt_date
@:
-.m.dep:
- @-[ ! -f $*.dep ] || chmod +w $*.dep
- $(MCD) $(MCDFLAGS) $<
+#-----------------------------------------------------------------------------#
+#
+# Rules for compiling Mercury source files
+#
-.m.depend:
- @-[ ! -f $*.dep ] || chmod +w $*.dep
- $(MCD) $(MCDFLAGS) $<
- -rm -f $*_init.c
+$(cs_subdir)%.c : %.m
+ rm -f $(cs_subdir)$*.c
+ $(MCG) $(GRADEFLAGS) $(MCGFLAGS) $< > $*.err 2>&1
-.dep.doit:
- sed -e ':a' -e '/\\/N' -e 's/\\\n //' -e 't a' $< | \
- tee tmp | \
- grep 'srcs *=' | \
- sed -e 's/.*=/:-[ '\''nu_library.doit'\'', /' \
- -e 's/\.nl/,/g' \
- -e 's/$$/ portray ]./' \
- > $@
+# If we are removing the .c files, we need to tell Make that we're
+# generating the .o files directly from the .m files, but
+# in order to avoid remaking the .c files if they're already there,
+# we need to invoke mmake recursively for each .c file.
+# This can be pretty inefficient.
-.m.c:
- rm -f $*.c
- $(MCG) $(GRADEFLAGS) $(MCGFLAGS) $< > $*.err 2>&1
+ifneq ($(RM_C),:)
+
+$(os_subdir)%.o : %.m
+ $(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $(cs_subdir)$*.c
+ $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $(cs_subdir)$*.c -o $@
+ $(RM_C) $(cs_subdir)$*.c
+
+$(os_subdir)%.pic_o : %.m
+ $(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $(cs_subdir)$*.c
+ $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) \
+ -c $(cs_subdir)$*.c -o $@
+
+endif # RM_C != :
+
+# For --split-c-files, we generate the .o files directly from the .m files.
+# (One reason for this is that there's no easy of telling Make how many
+# `.o' files it should make, since the number of them depends on what's
+# in the source files.)
+
+$(dirs_subdir)%.dir/*.o: %.m
+ rm -f $@
+ $(MCS) $(GRADEFLAGS) $(MCSFLAGS) $<
+
+# The `touch' is necessary, since otherwise if
+# the old .err file was of size zero and
+# the new .err file is also of size zero,
+# the time-stamp doesn't get updated!
+# (Is that a bug in unix? In bash?)
+
+.m.err:
+ $(MC) $(MCFLAGS) --errorcheck-only $< > $@ 2>&1
+ @touch $@
+
+.m.ugly:
+ $(MC) --convert-to-mercury $(MCFLAGS) $<
+
+#-----------------------------------------------------------------------------#
+#
+# Rules for compiling C files in the user's source directory.
+#
.c.o:
$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $< -o $@
-# If we aren't removing the .c files, we generate .pic_o files
-# without invoking mmake.
-ifeq ($(RM_C),:)
.c.pic_o:
$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $< -o $@
-endif
.c.s:
$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -S $< -o $@
@@ -249,43 +225,32 @@
.c.i:
$(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -E $< > $@
-# If we aren't removing the .c files, we don't need to invoke mmake
-# for each .c file
-ifneq ($(RM_C),:)
-.m.o:
- $(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $*.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $*.c -o $@
- $(RM_C) $*.c
-
-.o.pic_o:
- $(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $*.c
- $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $*.c -o $@
-endif
+#-----------------------------------------------------------------------------#
+#
+# Rules for compiling C files in a subdirectory.
+# Note that we need both these rules and the ones above,
+# since even if the compiler generates all of its files in subdirectories,
+# the user may have some C files of their own which need to be compiled.
+#
-%.dir/*.o: %.m
- rm -f $@
- $(MCS) $(GRADEFLAGS) $(MCSFLAGS) $<
+ifneq ("$(cs_subdir)","")
-endif # !USE_SUBDIRS
+$(os_subdir)%.o : $(cs_subdir)%.c
+ $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -c $< -o $@
-.m.pl:
- sicstus_conv $<
+$(os_subdir)%.pic_o : $(cs_subdir)%.c
+ $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $< -o $@
-.nl.pl:
- sicstus_conv $<
+%.s: $(cs_subdir)%.c
+ $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -S $< -o $@
-# The `touch' is necessary, since otherwise if
-# the old .err file was of size zero and
-# the new .err file is also of size zero,
-# the time-stamp doesn't get updated!
-# (Is that a bug in unix? In bash?)
+%.pic_s: $(cs_subdir)%.c
+ $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -S $< -o $@
-.m.err:
- $(MC) $(MCFLAGS) --errorcheck-only $< > $@ 2>&1
- @touch $@
+%.i: $(cs_subdir)%.c
+ $(MGNUC) $(GRADEFLAGS) $(MGNUCFLAGS) -E $< > $@
-.m.ugly:
- $(MC) --convert-to-mercury $(MCFLAGS) $<
+endif # $(cs_subdir) != ""
#-----------------------------------------------------------------------------#
@@ -296,10 +261,14 @@
@
#-----------------------------------------------------------------------------#
+#
+# Targets for cleaning up.
+#
+# Note that the actions for most of these targets are in the
+# automatically generated `.d' files.
+#
-# The actions for `mmake clean' etc. are in the `.d' files.
-
-.PHONY: clean realclean clean_nu clean_sicstus
+.PHONY: clean realclean change_clean clean_nu clean_sicstus clean_prof_files
realclean: clean
cvs diff: I know nothing about scripts/Mmake.rules.in
Index: scripts/Mmake.vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.vars.in,v
retrieving revision 1.15
diff -u -r1.15 Mmake.vars.in
--- Mmake.vars.in 1998/03/03 17:47:02 1.15
+++ Mmake.vars.in 1998/03/19 15:39:29
@@ -96,6 +96,55 @@
RM_C = rm
#-----------------------------------------------------------------------------#
+#
+# The following variables specify the names of the subdirectories used,
+# so that you can write code which works both with and without the
+# `--use-subdirs' option.
+#
+
+ifeq ($(MMAKE_USE_SUBDIRS),yes)
+
+SUBDIR=Mercury/
+
+nos_subdir=$(SUBDIR)nos/
+qls_subdir=$(SUBDIR)qls/
+deps_subdir=$(SUBDIR)deps/
+int0s_subdir=$(SUBDIR)int0s/
+ints_subdir=$(SUBDIR)ints/
+int2s_subdir=$(SUBDIR)int2s/
+int3s_subdir=$(SUBDIR)int3s/
+opts_subdir=$(SUBDIR)opts/
+trans_opts_subdir=$(SUBDIR)trans_opts/
+date0s_subdir=$(SUBDIR)date0s/
+dates_subdir=$(SUBDIR)dates/
+date3s_subdir=$(SUBDIR)date3s/
+optdates_subdir=$(SUBDIR)optdates/
+trans_opt_dates_subdir=$(SUBDIR)trans_opt_dates/
+cs_subdir=$(SUBDIR)cs/
+os_subdir=$(SUBDIR)os/
+
+else
+
+SUBDIR=
+
+nos_subdir=
+qls_subdir=
+deps_subdir=
+ints_subdir=
+int2s_subdir=
+int3s_subdir=
+opts_subdir=
+trans_opts_subdir=
+dates_subdir=
+date3s_subdir=
+optdates_subdir=
+trans_opt_dates_subdir=
+cs_subdir=
+os_subdir=
+
+endif
+
+#-----------------------------------------------------------------------------#
# This needs to go here so that user Mmake files can add new suffixes.
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.49
diff -u -r1.49 bootcheck
--- bootcheck 1998/03/16 00:56:11 1.49
+++ bootcheck 1998/03/19 14:46:01
@@ -41,6 +41,9 @@
Don't rebuild the SICStus stage 2 directory from scratch after
building stage 1. Instead use the existing SICStus stage 2
directory.
+ --use-subdirs
+ Assume intermediate files are built in subdirectories.
+ (Same as the \`--use-subdirs' option to mmake and mmc.)
"
jfactor=""
@@ -53,6 +56,7 @@
keep_stage_3=false
keep_stage_2_sicstus=false
test_sicstus=false
+use_subdirs=${MMAKE_USE_SUBDIRS=no}
while [ $# -gt 0 ]; do
case "$1" in
@@ -97,6 +101,11 @@
--keep-stage-2-sicstus)
keep_stage_2_sicstus=true ;;
+ --use-subdirs)
+ use_subdirs=yes ;;
+ --no-use-subdirs)
+ use_subdirs=no ;;
+
--)
shift; break ;;
-*)
@@ -115,6 +124,13 @@
exit 1
fi
+case $use_subdirs in
+ yes) cs_subdir=Mercury/cs/
+ ;;
+ no) cs_subdir=
+ ;;
+esac
+
echo "starting at `date`"
set -x
@@ -275,10 +291,11 @@
fi
for dir in library compiler; do
- for file in stage2/$dir/*.c; do
- diff -u $file stage2_sicstus/$dir/`basename $file` ||
+ for file in stage2/$dir/${cs_subdir}*.c; do
+ diff -u $file \
+ stage2_sicstus/${cs_subdir}$dir/`basename $file` ||
sicstus_diff_status=1
- done
+ done
done
exec >&3 # restore stdout from fd 3
@@ -546,8 +563,9 @@
fi
for dir in library compiler; do
- for file in stage2/$dir/*.c; do
- diff -u $file stage3/$dir/`basename $file` || diff_status=1
+ for file in stage2/$dir/${cs_subdir}*.c; do
+ diff -u $file stage3/$dir/${cs_subdir}`basename $file` ||
+ diff_status=1
done
done
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list