Commit d1dbba1e authored by Niels Möller's avatar Niels Möller

Use %-pattern rules instad of suffix rules.

parent 57427231
2020-01-15 Niels Möller <nisse@lysator.liu.se> 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. * aclocal.m4 (DEP_INCLUDE): Delete substituted variable.
* Makefile.in: Use the GNU make directive -include to include * Makefile.in: Use the GNU make directive -include to include
......
...@@ -269,7 +269,11 @@ libhogweed.a: $(hogweed_OBJS) ...@@ -269,7 +269,11 @@ libhogweed.a: $(hogweed_OBJS)
$(RANLIB) $@ $(RANLIB) $@
echo hogweed > libhogweed.stamp 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 $< \ $(COMPILE) -c $< \
&& $(DEP_PROCESS) && $(DEP_PROCESS)
...@@ -296,36 +300,12 @@ $(LIBHOGWEED_FORLINK): $(hogweed_OBJS) $(LIBNETTLE_FORLINK) ...@@ -296,36 +300,12 @@ $(LIBHOGWEED_FORLINK): $(hogweed_OBJS) $(LIBNETTLE_FORLINK)
&& $(LN_S) $(LIBHOGWEED_FORLINK) $(LIBHOGWEED_SONAME) ; } ) && $(LN_S) $(LIBHOGWEED_FORLINK) $(LIBHOGWEED_SONAME) ; } )
echo hogweed > libhogweed.stamp echo hogweed > libhogweed.stamp
# For Solaris and BSD make, we have to use an explicit rule for each # For building the various *data.c programs. -lm needed for shadata.
# executable. Avoid object file targets to make it easy to run the %$(EXEEXT_FOR_BUILD): %.c
# right compiler. $(CC_FOR_BUILD) $< -lm -o $@
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)
gcmdata$(EXEEXT_FOR_BUILD): gcmdata.c # Explicit dependency.
$(CC_FOR_BUILD) `test -f gcmdata.c || echo '$(srcdir)/'`gcmdata.c \ eccdata$(EXEEXT_FOR_BUILD): mini-gmp.c mini-gmp.h
-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)
# desCore rules # desCore rules
# It seems using $(srcdir)/ doesn't work with GNU make 3.79.1 # It seems using $(srcdir)/ doesn't work with GNU make 3.79.1
...@@ -408,29 +388,24 @@ ecc-secp256r1.$(OBJEXT): ecc-secp256r1.h ...@@ -408,29 +388,24 @@ ecc-secp256r1.$(OBJEXT): ecc-secp256r1.h
ecc-secp384r1.$(OBJEXT): ecc-secp384r1.h ecc-secp384r1.$(OBJEXT): ecc-secp384r1.h
ecc-secp521r1.$(OBJEXT): ecc-secp521r1.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 rules
.texinfo.info: %.info: %.texinfo
cd $(srcdir) && $(MAKEINFO) --output $@ `basename "$<"` cd $(srcdir) && $(MAKEINFO) --output $@ `basename "$<"`
.texinfo.html: %.html: %.texinfo
cd $(srcdir) && $(MAKEINFO) --html --no-split \ cd $(srcdir) && $(MAKEINFO) --html --no-split \
--output $@T `basename "$<"` \ --output $@T `basename "$<"` \
&& test -s $@T && mv -f $@T $@ && test -s $@T && mv -f $@T $@
.texinfo.dvi: %.dvi: %.texinfo
cd $(srcdir) && texi2dvi -b `basename "$<"` cd $(srcdir) && texi2dvi -b `basename "$<"`
.dvi.ps: %.ps: %.dvi
cd $(srcdir) && dvips -Ppdf -G0 -o `basename "$<" .dvi`.ps `basename "$<"` cd $(srcdir) && dvips -Ppdf -G0 -o `basename "$<" .dvi`.ps `basename "$<"`
# Avoid rebuilding .dvi and .ps files when the .texinfo source is unchanged. # Avoid rebuilding .dvi and .ps files when the .texinfo source is unchanged.
PS2PDFFLAGS=-dCompatibilityLevel=1.3 -dMAxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true PS2PDFFLAGS=-dCompatibilityLevel=1.3 -dMAxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true
.texinfo.pdf: %.pdf: %.texinfo
$(MAKE) `basename "$<" .texinfo`.ps $(MAKE) `basename "$<" .texinfo`.ps
cd $(srcdir) && ps2pdf $(PS2PDFFLAGS) `basename "$<" .texinfo`.ps cd $(srcdir) && ps2pdf $(PS2PDFFLAGS) `basename "$<" .texinfo`.ps
......
...@@ -77,17 +77,11 @@ LINK_CXX = $(CXX) $(CXXFLAGS) $(PRE_LDFLAGS) $(LDFLAGS) ...@@ -77,17 +77,11 @@ LINK_CXX = $(CXX) $(CXXFLAGS) $(PRE_LDFLAGS) $(LDFLAGS)
# usual targets. # usual targets.
default: all default: all
# For some reason the suffixes list must be set before the rules. # Don't use any old-fashioned suffix 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.
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .asm .c .$(OBJEXT) .html .dvi .info .exe .pdf .ps .texinfo
# Disable builtin rule # Disable builtin rule
%$(EXEEXT) : %.c %$(EXEEXT) : %.c
.c:
# Keep object files # Keep object files
.PRECIOUS: %.o .PRECIOUS: %.o
......
...@@ -40,7 +40,7 @@ DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \ ...@@ -40,7 +40,7 @@ DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \
all: $(TARGETS) all: $(TARGETS)
.c.$(OBJEXT): %.$(OBJEXT): %.c
$(COMPILE) -c $< && $(DEP_PROCESS) $(COMPILE) -c $< && $(DEP_PROCESS)
# NOTE: If we required GNU make, we could use a single rule with $(@F) # NOTE: If we required GNU make, we could use a single rule with $(@F)
......
...@@ -79,11 +79,10 @@ DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \ ...@@ -79,11 +79,10 @@ DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \
all: $(EXTRA_TARGETS) all: $(EXTRA_TARGETS)
.c.$(OBJEXT): %.$(OBJEXT): %.c
$(COMPILE) -c $< && $(DEP_PROCESS) $(COMPILE) -c $< && $(DEP_PROCESS)
.SUFFIXES: .cxx %.$(OBJEXT): %.cxx
.cxx.$(OBJEXT):
$(COMPILE_CXX) -c $< && $(DEP_PROCESS) $(COMPILE_CXX) -c $< && $(DEP_PROCESS)
# BSD (and Solaris) make doesn't allow extra dependencies together one # BSD (and Solaris) make doesn't allow extra dependencies together one
......
...@@ -56,7 +56,7 @@ nettle-pbkdf2$(EXEEXT): $(nettle_pbkdf2_OBJS) ../libnettle.stamp ...@@ -56,7 +56,7 @@ nettle-pbkdf2$(EXEEXT): $(nettle_pbkdf2_OBJS) ../libnettle.stamp
$(LINK) $(nettle_pbkdf2_OBJS) -lnettle -o $@ $(LINK) $(nettle_pbkdf2_OBJS) -lnettle -o $@
.c.$(OBJEXT): %.$(OBJEXT): %.c
$(COMPILE) -c $< && $(DEP_PROCESS) $(COMPILE) -c $< && $(DEP_PROCESS)
# NOTE: If we required GNU make, we could use a single rule with $(@F) # NOTE: If we required GNU make, we could use a single rule with $(@F)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment