]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Use a separate make rule for m4 preprocessing of assembly files.
authorNiels Möller <nisse@lysator.liu.se>
Wed, 6 Feb 2013 09:47:53 +0000 (10:47 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 6 Feb 2013 09:47:53 +0000 (10:47 +0100)
ChangeLog
Makefile.in
config.make.in
configure.ac

index 1034cea45169b4f3ae875f03d46d9427fa22e67c..9b86f7bde26d28df4e268c9a347eef2b7ad81d20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 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.
 
index c24ce352c1bcd9e27b1c6bbd255bcbafbffa5360..1cd062d56bb6a517b409b9b5f807b1551bdd5ad2 100644 (file)
@@ -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)
index f42421fd22376a3afc6cf41b29650090c8f8ee63..c1f2e5d485e62b3774f5381780616f89f169f7cf 100644 (file)
@@ -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
index e851ad0caa9753665e4702cf14e7d46ee26ff028..c6214baee1250d9c1812f7e304d8dfe2ec46745e 100644 (file)
@@ -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"