Index: /trunk/libc/Makefile.kmk
===================================================================
--- /trunk/libc/Makefile.kmk	(revision 2707)
+++ /trunk/libc/Makefile.kmk	(revision 2708)
@@ -30,5 +30,5 @@
 #
 # The targets
-#					
+#
 BLDPROGS = \
 	makepow5 \
@@ -36,5 +36,5 @@
 	arithchk
 
-xLIBRARIES = \
+LIBRARIES = \
 	msun \
 	glibc \
@@ -42,9 +42,10 @@
 	b_knix_os2 \
 	libos2 \
-	libclibc
-	
+	libclibc \
+	libc
+
 PROGRAMS = \
 	gencat
-	
+
 INSTALLS = \
 	headers \
@@ -52,25 +53,8 @@
 	libc_alias
 
-#
-# Templates
-#
-TEMPLATE_aoutlib =
-TEMPLATE_aoutlib_TOOL = GCC3
-TEMPLATE_aoutlib_INCS = include $(PATH_TARGET)
-TEMPLATE_aoutlib_CFLAGS = $(TEMPLATE_lib_CFLAGS) -std=gnu99
-
-TEMPLATE_bldprog = Build programs
-TEMPLATE_bldprog_TOOL = GCC3
-
-#
-# Globals
-#
-DEFS = \
-	IN_INNOTEK_LIBC \
-	__IN_INNOTEK_LIBC__
-	
+
 #
 # The source files making up the libc part.
-#	
+#
 libclibc_TEMPLATE = aoutlib
 libclibc_DEPS = $(PATH_TARGET)/libc-std.h
@@ -688,6 +672,4 @@
 	src/libc/str/386/_memcpy_amd.s \
 
-src/libc/app/stdio.c_DEFS = _NFILES=40
-src/libc/app/iodata.c_DEFS = _NFILES=40
 src/libc/conv/bipow5.c_DEPS = $(PATH_TARGET)/bipow5.tab
 src/libc/sys/heapsize.c_DEFS = HEAPSIZE=0x2000000
@@ -695,5 +677,5 @@
 #
 # The makepow5 util which generates the bipow5.tab include file.
-#				
+#
 makepow5_TEMPLATE = bldprog
 makepow5_SOURCES = src/libc/conv/makepow5.c
@@ -705,8 +687,8 @@
 timetabs_gen_SOURCES = src/libc/time/timetabs_gen.c
 
-	
+
 #
 # The source files originating in the FreeBSD libc.
-#	
+#
 fbsdlibc_TEMPLATE = aoutlib
 fbsdlibc_NOINST = 1
@@ -954,5 +936,5 @@
 #
 # The source files originating in the GNU LIBC.
-#					
+#
 glibc_TEMPLATE = aoutlib
 glibc_NOINST = 1
@@ -1377,10 +1359,10 @@
 	src/msun/i387/s_truncf.S \
 	src/msun/i387/s_truncl.S \
-	
+
 # select the sources we need.
 $(foreach archsrc,$(basename $(notdir $(MSUN_ARCH.$(BUILD_TARGET_ARCH)))) \
 	,$(eval msun_SOURCES := $(filter-out %/$(archsrc).c,$(msun_SOURCES))))
 msun_SOURCES += $(MSUN_ARCH.$(BUILD_TARGET_ARCH))
-						
+
 #
 # The source files making up the OS/2 Unix backend.
@@ -1530,5 +1512,5 @@
     src/libc/sys/uflags.c \
     src/libc/sys/umask.c \
-	
+
 b_knix_os2_SOURCES.x86 += \
 	src/libc/sys/386/appinit.s \
@@ -1543,47 +1525,18 @@
 src/libc/sys/386/signal16bit.asm_TOOL := ALP
 src/libc/sys/386/signal16bit.asm_ASTOOL := ALP
-	
-	
+
+
 #
 # libc.a
 #
-libc_TEMPLATE = lib
+libc_TEMPLATE = aoutlib
 libc_DEPS = $(PATH_TARGET)/libc-std.h
 libc_SOURCES = \
-	$(BACKEND_KNIX_OS2.c.$(BUILD_TARGET)) \
-	$(BACKEND_KNIX_OS2.c.$(BUILD_TARGET_ARCH)) \
-	$(BACKEND_KNIX_OS2.c) \
-	$(BACKEND_KNIX_OS2.asm.$(BUILD_TARGET)) \
-	$(BACKEND_KNIX_OS2.asm.$(BUILD_TARGET_ARCH)) \
-	$(BACKEND_KNIX_OS2.s.$(BUILD_TARGET)) \
-	$(BACKEND_KNIX_OS2.s.$(BUILD_TARGET_ARCH)) \
-	\
-	$(LIBC_LIBC.c.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_LIBC.c.$(BUILD_TARGET)) \
-	$(LIBC_LIBC.c.$(BUILD_TARGET_ARCH)) \
-	$(LIBC_LIBC.c) \
-	$(LIBC_LIBC.s.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_LIBC.s.$(BUILD_TARGET_ARCH)) \
-	$(LIBC_LIBC.s.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_LIBC.s.$(BUILD_TARGET_ARCH)) \
-	\
-	$(LIBC_FREEBSD.c.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_FREEBSD.c.$(BUILD_TARGET)) \
-	$(LIBC_FREEBSD.c.$(BUILD_TARGET_ARCH)) \
-	$(LIBC_FREEBSD.c) \
-	$(LIBC_FREEBSD.s.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_FREEBSD.s.$(BUILD_TARGET_ARCH)) \
-	$(LIBC_FREEBSD.s.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_FREEBSD.s.$(BUILD_TARGET_ARCH)) \
-	\
-	$(LIBC_GLIBC.c.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_GLIBC.c.$(BUILD_TARGET)) \
-	$(LIBC_GLIBC.c.$(BUILD_TARGET_ARCH)) \
-	$(LIBC_GLIBC.c) \
-	$(LIBC_GLIBC.s.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_GLIBC.s.$(BUILD_TARGET_ARCH)) \
-	$(LIBC_GLIBC.s.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)) \
-	$(LIBC_GLIBC.s.$(BUILD_TARGET_ARCH)) \
-	
+	$(TARGET_b_knix_os2) \
+	$(TARGET_libclibc) \
+	$(TARGET_fbsdlibc) \
+	$(TARGET_glibc) \
+	$(TARGET_msun)
+
 #
 # libos2
@@ -1597,5 +1550,5 @@
 #
 # gencat
-#	
+#
 gencat_TEMPLATE = usr.lib
 gencat_INCS = src/fbsdlibc/nls
@@ -1629,5 +1582,5 @@
 	emxomf -m__text -o $@ $<
 $(eval startupobjs_SOURCES += $(PATH_TARGET)/crt0$(i).o $(PATH_TARGET)/crt0$(i).obj)
-	
+
 ifeq ($(subst resp,,$(subst wild,,$(i))),$(i))
 $(PATH_TARGET)/dll0$(i).o: src/libc/startup/386/dll0.s | $(call DIRDEP,$(PATH_TARGET))
@@ -1644,5 +1597,5 @@
 	emxomf -l__text -o $@ $<
 $(eval startupobjs_SOURCES += $(PATH_TARGET)/dll0$(i).o $(PATH_TARGET)/dll0$(i).obj)
-endif	
+endif
 endef
 
@@ -1686,12 +1639,12 @@
 ,$(eval $(value def_startup)))
 
-# binmode	
-$(TARGET_PATH)/binmode.o: src/libc/io/386/binmode.s
+# binmode
+$(PATH_TARGET)/binmode.o: src/libc/io/386/binmode.s
 	gcc -c -o $@ $<
-$(TARGET_PATH)/binmode.obj: $(TARGET_PATH)/binmode.o
+$(PATH_TARGET)/binmode.obj: $(PATH_TARGET)/binmode.o
 	emxomf -o $@ $<
-startupobjs_SOURCES += $(TARGET_PATH)/binmode.o $(TARGET_PATH)/binmode.obj
-
-			
+startupobjs_SOURCES += $(PATH_TARGET)/binmode.o $(PATH_TARGET)/binmode.obj
+
+
 # an alias
 startup: $(startupobjs_SOURCES)
@@ -1700,5 +1653,5 @@
 #
 # Headers
-# 	
+#
 headers_TEMPLATE = usr.include
 headers_SOURCES = \
@@ -1716,5 +1669,5 @@
 	$(foreach hdr, $(wildcard include/sys/*.h), $(hdr)=>$(subst include/,,$(hdr))) \
 
-							
+
 #
 # libc_alias - The alias lib is special, see alias.kmk.
@@ -1724,5 +1677,5 @@
 	$(PATH_TARGET)/libc_alias/libc_alias.a
 
-							
+
 # Let kBuild generate rules.
 include $(PATH_KBUILD)/footer.kmk
@@ -1772,5 +1725,5 @@
 # We're creating a timestamp file early on in the build process.
 # (std-update is a phony target for doing this.)
-$(PATH_TARGET)/libc-std.ts std-update: $(foreach var, $(_STD_SOURCE_VARS), $($(var))) $(_STD_SOURCE_EXTRAS)
+$(PATH_TARGET)/libc-std.ts std-update: $(foreach var, $(_STD_SOURCE_VARS), $($(var))) $(_STD_SOURCE_EXTRAS) | $(call DIRDEP,$(PATH_TARGET))
 	$(RM) -f $(PATH_TARGET)/libc-std.ts $(PATH_TARGET)/libc-std.files $(PATH_TARGET)/libc-std.tmp.h
 	$(foreach src, $^\
@@ -1778,8 +1731,8 @@
 	gawk -f ./mkstd.awk @$(PATH_TARGET)/libc-std.files > $(PATH_TARGET)/libc-std.tmp.h
 	if diff $(PATH_TARGET)/libc-std.tmp.h $(PATH_TARGET)/libc-std.h > /dev/null 2> /dev/null; then \
+		echo "* libc-std.h unchanged"; \
+	else \
 		cp $(PATH_TARGET)/libc-std.tmp.h $(PATH_TARGET)/libc-std.h; \
 		echo "* libc-std.h updated"; \
-	else \
-		echo "* libc-std.h unchanged"; \
 	fi
 	$(APPEND) $(PATH_TARGET)/libc-std.ts done
