diff --git a/Makefile.am b/Makefile.am index 9e5007881..ca14370b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -102,21 +102,25 @@ QCOMPILE=$(QFCC) $(QCFLAGS) $(QCPPFLAGS) QLINK=$(QFCC) $(QCFLAGS) $(QCLINKFLAGS) MKDIR_P = @MKDIR_P@ +qfcc_compile=\ + $(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(QCOMPILE) $(1) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\ + sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\ + $(am__mv) $$depbase.Tqo $$depbase.Qo + am__mv = mv -f SUFFIXES=.o .r .pas +%_v6p.o: %.r + $(call qfcc_compile,-Ctarget=v6p) +%_v6.o: %.r + $(call qfcc_compile,-Ctarget=v6) .r.o: - $(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(QCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\ - sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\ - $(am__mv) $$depbase.Tqo $$depbase.Qo + $(qfcc_compile) .pas.o: - $(V_QFCC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ - $(QCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tqo -c -o $@ $< &&\ - sed -i -e '1s@:@: $(QFCC_DEP)@' $$depbase.Tqo &&\ - $(am__mv) $$depbase.Tqo $$depbase.Qo + $(qfcc_compile) -qcautodep = $(join $(addsuffix $(DEPDIR)/,$(dir $(basename $(1)))),$(addsuffix .Qo,$(notdir $(basename $(basename $(1)))))) +qcautodep = $(join $(addsuffix $(DEPDIR)/,$(dir $(basename $(1)))),$(addsuffix $(2).Qo,$(notdir $(basename $(basename $(1)))))) r_depfiles_remade= pas_depfiles_remade= diff --git a/tools/qfcc/test/Makemodule.am b/tools/qfcc/test/Makemodule.am index 216d66c30..a590a50b7 100644 --- a/tools/qfcc/test/Makemodule.am +++ b/tools/qfcc/test/Makemodule.am @@ -37,6 +37,9 @@ test_progs_dat=\ tools/qfcc/test/gcd.dat \ tools/qfcc/test/ifsuper.dat \ tools/qfcc/test/infloop.dat \ + tools/qfcc/test/inout.dat \ + tools/qfcc/test/inout_v6.dat \ + tools/qfcc/test/inout_v6p.dat \ tools/qfcc/test/iterfunc.dat \ tools/qfcc/test/ivar-struct-return.dat \ tools/qfcc/test/link_order.dat \ @@ -493,6 +496,36 @@ tools/qfcc/test/infloop.run: $(qfcc_test_run_deps) include $(infloop_dep) # am--include-marker r_depfiles_remade += $(infloop_dep) +tools_qfcc_test_inout_dat_SOURCES=tools/qfcc/test/inout.r +inout_obj=$(tools_qfcc_test_inout_dat_SOURCES:.r=.o) +inout_dep=$(call qcautodep,$(tools_qfcc_test_inout_dat_SOURCES)) +tools/qfcc/test/inout.dat$(EXEEXT): $(inout_obj) $(QFCC_DEP) + $(V_QFCCLD)$(QLINK) -o $@ $(inout_obj) +tools/qfcc/test/inout.run: $(qfcc_test_run_deps) + @TEST_HARNESS_OPTS=--float $(top_srcdir)/tools/qfcc/test/build-run $@ +include $(inout_dep) # am--include-marker +r_depfiles_remade += $(inout_dep) + +tools_qfcc_test_inout_v6_dat_SOURCES=tools/qfcc/test/inout.r +inout_v6_obj=$(tools_qfcc_test_inout_v6_dat_SOURCES:.r=_v6.o) +inout_v6_dep=$(call qcautodep,$(tools_qfcc_test_inout_v6_dat_SOURCES,_v6)) +tools/qfcc/test/inout_v6.dat$(EXEEXT): $(inout_v6_obj) $(QFCC_DEP) + $(V_QFCCLD)$(QLINK) -Ctarget=v6 -o $@ $(inout_v6_obj) +tools/qfcc/test/inout_v6.run: $(qfcc_test_run_deps) + @TEST_HARNESS_OPTS=--float $(top_srcdir)/tools/qfcc/test/build-run $@ +include $(inout_v6_dep) # am--include-marker +r_depfiles_remade += $(inout_v6_dep) + +tools_qfcc_test_inout_v6p_dat_SOURCES=tools/qfcc/test/inout.r +inout_v6p_obj=$(tools_qfcc_test_inout_v6p_dat_SOURCES:.r=_v6p.o) +inout_v6p_dep=$(call qcautodep,$(tools_qfcc_test_inout_v6p_dat_SOURCES,_v6p)) +tools/qfcc/test/inout_v6p.dat$(EXEEXT): $(inout_v6p_obj) $(QFCC_DEP) + $(V_QFCCLD)$(QLINK) -Ctarget=v6p -o $@ $(inout_v6p_obj) +tools/qfcc/test/inout_v6p.run: $(qfcc_test_run_deps) + @TEST_HARNESS_OPTS=--float $(top_srcdir)/tools/qfcc/test/build-run $@ +include $(inout_v6p_dep) # am--include-marker +r_depfiles_remade += $(inout_v6p_dep) + tools_qfcc_test_iterfunc_dat_SOURCES=tools/qfcc/test/iterfunc.r iterfunc_obj=$(tools_qfcc_test_iterfunc_dat_SOURCES:.r=.o) iterfunc_dep=$(call qcautodep,$(tools_qfcc_test_iterfunc_dat_SOURCES)) diff --git a/tools/qfcc/test/inout.r b/tools/qfcc/test/inout.r new file mode 100644 index 000000000..92b987bec --- /dev/null +++ b/tools/qfcc/test/inout.r @@ -0,0 +1,21 @@ +float project (vector a, vector b, @out vector p) +{ + float d = a @dot b / b @dot b; + p = a - d * b; + return d; +} + +void printf (string fmt, ...) = #0; + +float +main () +{ + vector a = '1 3 2'; + vector b = '4 0 3'; + vector c; + float d = project (a, b, c) != 0.4; + printf ("%.9v\n", c); + if (c != '-0.6 3 0.799999952') + d = 1; + return d; +}