2013-02-06 Niels Möller <nisse@lysator.liu.se>
+ * config.make.in: Added .s to the suffix list.
+
+ * Makefile.in (.asm.s): Use a separate make target for .asm
+ preprocessing. Include asm.d, which the corresponding
+ dependencies.
+
+ * configure.ac (asm_file_list): Collect assembly files into this
+ variable.
+ (asm.d): Make config.status write dependencies for .s files into
+ asm.d.
+
* asm.m4: Use changecom to disable m4 quoting. Use divert to
suppress output.
des.$(OBJEXT): des.c des.h $(des_headers)
-.asm.$(OBJEXT):
- $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \
- $< >$*.s
- $(COMPILE) $(CCPIC_MAYBE) -c $*.s
- echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d
-
-.asm.p$(OBJEXT):
- $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \
- $< >$*.s
- $(COMPILE) $(SHLIBCFLAGS) -c $*.s -o $@
- echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d
+.asm.s:
+ $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$@T \
+ && test -s $@T && mv -f $@T $@
+
+.s.$(OBJEXT):
+ $(COMPILE) $(CCPIC_MAYBE) -c $<
+
+.s.p$(OBJEXT):
+ $(COMPILE) $(SHLIBCFLAGS) -c $< -o $@
# Texinfo rules
.texinfo.info:
tags-here:
etags -o $(srcdir)/TAGS $(srcdir)/*.c $(srcdir)/*.h
-DEP_FILES = $(SOURCES:.c=.$(OBJEXT).d) $(SOURCES:.c=.p$(OBJEXT).d)
+DEP_FILES = $(SOURCES:.c=.$(OBJEXT).d) $(SOURCES:.c=.p$(OBJEXT).d) asm.d
@DEP_INCLUDE@ $(DEP_FILES)
# compile was broken when .SUFFIXES was moved here from Makefile.in.
.SUFFIXES:
-.SUFFIXES: .asm .c .$(OBJEXT) .p$(OBJEXT) .html .dvi .info .exe .pdf .ps .texinfo
+.SUFFIXES: .asm .s .c .$(OBJEXT) .p$(OBJEXT) .html .dvi .info .exe .pdf .ps .texinfo
# Disable builtin rule
%$(EXEEXT) : %.c
esac
fi
# echo "enable_assembler: $enable_assembler, asm_path: $asm_path"
+asm_file_list=""
if test "x$enable_assembler" = xyes ; then
if test -n "$asm_path"; then
AC_MSG_NOTICE([Looking for assembler files in $asm_path/.])
- found=no
for tmp_f in aes-encrypt-internal.asm aes-decrypt-internal.asm \
arcfour-crypt.asm camellia-crypt-internal.asm \
md5-compress.asm memxor.asm \
# echo "Looking for $srcdir/$asm_path/$tmp_f"
if test -f "$srcdir/$asm_path/$tmp_f"; then
# echo found
- found=yes
+ asm_file_list="$asm_file_list $tmp_f"
AC_CONFIG_LINKS($tmp_f:$asm_path/$tmp_f)
fi
done
- if test "$found" = no; then
+ if test -z "$asm_file_list"; then
enable_assembler=no
AC_MSG_WARN([No assembler files found.])
fi
fi
fi
+# Besides getting correct dependencies, the explicit rules also tell
+# make that the .s files "ought to exist", so they are preferred over
+# .c files.
+AC_CONFIG_COMMANDS([asm.d],
+ [ for f in $asm_file_list
+ do
+ case $f in
+ *.asm)
+ echo "`basename $f .asm`.s : $f "'$(srcdir)/asm.m4 machine.m4 config.m4'
+ ;;
+ esac
+ done > asm.d
+ ],
+ [ asm_file_list="$asm_file_list" ]
+)
+
LSH_CCPIC
SHLIBCFLAGS="$CCPIC"