From: Niels Möller Date: Wed, 6 Feb 2013 09:47:53 +0000 (+0100) Subject: Use a separate make rule for m4 preprocessing of assembly files. X-Git-Tag: nettle_2.7_release_20130424~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76182f607b79464f4a1525c813665c699c122d8d;p=thirdparty%2Fnettle.git Use a separate make rule for m4 preprocessing of assembly files. --- diff --git a/ChangeLog b/ChangeLog index 1034cea4..9b86f7bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2013-02-06 Niels Möller + * 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. diff --git a/Makefile.in b/Makefile.in index c24ce352..1cd062d5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -241,17 +241,15 @@ $(des_headers): desdata.c 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: @@ -507,5 +505,5 @@ maintainer-clean-here: 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) diff --git a/config.make.in b/config.make.in index f42421fd..c1f2e5d4 100644 --- a/config.make.in +++ b/config.make.in @@ -81,7 +81,7 @@ default: all # 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 diff --git a/configure.ac b/configure.ac index e851ad0c..c6214bae 100644 --- a/configure.ac +++ b/configure.ac @@ -235,11 +235,11 @@ if test "x$enable_assembler" = xyes ; then 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 \ @@ -249,17 +249,33 @@ if test "x$enable_assembler" = xyes ; then # 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"