[newlib-cygwin] Cygwin: revamp localtime.o build rule

Corinna Vinschen corinna@sourceware.org
Tue May 26 08:20:54 GMT 2020


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

commit 4d5efe1e1d3dc7672934efce1bdc9151e7cd307d
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon May 25 17:40:27 2020 +0200

    Cygwin: revamp localtime.o build rule
    
    Rename localtime.c.patched to localtime.patched.c to keep the correct
    language suffix.
    
    Create localtime.patched.c in the build dir rather than in the source
    dir.  Decouple the build rule for creating localtime.patched.c from
    the rule to build localtime.o, so we don't have to rebuild the patched
    source file all the time.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/Makefile.in                | 11 +++++++----
 winsup/cygwin/tzcode/localtime_wrapper.c |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index 1801b1a11..3a175c61c 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -670,7 +670,7 @@ uninstall-man:
 	done
 
 clean distclean realclean:
-	-rm -f *.o *.dll *.dbg *.a *.exp junk *.base version.cc *.exe *.d *stamp* *_magic.h sigfe.s cygwin.def globals.h
+	-rm -f *.o *.dll *.dbg *.a *.exp junk *.base version.cc *.exe *.d *stamp* *_magic.h sigfe.s cygwin.def globals.h localtime.patched.c
 	-@$(MAKE) -C ${cygserver_blddir} libclean
 
 maintainer-clean: clean
@@ -734,9 +734,12 @@ dcrt0.o sigproc.o: child_info_magic.h
 
 shared.o: shared_info_magic.h
 
-localtime.o: $(srcdir)/tzcode/localtime_wrapper.c $(srcdir)/tzcode/localtime.c.patch
-	(cd $(srcdir)/tzcode && \
-		patch -u -o localtime.c.patched localtime.c localtime.c.patch)
+localtime.patched.c: tzcode/localtime.c tzcode/localtime.c.patch
+	patch -u -o localtime.patched.c \
+		    $(srcdir)/tzcode/localtime.c \
+		    $(srcdir)/tzcode/localtime.c.patch
+
+localtime.o: tzcode/localtime_wrapper.c localtime.patched.c
 	$(CC) ${COMMON_CFLAGS} ${localtime_CFLAGS} \
 		-I$(target_builddir)/winsup/cygwin \
 		-I$(srcdir) -I$(srcdir)/tzcode -c -o $@ $<
diff --git a/winsup/cygwin/tzcode/localtime_wrapper.c b/winsup/cygwin/tzcode/localtime_wrapper.c
index 72e2f93ab..1c7cd928d 100644
--- a/winsup/cygwin/tzcode/localtime_wrapper.c
+++ b/winsup/cygwin/tzcode/localtime_wrapper.c
@@ -122,7 +122,7 @@ tzgetwintzi (char *wildabbr, char *outbuf)
    (2) add conditional call to Cygwin's tzgetwintzi() from tzsetlcl()
    (3) add Cygwin's historical "posixrules" support to tzloadbody()
 */
-#include "localtime.c.patched"
+#include "localtime.patched.c"
 
 // Don't forget these Cygwin-specific additions from this point to EOF
 EXPORT_ALIAS (tzset_unlocked, _tzset_unlocked)


More information about the Cygwin-cvs mailing list