mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 21:03:53 +00:00
Estimated hours taken: 1 Ensure that mmake does not attempt to remake the `.c' file if it is up-to-date. (This change should hopefully fix a problem with the source distribution not being able to bootstrap itself.) Also a couple of minor tidy-ups. scripts/mmake.in: Export new variable MMAKE_MAKE_CMD, for use by Mmake.rules. scripts/Mmake.rules: In the rule for `.m' -> `.o', use a recursive invocatino of make (via the MMAKE_MAKE_CMD variable) to build the `.c' file, rather than unconditionally invoking `$(MCG)'. scripts/.cvsignore: Add Mmake.vars, since it is now automatically-generated. scripts/ml.in: Some stylistic changes: make sure that autoconf @var@ variables occur only in assignments to shell variables at the start of the script, not scattered throughout the body of the script.
137 lines
3.0 KiB
Plaintext
137 lines
3.0 KiB
Plaintext
#-----------------------------------------------------------------------------#
|
|
# Copyright (C) 1995 University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public License - see the file COPYING in the Mercury distribution.
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Mmake.rules - rules for building Mercury programs
|
|
|
|
main_target: $(MAIN_TARGET)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Beware that the order of suffixes is significant.
|
|
.SUFFIXES: .pp .m .nl .no .err .int .int2 .dep .depend .doit .ugly \
|
|
.date .mod .c .nu .o .pic_o .i .s .garb .mod_h .ql .pl
|
|
|
|
.PRECIOUS: %.date
|
|
|
|
# All the builtin rules must use $@ as the target, so that they work
|
|
# when $(VPATH) is set.
|
|
|
|
.pp.m:
|
|
@-[ ! -f $@ ] || chmod +w $@
|
|
sed '/^#if *NU_PROLOG/,/^#endif/s/.*//' $< > $@
|
|
@-chmod -w $@
|
|
|
|
.m.no:
|
|
$(MNC) $(MNCFLAGS) -o $@ $<
|
|
|
|
.nl.no:
|
|
$(MNC) $(MNCFLAGS) -o $@ $<
|
|
|
|
.m.ql:
|
|
$(MSC) $(MSCFLAGS) -o $@ $<
|
|
|
|
.nl.ql:
|
|
$(MSC) $(MSCFLAGS) -o $@ $<
|
|
|
|
.m.pl:
|
|
sicstus_conv $<
|
|
|
|
.nl.pl:
|
|
sicstus_conv $<
|
|
|
|
# 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.date:
|
|
$(MCI) $(MCIFLAGS) $<
|
|
|
|
# do not remove the whitespace in the following two rules!
|
|
|
|
.date.int:
|
|
|
|
|
|
.date.int2:
|
|
|
|
|
|
.m.garb:
|
|
$(MCG) --garbage-collection accurate $(MCGFLAGS) $<
|
|
|
|
.m.ugly:
|
|
$(MC) --convert-to-mercury $(MCFLAGS) $<
|
|
|
|
.m.dep:
|
|
@-[ ! -f $*.dep ] || chmod +w $*.dep
|
|
$(MCD) $(MCDFLAGS) $<
|
|
@-chmod -w $*.dep
|
|
|
|
.m.depend:
|
|
@-[ ! -f $*.dep ] || chmod +w $*.dep
|
|
$(MCD) $(MCDFLAGS) $<
|
|
@-chmod -w $*.dep
|
|
-rm -f $*_init.c
|
|
|
|
.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 ]./' \
|
|
> $@
|
|
|
|
.m.c:
|
|
rm -f $*.c
|
|
$(MCG) -s $(GRADE) $(MCGFLAGS) $< > $*.err2 2>&1
|
|
|
|
# the next rule should be needed only in runtime in a short while
|
|
|
|
.mod.c:
|
|
[ -f $< ] && $(MOD2C) -s$(GRADE) $(MOD2CFLAGS) $< > $@
|
|
|
|
# the next rule will need changing (probably by Tyson)
|
|
|
|
.mod.mod_h:
|
|
[ -f $< ] && $(MOD2H) -s$(GRADE) $(MOD2HFLAGS) $< > $@
|
|
|
|
.c.o:
|
|
$(MGNUC) -s$(GRADE) $(MGNUCFLAGS) -c $< -o $@
|
|
|
|
.c.pic_o:
|
|
$(MGNUC) -s$(GRADE) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $< -o $@
|
|
|
|
.c.s:
|
|
$(MGNUC) -s$(GRADE) $(MGNUCFLAGS) -S $< -o $@
|
|
|
|
.c.i:
|
|
$(MGNUC) -s$(GRADE) $(MGNUCFLAGS) -E $< > $@
|
|
|
|
.m.o:
|
|
$(MMAKE_MAKE_CMD) $(MAKEOVERRIDES) $*.c
|
|
$(MGNUC) -s$(GRADE) $(MGNUCFLAGS) -c $*.c -o $@
|
|
$(RM_C) $*.c
|
|
|
|
.m.pic_o:
|
|
$(MCG) -s $(GRADE) $(MCGFLAGS) $< > $*.err2 2>&1
|
|
$(MGNUC) -s$(GRADE) $(MGNUCFLAGS) $(CFLAGS_FOR_PIC) -c $< -o $@
|
|
$(RM_C) $*.c
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# The actions for `mmake clean' etc. are in the `.d' files.
|
|
|
|
.PHONY: clean realclean clean_nu clean_sicstus
|
|
|
|
realclean: clean
|
|
|
|
#-----------------------------------------------------------------------------#
|