Browse Source

Clean up pthread include mess. Some of these will be needed to support NPTL, but they do no harm for the linuxthreads case. Yes, I tested this.

"Steven J. Hill" 18 years ago
parent
commit
8c7ac6fc36

+ 1 - 0
Makefile

@@ -353,6 +353,7 @@ clean:
 	$(RM) include/fpu_control.h
 	$(MAKE) -C extra/locale clean
 	$(MAKE) -C ldso clean
+	$(MAKE) -C libc clean
 	$(MAKE) -C libpthread clean
 	$(MAKE) -C test clean
 	$(MAKE) -C utils clean

+ 7 - 0
Rules.mak

@@ -303,6 +303,13 @@ else
     LDFLAGS := $(LDFLAGS_NOSTRIP) -s
 endif
 
+ifeq ($(UCLIBC_HAS_THREADS),y)
+# set up system dependencies include dirs (NOTE: order matters!)
+PTDIR   := $(TOPDIR)libpthread/linuxthreads/
+PTINC   := -I$(PTDIR)sysdeps/pthread \
+           -I$(PTDIR)sysdeps/$(TARGET_ARCH)
+endif
+
 ifeq ($(UCLIBC_BUILD_RELRO),y)
 LDFLAGS+=-z relro
 endif

+ 4 - 0
libc/inet/Makefile

@@ -56,6 +56,10 @@ CSRC =getservice.c getproto.c hostid.c getnetent.c getnetbynm.c getnetbyad.c \
 
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
+ifeq ($(UCLIBC_HAS_THREADS),y)
+CFLAGS += $(PTINC)
+endif
+
 OBJS=$(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS)
 
 OBJ_LIST=../obj.inet

+ 1 - 2
libc/inet/rpc/Makefile

@@ -23,7 +23,6 @@
 
 TOPDIR=../../../
 include $(TOPDIR)Rules.mak
-CFLAGS+=-I$(TOPDIR)libpthread/linuxthreads/sysdeps/pthread
 
 ifeq ($(strip $(UCLIBC_HAS_FULL_RPC)),y)
 CSRC :=auth_none.c auth_unix.c authunix_prot.c bindresvport.c \
@@ -58,7 +57,7 @@ $(OBJ_LIST): $(OBJS)
 	echo $(patsubst %, inet/rpc/%, $(OBJS)) > $(OBJ_LIST)
 
 $(COBJS): %.o : %.c
-	$(CC) $(CFLAGS) -c $< -o $@
+	$(CC) $(CFLAGS) $(PTINC) -c $< -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 clean:

+ 4 - 0
libc/misc/internals/Makefile

@@ -31,6 +31,10 @@ __uClibc_main.o: CFLAGS += $(SSP_DISABLE_FLAGS)
 
 OBJS=$(COBJS)
 
+ifeq ($(UCLIBC_HAS_THREADS),y)
+CFLAGS += $(PTINC)
+endif
+
 OBJ_LIST=../../obj.misc.internals
 
 all: $(OBJ_LIST) interp.o static.o

+ 1 - 11
libc/misc/pthread/Makefile

@@ -19,16 +19,6 @@
 TOPDIR=../../../
 include $(TOPDIR)Rules.mak
 
-PTDIR = $(TOPDIR)libpthread/linuxthreads/
-SYSDEPINC = -I$(PTDIR)sysdeps/unix/sysv/linux \
-            -I$(PTDIR)sysdeps/pthread \
-            -I$(PTDIR)sysdeps/unix/sysv \
-            -I$(PTDIR)sysdeps/unix/unix \
-            -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
-            -I$(PTDIR)sysdeps \
-            -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
-CFLAGS += $(SYSDEPINC) -D_GNU_SOURCE
-
 CSRC=no-tsd.c weaks.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 OBJS=$(COBJS)
@@ -41,7 +31,7 @@ $(OBJ_LIST): $(OBJS)
 	echo $(patsubst %, misc/pthread/%, $(OBJS)) > $(OBJ_LIST)
 
 $(COBJS): %.o : %.c
-	$(CC) $(CFLAGS) -c $< -o $@
+	$(CC) $(CFLAGS) $(PTINC) -c $< -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 clean:

+ 4 - 0
libc/misc/syslog/Makefile

@@ -28,6 +28,10 @@ CSRC=syslog.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 OBJS=$(COBJS)
 
+ifeq ($(UCLIBC_HAS_THREADS),y)
+CFLAGS += $(PTINC)
+endif
+
 OBJ_LIST=../../obj.misc.syslog
 
 all: $(OBJ_LIST)

+ 4 - 0
libc/stdio/Makefile

@@ -116,6 +116,10 @@ ifeq ($(strip $(UCLIBC_HAS_LFS)),y)
 OBJS += $(CLOBJS)
 endif
 
+ifeq ($(UCLIBC_HAS_THREADS),y)
+CFLAGS += $(PTINC)
+endif
+
 OBJ_LIST=../obj.stdio
 
 all: $(OBJ_LIST)

+ 6 - 0
libc/stdlib/malloc-standard/Makefile

@@ -32,9 +32,15 @@ endif
 # calloc.c can be found at uClibc/libc/stdlib/calloc.c
 # valloc.c can be found at uClibc/libc/stdlib/valloc.c
 CSRC=malloc.c calloc.c realloc.c free.c memalign.c mallopt.c mallinfo.c
+
 COBJS=$(patsubst %.c,%.o, $(CSRC))
+
 OBJS=$(COBJS)
 
+ifeq ($(UCLIBC_HAS_THREADS),y)
+CFLAGS += $(PTINC)
+endif
+
 OBJ_LIST=../../obj.stdlib.malloc-standard
 
 all: $(OBJ_LIST)

+ 3 - 9
libpthread/linuxthreads/Makefile

@@ -22,17 +22,11 @@ include $(TOPDIR)Rules.mak
 
 CFLAGS+=$(SSP_ALL_CFLAGS)
 
-#This stuff will not compile without at least -O1
+# This stuff will not compile without at least -O1
 CFLAGS :=$(CFLAGS:-O0=-O1)
 
-# set up system dependencies include dirs (NOTE: order matters!)
-# psm: don't think that the last include makes sense
-# they all should be already linked to $(TOPDIR)include
-PTDIR = $(TOPDIR)libpthread/linuxthreads/
-SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
-            -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
-            -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
-CFLAGS += $(SYSDEPINC)
+# Get the thread include dependencies
+CFLAGS += $(PTINC)
 
 ARCH_CFLAGS = $(CFLAGS)
 

+ 2 - 7
libpthread/linuxthreads_db/Makefile

@@ -26,13 +26,8 @@ AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
 SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
 SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
 
-# set up system dependencies include dirs (NOTE: order matters!)
-PTDIR = $(TOPDIR)libpthread/linuxthreads/
-SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
-            -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
-            -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
-
-CFLAGS += $(SYSDEPINC) -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
+# Get the thread include dependencies and shared object name
+CFLAGS += $(PTINC) -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
 
 # Remove any -z defs since this lib will have undefined symbols
 LDFLAGS := $(subst -z defs,,$(LDFLAGS)) --warn-unresolved-symbols