Ver código fonte

simplify Makefile rules for handling of LFS files by tweaking the way we compile the source files as suggested by psm

Mike Frysinger 19 anos atrás
pai
commit
b882004687

+ 3 - 20
libc/stdio/Makefile.in

@@ -7,8 +7,6 @@
 # Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
 #
 
-# Note: The *64.o objects are empty when compiled without large file support.
-
 # SUSv3 functions
 CSRC := \
 	fclose.c fcloseall.c fdopen.c fgetpos.c fopen.c freopen.c \
@@ -19,6 +17,9 @@ CSRC := \
 	asprintf.c sprintf.c vasprintf.c vdprintf.c vsnprintf.c \
 	tmpfile.c tmpnam.c tmpnam_r.c popen.c tempnam.c ctermid.c
 
+# Note: The *64.o objects are empty when compiled without large file support
+CSRC += fgetpos64.c fopen64.c freopen64.c fseeko64.c fsetpos64.c ftello64.c
+
 # getc -> alias for fgetc
 # putc -> alias for fputc
 # rename is a syscall
@@ -52,12 +53,6 @@ CUSRC := \
 # getc_unlocked -> alias for fgetc_unlocked
 # putc_unlocked -> alias for fputc_unlocked
 
-# Largefile functions (%64.o)
-CLSRC :=
-ifeq ($(UCLIBC_HAS_LFS),y)
-CLSRC := fgetpos.c fopen.c freopen.c fseeko.c fsetpos.c ftello.c # tmpfile
-endif
-
 # vfprintf and support functions
 MSRC1 := vfprintf.c
 ifneq ($(USE_OLD_VFPRINTF),y)
@@ -104,8 +99,6 @@ STDIO_SRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CSRC))
 STDIO_OBJ := $(patsubst %.c,$(STDIO_OUT)/%.o,$(CSRC))
 STDIO_CUSRC := $(patsubst %.c,$(STDIO_DIR)/%.c,$(CUSRC))
 STDIO_CUOBJ := $(patsubst %.c,$(STDIO_OUT)/%_unlocked.o,$(CUSRC))
-STDIO_CLSRC := $(patsubst %.c,$(STDIO_OUT)/%64.c,$(CLSRC))
-STDIO_CLOBJ := $(patsubst %.c,$(STDIO_OUT)/%64.o,$(CLSRC))
 
 STDIO_MSRC1 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC1))
 STDIO_MSRC2 := $(patsubst %.c,$(STDIO_DIR)/%.c,$(MSRC2))
@@ -129,16 +122,6 @@ STDIO_NO_MULTI := $(STDIO_CUOBJ) $(STDIO_CLOBJ)
 %_unlocked.os: %.c
 	$(compile.c) -D__DO_UNLOCKED
 
-# need this, else the other %64 files will get false rules
-$(STDIO_CLSRC): $(STDIO_OUT)/%64.c : $(STDIO_DIR)/%.c
-	@cp $< $@
-
-$(STDIO_CLOBJ): %.o : %.c
-	$(compile.c) -D__DO_LARGEFILE
-
-$(STDIO_CLOBJ:.o=.os): %.os : %.c
-	$(compile.c) -D__DO_LARGEFILE
-
 $(STDIO_MOBJ1): $(STDIO_MSRC1)
 	$(compile.m)
 

+ 0 - 10
libc/stdio/fgetpos.c

@@ -7,16 +7,6 @@
 
 #include "_stdio.h"
 
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-#  error large file support is not enabled!
-# endif
-
-# define fgetpos	fgetpos64
-# define fpos_t		fpos64_t
-# define ftell		ftello64
-#endif
-
 int fgetpos(FILE * __restrict stream, register fpos_t * __restrict pos)
 {
 #ifdef __STDIO_MBSTATE

+ 16 - 0
libc/stdio/fgetpos64.c

@@ -0,0 +1,16 @@
+/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
+ */
+
+#include "_stdio.h"
+
+#ifdef __UCLIBC_HAS_LFS__
+# define __DO_LARGEFILE
+# define fgetpos	fgetpos64
+# define fpos_t		fpos64_t
+# define ftell		ftello64
+# include "fgetpos.c"
+#endif

+ 1 - 8
libc/stdio/fopen.c

@@ -7,14 +7,7 @@
 
 #include "_stdio.h"
 
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-#  error large file support is not enabled!
-# endif
-
-# define fopen			fopen64
-# define FILEDES_ARG    (-2)
-#else
+#ifndef __DO_LARGEFILE
 # define FILEDES_ARG    (-1)
 #endif
 

+ 15 - 0
libc/stdio/fopen64.c

@@ -0,0 +1,15 @@
+/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
+ */
+
+#include "_stdio.h"
+
+#ifdef __UCLIBC_HAS_LFS__
+# define __DO_LARGEFILE
+# define fopen			fopen64
+# define FILEDES_ARG    (-2)
+# include "fopen.c"
+#endif

+ 1 - 8
libc/stdio/freopen.c

@@ -7,14 +7,7 @@
 
 #include "_stdio.h"
 
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-#  error large file support is not enabled!
-# endif
-
-# define freopen		freopen64
-# define FILEDES_ARG    (-2)
-#else
+#ifndef __DO_LARGEFILE
 # define FILEDES_ARG    (-1)
 #endif
 

+ 15 - 0
libc/stdio/freopen64.c

@@ -0,0 +1,15 @@
+/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
+ */
+
+#include "_stdio.h"
+
+#ifdef __UCLIBC_HAS_LFS__
+# define __DO_LARGEFILE
+# define freopen		freopen64
+# define FILEDES_ARG    (-2)
+# include "freopen.c"
+#endif

+ 1 - 12
libc/stdio/fseeko.c

@@ -11,22 +11,11 @@
 # error Assumption violated -- values of SEEK_SET, SEEK_CUR, SEEK_END
 #endif
 
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-#  error large file support is not enabled!
-# endif
-
-# define FSEEK				__fseeko64
-# define OFFSET_TYPE		__off64_t
-
-#else
-
+#ifndef __DO_LARGEFILE
 # define FSEEK				fseek
 # define OFFSET_TYPE		long int
-
 #endif
 
-
 int FSEEK(register FILE *stream, OFFSET_TYPE offset, int whence)
 {
 #if defined(__UCLIBC_HAS_LFS__) && !defined(__DO_LARGEFILE)

+ 15 - 0
libc/stdio/fseeko64.c

@@ -0,0 +1,15 @@
+/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
+ */
+
+#include "_stdio.h"
+
+#ifdef __UCLIBC_HAS_LFS__
+# define __DO_LARGEFILE
+# define FSEEK				__fseeko64
+# define OFFSET_TYPE		__off64_t
+# include "fseeko.c"
+#endif

+ 0 - 11
libc/stdio/fsetpos.c

@@ -7,16 +7,6 @@
 
 #include "_stdio.h"
 
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-#  error large file support is not enabled!
-# endif
-
-# define fsetpos	fsetpos64
-# define fpos_t		fpos64_t
-# define fseek		fseeko64
-#endif
-
 int fsetpos(FILE *stream, register const fpos_t *pos)
 {
 #ifdef __STDIO_MBSTATE
@@ -41,4 +31,3 @@ int fsetpos(FILE *stream, register const fpos_t *pos)
 
 #endif
 }
-

+ 16 - 0
libc/stdio/fsetpos64.c

@@ -0,0 +1,16 @@
+/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
+ */
+
+#include "_stdio.h"
+
+#ifdef __UCLIBC_HAS_LFS__
+# define __DO_LARGEFILE
+# define fsetpos	fsetpos64
+# define fpos_t		fpos64_t
+# define fseek		fseeko64
+# include "fsetpos.c"
+#endif

+ 1 - 11
libc/stdio/ftello.c

@@ -7,19 +7,9 @@
 
 #include "_stdio.h"
 
-#ifdef __DO_LARGEFILE
-# ifndef __UCLIBC_HAS_LFS__
-#  error large file support is not enabled!
-# endif
-
-# define FTELL				__ftello64
-# define OFFSET_TYPE		__off64_t
-
-#else
-
+#ifndef __DO_LARGEFILE
 # define FTELL				ftell
 # define OFFSET_TYPE		long int
-
 #endif
 
 OFFSET_TYPE FTELL(register FILE *stream)

+ 15 - 0
libc/stdio/ftello64.c

@@ -0,0 +1,15 @@
+/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
+ *
+ * GNU Library General Public License (LGPL) version 2 or later.
+ *
+ * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
+ */
+
+#include "_stdio.h"
+
+#ifdef __UCLIBC_HAS_LFS__
+# define __DO_LARGEFILE
+# define FTELL				__ftello64
+# define OFFSET_TYPE		__off64_t
+# include "fgetpos.c"
+#endif