mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-19 15:54:18 +00:00
Mmake.rules: In the rule for making foo.depend, make sure to remove foo_init.c. This will ensure that it gets remade if necessary. (Previously this wasn't necessary since it always got remaid whenever any of the .m files changed.)
185 lines
3.6 KiB
Plaintext
185 lines
3.6 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)
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
.SUFFIXES: .pp .m .nl .no .err .int .int2 .dep .depend .doit .ugly \
|
|
.date .mod .c .nu .o .pic_o .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) $< > $@ 2>&1
|
|
@touch $@
|
|
|
|
.m.date:
|
|
$(MCI) $(MCFLAGS) $(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) $(PIC) -c $< -o $@
|
|
|
|
.c.s:
|
|
$(MGNUC) -s$(GRADE) $(MGNUCFLAGS) -S $< -o $@
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Clean up some mess
|
|
|
|
# You can attach new dependencies to the `clean' and `realclean' targets
|
|
# to make them clean up more than just the stuff listed here.
|
|
|
|
.PHONY: clean
|
|
clean: clean_no clean_ns clean_err clean_err2 clean_ints clean_ugly \
|
|
clean_hlds_dump clean_c clean_o clean_s
|
|
|
|
.PHONY: clean_no
|
|
clean_no:
|
|
-rm -f *.no
|
|
|
|
.PHONY: clean_ns
|
|
clean_ns:
|
|
-rm -f *.ns
|
|
|
|
.PHONY: clean_err
|
|
clean_err:
|
|
-rm -f *.err
|
|
|
|
.PHONY: clean_err2
|
|
clean_err2:
|
|
-rm -f *.err2
|
|
|
|
.PHONY: clean_ints
|
|
clean_ints:
|
|
-rm -f *.int *.int2 *.date
|
|
|
|
.PHONY: clean_ugly
|
|
clean_ugly:
|
|
-rm -f *.ugly
|
|
|
|
.PHONY: clean_hlds_dump
|
|
clean_hlds_dump:
|
|
-rm -f *.hlds_dump*
|
|
|
|
.PHONY: clean_c
|
|
clean_c:
|
|
$(CLEAN_C)
|
|
|
|
.PHONY: clean_o
|
|
clean_o:
|
|
-rm -f *.o *.pic_o
|
|
|
|
.PHONY: clean_s
|
|
clean_s:
|
|
$(CLEAN_S)
|
|
|
|
.PHONY: realclean
|
|
realclean: clean clean_deps clean_nu clean_progs clean_libs
|
|
|
|
.PHONY: clean_deps
|
|
clean_deps:
|
|
-rm -f *.dep *.d
|
|
|
|
.PHONY: clean_nu
|
|
clean_nu:
|
|
-rm -f *.nu *.save
|
|
|
|
.PHONY: clean_progs
|
|
clean_progs: clean_a_out
|
|
|
|
.PHONY: clean_a_out
|
|
clean_a_out:
|
|
-rm -f a.out
|
|
|
|
.PHONY: clean_libs
|
|
clean_libs:
|
|
-rm -f *.a *.so
|
|
|
|
#-----------------------------------------------------------------------------#
|