general correction patch

Peter S. Mazinger ps.m at gmx.net
Sat Sep 3 16:40:19 UTC 2005


Hello!

The attached patch:
1. moves the unused header removal (depending on the chosen options) from 
install_dev to headers (so we are sure that not even the build system uses 
them and corrects files so that they won't include these either (problem 
remaining are libc/stdio/*vprintf.c and scanf.c if the 
UCLIBC_HAS_GLIBC_CUSTOM_PRINTF option is not selected, because they use 
printf.h (and PA_*). For now don't disable the mentioned option (unless 
mjn3 corrects the relevant files)
The OLD_VFPRINTF option uses the printf.h file too (although probably 
obsolete, because WCHAR is probably everywhere enabled), so the removal 
from headers should maybe consider this case too before removal
I have removed step-by-step one option and rebuilt uClibc, but couldn't 
test all the possible combinations ...
2. shortening shared: ... (using DIRS like subdirs)
3. for libm resp. libpthread use UCLIBC_HAS_FLOATS/UCLIBC_HAS_THREADS, so 
that these directories are not added to DIRS
4. --exclude CVS removed from tar (not relevant anymore)
5. added a comment for a case that is not solved related to iconv 
installation if !HAVE_SHARED and UCLIBC_HAS_LOCALE

If this patch is acceptable, lib{m,pthread}/Makefile can omit their 
respective checks to build or not to build anything.

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2
-------------- next part --------------
--- uClibc-0.9.28/libc/pwd_grp/pwd_grp.c.mps	2005-09-03 16:56:40 +0200
+++ uClibc-0.9.28/libc/pwd_grp/pwd_grp.c	2005-09-03 16:58:38 +0200
@@ -41,7 +41,10 @@
 #include <ctype.h>
 #include <pwd.h>
 #include <grp.h>
+#include <paths.h>
+#ifdef __HAS_SHADOW__
 #include <shadow.h>
+#endif
 #ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
 #endif
--- uClibc-0.9.28/libc/unistd/sysconf.c.mps	2005-09-03 16:33:42 +0200
+++ uClibc-0.9.28/libc/unistd/sysconf.c	2005-09-03 16:49:45 +0200
@@ -29,7 +29,9 @@
 #include <unistd.h>
 #include <sys/sysinfo.h>
 #include <sys/types.h>
+#ifdef __UCLIBC_HAS_REGEX__
 #include <regex.h>
+#endif
 
 #ifndef __UCLIBC_CLK_TCK_CONST
 #error __UCLIBC_CLK_TCK_CONST not defined!
--- uClibc-0.9.28/libc/unistd/getopt.c.mps	2005-09-03 15:16:52 +0200
+++ uClibc-0.9.28/libc/unistd/getopt.c	2005-09-03 15:17:37 +0200
@@ -26,10 +26,13 @@
  * Modified once again for uClibc by Erik Andersen 8/7/02
  */
 
+#include <features.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
 #include <libintl.h>
+#endif
 
 #ifdef __UCLIBC_MJN3_ONLY__
 #warning TODO: Enable gettext awareness.
--- uClibc-0.9.28/librt/kernel-posix-timers.h.mps	2005-09-03 15:00:08 +0200
+++ uClibc-0.9.28/librt/kernel-posix-timers.h	2005-09-03 15:15:19 +0200
@@ -2,10 +2,13 @@
  * kernel-posix-timers.h - kernel-dependent definitions for POSIX timers.
  */
 
+#include <features.h>
 #include <setjmp.h>
 #include <signal.h>
 #include <sys/types.h>
+#ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
+#endif
 
 /* Type of timers in the kernel */
 typedef int kernel_timer_t;
@@ -27,5 +30,7 @@
     /* Parameters for the thread to be started for SIGEV_THREAD */
     void (*thrfunc) (sigval_t);
     sigval_t sival;
+#ifdef __UCLIBC_HAS_THREADS__
     pthread_attr_t attr;
+#endif
 };
--- uClibc-0.9.28/Makefile.mps	2005-09-03 15:21:27 +0200
+++ uClibc-0.9.28/Makefile	2005-09-03 17:52:02 +0200
@@ -28,7 +28,13 @@
 TOPDIR=./
 include Rules.mak
 
-DIRS = ldso libc libcrypt libresolv libnsl libutil libm libpthread librt
+DIRS = ldso libc libcrypt libresolv libnsl libutil librt
+ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y)
+	DIRS += libm
+endif
+ifeq ($(strip $(UCLIBC_HAS_THREADS)),y)
+	DIRS += libpthread
+endif
 ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
 	DIRS += libintl
 endif
@@ -40,34 +46,6 @@
 # In this section, we need .config
 -include .config.cmd
 
-shared: subdirs
-ifeq ($(strip $(HAVE_SHARED)),y)
-	$(SECHO)
-	$(SECHO) Building shared libraries ...
-	$(SECHO)
-	@$(MAKE) -C libc shared
-	@$(MAKE) -C ldso shared
-	@$(MAKE) -C libcrypt shared
-	@$(MAKE) -C libresolv shared
-	@$(MAKE) -C libnsl shared
-	@$(MAKE) -C libutil shared
-	@$(MAKE) -C libm shared
-	@$(MAKE) -C libpthread shared
-	@$(MAKE) -C librt shared
-ifeq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
-	@$(MAKE) -C libintl shared
-endif
-else
-	$(SECHO)
-	$(SECHO) Not building shared libraries ...
-	$(SECHO)
-endif
-
-finished: shared
-	$(SECHO)
-	$(SECHO) Finally finished compiling ...
-	$(SECHO)
-
 include/bits/uClibc_config.h: .config
 	@if [ ! -x ./extra/config/conf ] ; then \
 	    $(MAKE) -C extra/config conf; \
@@ -123,114 +101,133 @@
 	$(MAKE) -C libc/sysdeps/linux/common headers
 	$(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
 
-# Command used to download source code
-WGET:=wget --passive-ftp
-
-LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
-
-pregen: headers
-ifeq ($(strip $(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA)),y)
-	(cd extra/locale; \
-	if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
-	$(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
-	fi );
-endif
-ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y)
-	(cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
-	$(MAKE) -C extra/locale pregen
-endif
-
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-$(patsubst %, _dir_%, $(DIRS)): headers
-	$(MAKE) -C $(patsubst _dir_%, %, $@)
-
-tags:
-	ctags -R
-
-install: install_runtime install_dev finished2
-
-
-RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
-
-# Installs header files and development library links.
-install_dev:
-	$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
-	$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
-	-$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
-	if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
-		extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
-	else \
-		extra_exclude="" ; \
-	fi ; \
-	tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
-		| tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
 ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
 	# Remove floating point related headers since float support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
+	$(RM) include/complex.h
+	$(RM) include/fpu_control.h
+	$(RM) include/ieee754.h
+	$(RM) include/math.h
+	$(RM) include/tgmath.h
+	$(RM) include/bits/uClibc_fpmax.h
 endif
 ifneq ($(strip $(DO_C99_MATH)),y)
 	# Remove C99 related headers since C99 is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/fenv.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/fenv.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/fenvinline.h
+	$(RM) include/fenv.h
+	$(RM) include/bits/fenv.h
+	$(RM) include/bits/fenvinline.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_WCHAR)),y)
 	# Remove wide char headers since wide char support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
+	$(RM) include/wctype.h
+	$(RM) include/wchar.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_LOCALE)),y)
 	# Remove iconv header since locale support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
+	$(RM) include/iconv.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF)),y)
 	# Remove printf header since custom print specifier support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
+	$(RM) include/printf.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y)
 	# Remove xlocale header since extended locale support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
+	$(RM) include/xlocale.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_GETTEXT_AWARENESS)),y)
 	# Remove libintl header since gettext support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
+	$(RM) include/libintl.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_REGEX)),y)
 	# Remove regex headers since regex support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
+	$(RM) include/regex.h
+	$(RM) include/regexp.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_WORDEXP)),y)
 	# Remove wordexp header since wordexp support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
+	$(RM) include/wordexp.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_FTW)),y)
 	# Remove ftw header since ftw support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
+	$(RM) include/ftw.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_GLOB)),y)
 	# Remove glob header since glob support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
+	$(RM) include/glob.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_GNU_GETOPT)),y)
 	# Remove getopt header since gnu getopt support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
+	$(RM) include/getopt.h
 endif
 ifneq ($(strip $(HAS_SHADOW)),y)
 	# Remove shadow header since shadow password support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
+	$(RM) include/shadow.h
 endif
 ifneq ($(strip $(UCLIBC_HAS_THREADS)),y)
 	# Remove pthread headers since thread support is disabled.
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
-	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
+	$(RM) include/*thread*.h
+	$(RM) include/semaphore.h
+	$(RM) include/bits/*thread*.h
+endif
+
+# Command used to download source code
+WGET:=wget --passive-ftp
+
+LOCALE_DATA_FILENAME:=uClibc-locale-030818.tgz
+
+pregen: headers
+ifeq ($(strip $(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA)),y)
+	(cd extra/locale; \
+	if [ ! -f $(LOCALE_DATA_FILENAME) ] ; then \
+	$(WGET) http://www.uclibc.org/downloads/$(LOCALE_DATA_FILENAME) ; \
+	fi );
+endif
+ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y)
+	(cd extra/locale; zcat $(LOCALE_DATA_FILENAME) | tar -xvf -)
+	$(MAKE) -C extra/locale pregen
+endif
+
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+$(patsubst %, _dir_%, $(DIRS)): headers
+	$(MAKE) -C $(patsubst _dir_%, %, $@)
+
+shared: $(patsubst %, _shared_dir_%, $(DIRS))
+$(patsubst %, _shared_dir_%, $(DIRS)): subdirs
+ifeq ($(strip $(HAVE_SHARED)),y)
+	$(SECHO)
+	$(SECHO) Building shared libraries ...
+	$(SECHO)
+	$(MAKE) -C $(patsubst _shared_dir_%, %, $@) shared
+else
+	$(SECHO)
+	$(SECHO) Not building shared libraries ...
+	$(SECHO)
 endif
+
+finished: shared
+	$(SECHO)
+	$(SECHO) Finally finished compiling ...
+	$(SECHO)
+
+tags:
+	ctags -R
+
+install: install_runtime install_dev finished2
+
+
+RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
+
+# Installs header files and development library links.
+install_dev:
+	$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
+	$(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
+	-$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
+	if [ "$(KERNEL_SOURCE)" == "$(DEVEL_PREFIX)" ] ; then \
+		extra_exclude="--exclude include/linux --exclude include/asm'*'" ; \
+	else \
+		extra_exclude="" ; \
+	fi ; \
+	tar -chf - include --exclude .svn $$extra_exclude \
+		| tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
 	- at for i in `find  $(PREFIX)$(DEVEL_PREFIX) -type d` ; do \
 	    chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
 	done;
@@ -275,6 +272,8 @@
 endif
 
 .PHONY: utils
+# this does not cover the case !HAVE_SHARED && HAS_LOCALE, iconv is not installed
+# better move the checks to utils and do it here unconditionally
 ifeq ($(strip $(HAVE_SHARED)),y)
 utils:
 	$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
@@ -285,11 +284,6 @@
 # Installs helper applications, such as 'ldd' and 'ldconfig'
 install_utils: utils
 	$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils install
-#ifeq ($(strip $(UCLIBC_HAS_LOCALE)),y)
-#	@$(MAKE) -C libc/misc/wchar iconv.target
-#	$(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)/usr/bin;
-#	$(INSTALL) -m 755 libc/misc/wchar/iconv.target $(PREFIX)$(RUNTIME_PREFIX)/usr/bin/iconv
-#endif
 
 finished2:
 	$(SECHO)


More information about the uClibc mailing list