From ccba38ec8ca6003edb5f424a17f07c46d40a18a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Wed, 2 Jan 2013 08:31:52 +0100
Subject: [PATCH] Fixed make rules for building objects in parent directory.

---
 ChangeLog             |  7 +++++++
 examples/Makefile.in  | 10 ++++++++--
 testsuite/Makefile.in |  2 +-
 tools/Makefile.in     |  8 ++++++--
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 110342df..e30a0f7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-01-02  Niels Möller  <nisse@lysator.liu.se>
+
+	* examples/Makefile.in: Explicit rules for building objects in
+	parent directory.
+	* tools/Makefile.in: Likewise.
+	* testsuite/Makefile.in: Likewise.
+
 2013-01-01  Niels Möller  <nisse@lysator.liu.se>
 
 	* nettle.texinfo (Recommended hash functions): Document additional
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 3becd088..71af8d43 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -39,8 +39,14 @@ all: $(TARGETS)
 .c.$(OBJEXT):
 	$(COMPILE) -c $< && $(DEP_PROCESS)
 
-$(getopt_OBJS) ../nettle-internal.$(OBJEXT):
-	( cd .. && $(MAKE) $@ )
+# NOTE: If we required GNU make, we could use a single rule with $(@F)
+# or $(notdir $@)
+../getopt.$(OBJEXT):
+	( cd .. && $(MAKE) getopt.$(OBJEXT))
+../getopt1.$(OBJEXT):
+	( cd .. && $(MAKE) getopt1.$(OBJEXT))
+../nettle-internal.$(OBJEXT):
+	( cd .. && $(MAKE) nettle-internal.$(OBJEXT))
 
 # For Solaris and BSD make, we have to use an explicit rule for each executable
 next-prime$(EXEEXT): next-prime.$(OBJEXT) $(GETOPT_OBJS) ../libhogweed.a
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index 9f2c6c6b..71e133f9 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -75,7 +75,7 @@ TEST_OBJS = testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
 	    $(LIB_HOGWEED) -lnettle $(LIBS)
 
 ../nettle-internal.$(OBJEXT):
-	( cd .. && $(MAKE) $@ )
+	( cd .. && $(MAKE) nettle-internal.$(OBJEXT) )
 
 .PHONY: test-rules
 test-rules:
diff --git a/tools/Makefile.in b/tools/Makefile.in
index a14e908b..29d55e88 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -53,8 +53,12 @@ nettle-hash$(EXEEXT): $(nettle_hash_OBJS) ../libnettle.a
 .c.$(OBJEXT):
 	$(COMPILE) -c $< && $(DEP_PROCESS)
 
-$(getopt_OBJS):
-	( cd .. && $(MAKE) $@ )
+# NOTE: If we required GNU make, we could use a single rule with $(@F)
+# or $(notdir $@)
+../getopt.$(OBJEXT):
+	( cd .. && $(MAKE) getopt.$(OBJEXT))
+../getopt1.$(OBJEXT):
+	( cd .. && $(MAKE) getopt1.$(OBJEXT))
 
 Makefile: $(srcdir)/Makefile.in ../config.status
 	cd .. && $(SHELL) ./config.status tools/$@
-- 
GitLab