]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Use %-pattern rules instad of suffix rules. require-gnu-make
authorNiels Möller <nisse@lysator.liu.se>
Wed, 15 Jan 2020 20:38:45 +0000 (21:38 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 15 Jan 2020 20:38:45 +0000 (21:38 +0100)
ChangeLog
Makefile.in
config.make.in
examples/Makefile.in
testsuite/Makefile.in
tools/Makefile.in

index 75be32a5075eb0f17d627cd081c1e2fb572796b0..e2368f6bf36d5bce08bc17c823680e16ce0d5be2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2020-01-15  Niels Möller  <nisse@lysator.liu.se>
 
+       * Makefile.in: Replace suffix rules by pattern rules. Move .asm
+       rule above .c rule, since now the order of rules in the Makefile
+       matters, rather than the order in the .SUFFIXES list.
+       (aesdata, desdata, twofishdata, shadata, gcmdata, eccparams):
+       Individual rules replaced by a pattern rule.
+       (eccdata): Add explicit dependencies, to complement the pattern
+       rule.
+       * examples/Makefile.in: Replace suffix rules by pattern rules.
+       * testsuite/Makefile.in: Likewise.
+       * tools/Makefile.in: Likewise.
+
+       * config.make.in: Empty .SUFFIXES, to not accidentally use any
+       suffix rules.
+
        * aclocal.m4 (DEP_INCLUDE): Delete substituted variable.
 
        * Makefile.in: Use the GNU make directive -include to include
index 21d1c77dfcd89da36db5ef173ab41faecf325aae..5f88954bc027a26aba9f0867282913b2a57ab844 100644 (file)
@@ -269,7 +269,11 @@ libhogweed.a: $(hogweed_OBJS)
        $(RANLIB) $@
        echo hogweed > libhogweed.stamp
 
-.c.$(OBJEXT):
+%.$(OBJEXT): %.asm $(srcdir)/asm.m4 machine.m4 config.m4
+       $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$*.s
+       $(COMPILE) -c $*.s
+
+%.$(OBJEXT): %.c
        $(COMPILE) -c $< \
        && $(DEP_PROCESS)
 
@@ -296,36 +300,12 @@ $(LIBHOGWEED_FORLINK): $(hogweed_OBJS) $(LIBNETTLE_FORLINK)
               && $(LN_S) $(LIBHOGWEED_FORLINK) $(LIBHOGWEED_SONAME) ; } )
        echo hogweed > libhogweed.stamp
 
-# For Solaris and BSD make, we have to use an explicit rule for each
-# executable. Avoid object file targets to make it easy to run the
-# right compiler.
-aesdata$(EXEEXT_FOR_BUILD): aesdata.c
-       $(CC_FOR_BUILD) `test -f aesdata.c || echo '$(srcdir)/'`aesdata.c \
-       -o aesdata$(EXEEXT_FOR_BUILD)
-
-desdata$(EXEEXT_FOR_BUILD): desdata.c
-       $(CC_FOR_BUILD) `test -f desdata.c || echo '$(srcdir)/'`desdata.c \
-       -o desdata$(EXEEXT_FOR_BUILD)
-
-twofishdata$(EXEEXT_FOR_BUILD): twofishdata.c
-       $(CC_FOR_BUILD) `test -f twofishdata.c || echo '$(srcdir)/'`twofishdata.c \
-       -o twofishdata$(EXEEXT_FOR_BUILD)
-
-shadata$(EXEEXT_FOR_BUILD): shadata.c
-       $(CC_FOR_BUILD) `test -f shadata.c || echo '$(srcdir)/'`shadata.c -lm \
-       -o shadata$(EXEEXT_FOR_BUILD)
+# For building the various *data.c programs. -lm needed for shadata.
+%$(EXEEXT_FOR_BUILD): %.c
+       $(CC_FOR_BUILD) $< -lm -o $@
 
-gcmdata$(EXEEXT_FOR_BUILD): gcmdata.c
-       $(CC_FOR_BUILD) `test -f gcmdata.c || echo '$(srcdir)/'`gcmdata.c \
-       -o gcmdata$(EXEEXT_FOR_BUILD)
-
-eccdata$(EXEEXT_FOR_BUILD): eccdata.c mini-gmp.c mini-gmp.h
-       $(CC_FOR_BUILD) `test -f eccdata.c || echo '$(srcdir)/'`eccdata.c \
-       -o eccdata$(EXEEXT_FOR_BUILD)
-
-eccparams$(EXEEXT_FOR_BUILD): eccparams.c
-       $(CC_FOR_BUILD) `test -f eccparams.c || echo '$(srcdir)/'`eccparams.c \
-       -o eccparams$(EXEEXT_FOR_BUILD)
+# Explicit dependency.
+eccdata$(EXEEXT_FOR_BUILD): mini-gmp.c mini-gmp.h
 
 # desCore rules
 # It seems using $(srcdir)/ doesn't work with GNU make 3.79.1
@@ -408,29 +388,24 @@ ecc-secp256r1.$(OBJEXT): ecc-secp256r1.h
 ecc-secp384r1.$(OBJEXT): ecc-secp384r1.h
 ecc-secp521r1.$(OBJEXT): ecc-secp521r1.h
 
-.asm.$(OBJEXT): $(srcdir)/asm.m4 machine.m4 config.m4
-       $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$*.s
-       $(COMPILE) -c $*.s
-       @echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d 
-
 # Texinfo rules
-.texinfo.info:
+%.info: %.texinfo
        cd $(srcdir) && $(MAKEINFO) --output $@ `basename "$<"`
 
-.texinfo.html:
+%.html: %.texinfo
        cd $(srcdir) && $(MAKEINFO) --html --no-split \
          --output $@T `basename "$<"` \
          && test -s $@T && mv -f $@T $@
 
-.texinfo.dvi:
+%.dvi: %.texinfo
        cd $(srcdir) && texi2dvi -b `basename "$<"`
 
-.dvi.ps:
+%.ps: %.dvi
        cd $(srcdir) && dvips -Ppdf -G0 -o `basename "$<" .dvi`.ps `basename "$<"`
 
 # Avoid rebuilding .dvi and .ps files when the .texinfo source is unchanged.
 PS2PDFFLAGS=-dCompatibilityLevel=1.3 -dMAxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true
-.texinfo.pdf:
+%.pdf: %.texinfo
        $(MAKE) `basename "$<" .texinfo`.ps
        cd $(srcdir) && ps2pdf $(PS2PDFFLAGS) `basename "$<" .texinfo`.ps
 
index af2068ce34254bfb912039c387a18d091ede12a3..649b769515a045c0ee94655a77ac5f1e8b185986 100644 (file)
@@ -77,17 +77,11 @@ LINK_CXX = $(CXX) $(CXXFLAGS) $(PRE_LDFLAGS) $(LDFLAGS)
 # usual targets.
 default: all
 
-# For some reason the suffixes list must be set before the rules.
-# Otherwise BSD make won't build binaries e.g. aesdata. On the other
-# hand, AIX make has the opposite idiosyncrasies to BSD, and the AIX
-# compile was broken when .SUFFIXES was moved here from Makefile.in.
-
+# Don't use any old-fashioned suffix rules.
 .SUFFIXES:
-.SUFFIXES: .asm .c .$(OBJEXT) .html .dvi .info .exe .pdf .ps .texinfo
 
 # Disable builtin rule
 %$(EXEEXT) : %.c
-.c:
 
 # Keep object files
 .PRECIOUS: %.o
index 7075e889763d403711ed9423a961b01f77737be3..db8e91cceeea57a74911915511b334e1d56ab5b8 100644 (file)
@@ -40,7 +40,7 @@ DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \
 
 all: $(TARGETS)
 
-.c.$(OBJEXT):
+%.$(OBJEXT): %.c
        $(COMPILE) -c $< && $(DEP_PROCESS)
 
 # NOTE: If we required GNU make, we could use a single rule with $(@F)
index adde619de211b0e8cbce5da1d6799710621c0aec..dea6c28d2f20172233de38759d3740437e860a7e 100644 (file)
@@ -79,11 +79,10 @@ DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \
 
 all: $(EXTRA_TARGETS)
 
-.c.$(OBJEXT):
+%.$(OBJEXT): %.c
        $(COMPILE) -c $< && $(DEP_PROCESS)
 
-.SUFFIXES: .cxx
-.cxx.$(OBJEXT):
+%.$(OBJEXT): %.cxx
        $(COMPILE_CXX) -c $< && $(DEP_PROCESS)
 
 # BSD (and Solaris) make doesn't allow extra dependencies together one
index eb12a7f685e165a3dda004ccbe44f00f3a82eaf6..4bdb11fbbcbf6d5c69b8ab5ac8b76378377ba192 100644 (file)
@@ -56,7 +56,7 @@ nettle-pbkdf2$(EXEEXT): $(nettle_pbkdf2_OBJS) ../libnettle.stamp
        $(LINK) $(nettle_pbkdf2_OBJS) -lnettle -o $@
 
 
-.c.$(OBJEXT):
+%.$(OBJEXT): %.c
        $(COMPILE) -c $< && $(DEP_PROCESS)
 
 # NOTE: If we required GNU make, we could use a single rule with $(@F)