[m-rev.] for review: avoid generating files in the wrong directory
Simon Taylor
stayl at cs.mu.OZ.AU
Mon Jun 10 03:51:39 AEST 2002
Estimated hours taken: 0.5
Branches: main
scripts/Mmake.rules:
Avoid generating interface files for the library in
the compiler directory by stripping the directory
from the module name passed to mmc.
Index: Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.124
diff -u -u -r1.124 Mmake.rules
--- Mmake.rules 31 May 2002 07:02:37 -0000 1.124
+++ Mmake.rules 9 Jun 2002 17:45:47 -0000
@@ -8,6 +8,11 @@
# N.B. All the builtin rules must use $@ as the target, so that they work
# when $(VPATH) is set.
+#
+# When passing a module to mmc, strip off the directory part of the
+# name. This way the compiler will report an error if the source file
+# is in another directory, rather than generating interface files in
+# the wrong directory.
main_target: $(MAIN_TARGET)
@@ -132,19 +137,19 @@
ifeq ($(MMAKE_USE_MMC_MAKE), no)
$(date0s_subdir)%.date0 : %.m
- $(MCPI) $(ALL_MCPIFLAGS) $<
+ $(MCPI) $(ALL_MCPIFLAGS) $(*F)
$(dates_subdir)%.date : %.m
- $(MCI) $(ALL_MCIFLAGS) $<
+ $(MCI) $(ALL_MCIFLAGS) $(*F)
$(date3s_subdir)%.date3 : %.m
- $(MCSI) $(ALL_MCSIFLAGS) $<
+ $(MCSI) $(ALL_MCSIFLAGS) $(*F)
$(optdates_subdir)%.optdate : %.m
- $(MCOI) $(ALL_MCOIFLAGS) $<
+ $(MCOI) $(ALL_MCOIFLAGS) $(*F)
$(trans_opt_dates_subdir)%.trans_opt_date : %.m
- $(MCTOI) $(ALL_MCTOIFLAGS) $<
+ $(MCTOI) $(ALL_MCTOIFLAGS) $(*F)
# Be very careful about changing the following rules.
# The `@:' is a silent do-nothing command.
@@ -195,11 +200,11 @@
$(s_dates_subdir)%.s_date : %.m
$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
- $< > $*.err 2>&1
+ $(*F) > $(*F).err 2>&1
$(pic_s_dates_subdir)%.pic_s_date : %.m
$(MCG) $(ALL_GRADEFLAGS) --target-code-only $(ALL_MCGFLAGS) \
- --pic --cflags "$(GCCFLAGS_FOR_PIC)" $< > $*.err 2>&1
+ --pic --cflags "$(GCCFLAGS_FOR_PIC)" $(*F) > $(*F).err 2>&1
$(os_subdir)%.$O : $(ss_subdir)%.s
$(AS) $< $(OBJFILE_OPT)$@
@@ -229,11 +234,12 @@
@:
$(c_dates_subdir)%.c_date : %.m
- $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) $< > $*.err 2>&1
+ $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) $(*F) > $(*F).err 2>&1
# Aditi-RL back-end
$(rlos_subdir)%.rlo : %.m
- $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) --aditi-only $< > $*.err 2>&1
+ $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) \
+ --aditi-only $(*F) > $(*F).err 2>&1
# Java back-end
@@ -250,7 +256,8 @@
@:
$(java_dates_subdir)%.java_date : %.m
- $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) --java-only $< > $*.err 2>&1
+ $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) \
+ --java-only $(*F) > $(*F).err 2>&1
# .NET back-end
@@ -260,7 +267,8 @@
@:
$(il_dates_subdir)%.il_date : %.m
- $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) --il-only $< > $*.err 2>&1
+ $(MCG) $(ALL_GRADEFLAGS) $(ALL_MCGFLAGS) \
+ --il-only $(*F) > $(*F).err 2>&1
# These rules are only available in *il* backends, because we'd like to avoid
# processing user code that is in a .cpp file, and we'd like to avoid going via
@@ -291,7 +299,7 @@
$(dirs_subdir)%.dir/*.$O: %.m
rm -f $@
- $(MCS) $(ALL_GRADEFLAGS) $(ALL_MCSFLAGS) $<
+ $(MCS) $(ALL_GRADEFLAGS) $(ALL_MCSFLAGS) $(*F)
# The `touch' is necessary, since otherwise if
# the old .err file was of size zero and
@@ -300,11 +308,11 @@
# (Is that a bug in unix? In bash?)
.m.err:
- $(MCE) $(ALL_MCFLAGS) $< > $@ 2>&1
+ $(MCE) $(ALL_MCFLAGS) $(*F) > $@ 2>&1
@touch $@
.m.ugly:
- $(MC) --convert-to-mercury $(ALL_MCFLAGS) $<
+ $(MC) --convert-to-mercury $(ALL_MCFLAGS) $(*F)
endif # MMAKE_USE_MMC_MAKE == no
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list