summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2020-01-15 21:38:45 +0100
committerNiels Möller <nisse@lysator.liu.se>2020-01-15 21:38:45 +0100
commitd1dbba1e7fcf4ad54e5d3435e381ae336c36cf2a (patch)
treea85c8623a868e49373846333451f14a53690151c
parent574272317865c07614706356e7062ca0b30e21c6 (diff)
downloadnettle-require-gnu-make.tar.gz
Use %-pattern rules instad of suffix rules.require-gnu-make
-rw-r--r--ChangeLog14
-rw-r--r--Makefile.in55
-rw-r--r--config.make.in8
-rw-r--r--examples/Makefile.in2
-rw-r--r--testsuite/Makefile.in5
-rw-r--r--tools/Makefile.in2
6 files changed, 34 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 75be32a5..e2368f6b 100644
--- 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
diff --git a/Makefile.in b/Makefile.in
index 21d1c77d..5f88954b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -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
diff --git a/config.make.in b/config.make.in
index af2068ce..649b7695 100644
--- a/config.make.in
+++ b/config.make.in
@@ -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
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 7075e889..db8e91cc 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -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)
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index adde619d..dea6c28d 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -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
diff --git a/tools/Makefile.in b/tools/Makefile.in
index eb12a7f6..4bdb11fb 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -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)