[tz] [PATCH 1/3] build: handle standard LDFLAGS variable

Paul Eggert eggert at cs.ucla.edu
Sat Oct 27 20:23:50 UTC 2012


Thanks, I pushed the following slightly-more-elaborate patch.

* Makefile (LDFLAGS): Rename from LFLAGS, with backwards compatibility.
All uses changed.  Suggested by Mike Frysinger in
<http://mm.icann.org/pipermail/tz/2012-October/018396.html>.
(zdump, zic, date): Use $(CC) -o $@ ... rather than $(CC) ... -o $@,
for portability to strict older POSIX hosts.
($(TZLIB)): Don't use [ ... -o ... ], as it's not portable.
---
 Makefile |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 19616ef..8b539c1 100644
--- a/Makefile
+++ b/Makefile
@@ -224,6 +224,11 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
 
 CFLAGS=
 
+# Linker flags.  Default to $(LFLAGS) for backwards compatibility
+# to tzcode2012h and earlier.
+
+LDFLAGS=	$(LFLAGS)
+
 # If you want zic's -s option used when installing, uncomment the next line
 # ZFLAGS=	-s
 
@@ -338,10 +343,10 @@ version.h:
 		  'static char const TZVERSION[]="tz$(VERSION)";'
 
 zdump:		$(TZDOBJS)
-		$(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
+		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS)
 
 zic:		$(TZCOBJS) yearistype
-		$(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
+		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS)
 
 yearistype:	yearistype.sh
 		cp yearistype.sh yearistype
@@ -376,12 +381,11 @@ zones:		$(REDO)
 $(TZLIB):	$(LIBOBJS)
 		-mkdir $(TOPDIR) $(LIBDIR)
 		ar ru $@ $(LIBOBJS)
-		if [ -x /usr/ucb/ranlib -o -x /usr/bin/ranlib ] ; \
+		if [ -x /usr/ucb/ranlib ] || [ -x /usr/bin/ranlib ]; \
 			then ranlib $@ ; fi
 
 date:		$(DATEOBJS)
-		$(CC) $(CFLAGS) date.o localtime.o asctime.o strftime.o \
-			$(LDLIBS) -lc -o $@
+		$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
 
 tzselect:	tzselect.ksh
 		sed \
-- 
1.7.9.5



More information about the tz mailing list