public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: Makefile.am: fix DLL build rule
Date: Wed,  2 Feb 2022 20:44:44 +0000 (GMT)	[thread overview]
Message-ID: <20220202204444.94E4C385AC33@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ba02fef995ac3fef5c67260015c2ef754943643a

commit ba02fef995ac3fef5c67260015c2ef754943643a
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Feb 2 21:16:35 2022 +0100

    Cygwin: Makefile.am: fix DLL build rule
    
    A single Makefile rule creates three files in three steps, the second
    and third one never showing up in dependencies.  The next step creating
    the link lib only depends on the first of these files.  Even if the
    second or third step in the DLL build rule fails, the next make
    invocation never picks up on this and just goes ahead creating the
    link lib.
    
    Fix this by splitting the DLL build rule into three rules, with
    every step on the way depending on the previous rule.  Also fix up
    the names, TEST_DLL_NAME just doesn't cut it.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/Makefile.am | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index 8d55e1693..28c143434 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -40,7 +40,9 @@ toolincludedir=$(tooldir)/include
 # Parameters used in building the cygwin.dll.
 
 DLL_NAME=cygwin1.dll
-TEST_DLL_NAME=cygwin0.dll
+PRE_DLL_NAME=cygwin0.dll
+DBG_DLL_NAME=cygwin1.dbg
+NEW_DLL_NAME=new-cygwin1.dll
 DIN_FILE=@DIN_FILE@
 DEF_FILE=cygwin.def
 TLSOFFSETS_H=@TLSOFFSETS_H@
@@ -623,7 +625,7 @@ $(LDSCRIPT): $(LDSCRIPT).in
 	$(AM_V_GEN)$(CC) -E - -P < $^ -o $@
 
 # cygwin dll
-$(TEST_DLL_NAME): $(LDSCRIPT) dllfixdbg libdll.a $(VERSION_OFILES) $(LIBSERVER)\
+$(PRE_DLL_NAME): $(LDSCRIPT) dllfixdbg libdll.a $(VERSION_OFILES) $(LIBSERVER)\
 		  $(newlib_build)/libm/libm.a $(newlib_build)/libc/libc.a
 	$(AM_V_CXXLD)$(CXX) $(CXXFLAGS) \
 	-mno-use-libstdc-wrappers \
@@ -636,8 +638,12 @@ $(TEST_DLL_NAME): $(LDSCRIPT) dllfixdbg libdll.a $(VERSION_OFILES) $(LIBSERVER)\
 	$(newlib_build)/libm/libm.a \
 	$(newlib_build)/libc/libc.a \
 	-lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map
-	@$(srcdir)/dllfixdbg $(OBJDUMP) $(OBJCOPY) $@ cygwin1.dbg
-	@ln -f $@ new-cygwin1.dll
+
+$(DBG_DLL_NAME): $(PRE_DLL_NAME)
+	$(AM_V_GEN)$(srcdir)/dllfixdbg $(OBJDUMP) $(OBJCOPY) $(PRE_DLL_NAME) $(DBG_DLL_NAME)
+
+$(NEW_DLL_NAME): $(PRE_DLL_NAME) $(DBG_DLL_NAME)
+	$(AM_V_GEN)ln -f $(PRE_DLL_NAME) $@
 
 # cygwin import library
 toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@
@@ -651,7 +657,7 @@ sigfe.s: $(DEF_FILE)
 	[ -s $@ ] && touch $@
 
 LIBCOS=$(addsuffix .o,$(basename $(LIB_FILES)))
-$(LIB_NAME): $(DEF_FILE) $(LIBCOS) | $(TEST_DLL_NAME)
+$(LIB_NAME): $(DEF_FILE) $(LIBCOS) | $(NEW_DLL_NAME)
 	$(AM_V_GEN)$(srcdir)/mkimport $(toolopts) $(NEW_FUNCTIONS) $@ cygdll.a $(wordlist 2,99,$^)
 
 # cygwin import library used by testsuite
@@ -709,7 +715,8 @@ all-local: $(LIB_NAME) $(TEST_LIB_NAME) $(SUBLIBS)
 clean-local:
 	-rm -f $(BUILT_SOURCES)
 	-rm -f $(DEF_FILE) sigfe.s
-	-rm -f cygwin.sc cygdll.a cygwin.map $(TEST_DLL_NAME) cygwin1.dbg new-cygwin1.dll
+	-rm -f cygwin.sc cygdll.a cygwin.map
+	-rm -f $(PRE_DLL_NAME) $(DBG_DLL_NAME) $(NEW_DLL_NAME)
 	-rm -f $(LIB_NAME) $(TEST_LIB_NAME) $(SUBLIBS)
 	-rm -f version.cc
 
@@ -727,7 +734,7 @@ install-data-local: install-headers install-ldif
 
 install-libs:
 	@$(MKDIR_P) $(DESTDIR)$(bindir)
-	$(INSTALL_PROGRAM) $(TEST_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
+	$(INSTALL_PROGRAM) $(NEW_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
 	@$(MKDIR_P) $(DESTDIR)$(toollibdir)
 	(cd $(DESTDIR)$(toollibdir) && ln -sf $(LIB_NAME) libg.a)


                 reply	other threads:[~2022-02-02 20:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220202204444.94E4C385AC33@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).