Loading...
--- Libc/Libc-498/BSDmakefile
+++ Libc/Libc-391.5.18/BSDmakefile
@@ -1,28 +1,15 @@
-PWD != pwd
-.ifdef DSTROOT
-DESTDIR = $(DSTROOT)
-.else
-.ifdef DESTDIR
-DSTROOT = $(DESTDIR)
-.else
-DSTROOT = /
-DESTDIR = /
-.endif
-.endif
.ifndef OBJROOT
-OBJROOT = $(PWD)/OBJROOT
-.endif
-.ifndef SRCROOT
-SRCROOT = $(PWD)
+OBJROOT != pwd
.endif
.ifndef SYMROOT
-SYMROOT = $(PWD)/SYMROOT
+SYMROOT != pwd
.endif
ARCH != arch
.ifndef RC_ARCHS
RC_ARCHS = $(ARCH)
RC_$(RC_ARCHS) = 1
.endif
+NARCHS != echo $(RC_ARCHS) | wc -w
.ifdef ALTUSRLOCALLIBSYSTEM
LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
.else
@@ -30,13 +17,10 @@
.endif
NJOBS != perl -e '$$n = `/usr/sbin/sysctl -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
BSDMAKE = bsdmake -f Makefile
-#BSDMAKEJ = $(BSDMAKE) -j $(NJOBS) -P
-BSDMAKEJ = $(BSDMAKE) -j $(NJOBS)
+#BSDMAKEJ = $(BSDMAKE) -j $(NJOBS)
+BSDMAKEJ = $(BSDMAKE) -j $(NJOBS) -P
-# Set the DONT-BUILD-arch-form variable to non-empty to turn off building
-#DONT-BUILD-x86_64-static = 1
-
-# These variables are to guarantee that the left-hand side of an expression is
+# This variables are to guarantee that the left-hand side of an expression is
# always a variable
dynamic = dynamic
static = static
@@ -48,19 +32,11 @@
all: build
-ROOTS := DSTROOT OBJROOT SYMROOT
-.for R in $(ROOTS) # {
-roots: $($(R))
-$($(R)):
- mkdir -p '$($(R))'
-.endfor # ROOTS }
-
# These are the non B&I defaults
.ifndef RC_ProjectName
-
-installhdrs: roots installhdrs-real
-build: roots build-static build-profile build-debug build-dynamic
-install: roots installhdrs install-all
+installhdrs: installhdrs-real
+build: build-static build-profile build-debug build-dynamic
+install: installhdrs install-all
.else # RC_ProjectName
@@ -68,163 +44,127 @@
# based on RC_ProjectName.
.if $(RC_ProjectName) == Libc
installhdrs:
-build: roots build-dynamic
-install: roots BI-install-dynamic
+build: build-dynamic
+install: BI-install-dynamic
.endif
.if $(RC_ProjectName) == Libc_headers
-installhdrs: roots installhdrs-real
+installhdrs: installhdrs-real
build:
-install: roots installhdrs-real
+install: installhdrs-real
.endif
.if $(RC_ProjectName) == Libc_man
installhdrs:
build:
-install: roots install-man
+install: install-man
.endif
.if $(RC_ProjectName) == Libc_static
installhdrs:
-build: roots build-static
-install: roots BI-install-static
+build: build-static
+install: BI-install-static
.endif
.if $(RC_ProjectName) == Libc_debug
installhdrs:
-build: roots build-debug
-install: roots BI-install-debug
+build: build-debug
+install: BI-install-debug
.endif
.if $(RC_ProjectName) == Libc_profile
installhdrs:
-build: roots build-profile
-install: roots BI-install-profile
+build: build-profile
+install: BI-install-profile
.endif
.endif # RC_ProjectName
-# Make a copy of System.framework/Versions/B/PrivateHeaders, with headers
-# patched so that we can build variant symbols independently
-SYSTEMFRAMEWORK = System.framework
-VERSIONSB = Versions/B
-PRIVATEHEADERPATH = $(SYSTEMFRAMEWORK)/$(VERSIONSB)/PrivateHeaders
-FRAMEWORKS = $(OBJROOT)/Frameworks
-.ifdef ALTFRAMEWORKSPATH
-FRAMEWORKPATH = ${ALTFRAMEWORKSPATH}
+# Because of 3780028, there are random failures on HFS because the
+# CC_PRINT_OPTIONS_FILE can't be created. So we touch it first.
+.if !empty $(CC_PRINT_OPTIONS_FILE)
+$(CC_PRINT_OPTIONS_FILE):
+ touch $(CC_PRINT_OPTIONS_FILE)
+.endif # CC_PRINT_OPTIONS_FILE
+
+.for F in $(FORMS)
+.if $(dynamic) == $(F)
+SUFFIX$(F) =
.else
-FRAMEWORKPATH = ${NEXT_ROOT}/System/Library/Frameworks
+SUFFIX$(F) = _$(F)
.endif
-$(FRAMEWORKS):
- $(SRCROOT)/patchHeaders $(FRAMEWORKPATH)/$(PRIVATEHEADERPATH) $(FRAMEWORKS)/$(PRIVATEHEADERPATH:H)
- ln -fs $(VERSIONSB)/PrivateHeaders $(FRAMEWORKS)/$(SYSTEMFRAMEWORK)/PrivateHeaders
+LIPOARGS$(F) != perl -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/obj.$$_/libc$(SUFFIX$(F)).a\"), qw($(RC_ARCHS))))'
-AUTOPATCHED = $(SRCROOT)/.autopatched
-PARTIAL = -partial
-.for F in $(FORMS) # {
-.if $(dynamic) == $(F) # {
-SUFFIX-$(F) =
-.else # } {
-SUFFIX-$(F) = _$(F)
-.endif # }
-PSUFFIX-$(F) = $(PARTIAL)$(SUFFIX-$(F))
+build-$(F): autopatch $(CC_PRINT_OPTIONS_FILE)
+.for A in $(RC_ARCHS)
+build-$(F): build-$(A)-$(F)
+.endfor # RC_ARCHS
+build-$(F):
+.if $(NARCHS) == 1
+ cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc$(SUFFIX$(F)).a" "$(SYMROOT)"
+.else
+ lipo -create $(LIPOARGS$(F)) -output $(SYMROOT)/libc$(SUFFIX$(F)).a
+.endif
-.for A in $(RC_ARCHS) # {
-.if empty(DONT-BUILD-$(A)-$(F)) # {
-ARCHS-$(F) += $(A)
+.for A in $(RC_ARCHS)
build-$(A)-$(F):
mkdir -p $(OBJROOT)/obj.$(A) && \
MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
- DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
- MAKEFLAGS="" CFLAGS="-arch $(A) $(LOCAL_CFLAGS)" $(BSDMAKEJ) libc$(SUFFIX-$(F)).a
-.else # } {
-build-$(A)-$(F):
- @echo Not building libc$(PSUFFIX-$(F)).a for $(A)
-.endif # }
-.endfor # RC_ARCHS }
+ MAKEFLAGS="" CFLAGS="-arch $(A) $(LOCAL_CFLAGS)" $(BSDMAKEJ) libc$(SUFFIX$(F)).a
+.endfor # RC_ARCHS
+.endfor # FORMS
-NARCHS-$(F) != echo $(ARCHS-$(F)) | wc -w
+# We have to separately call bsdmake to patch the FreeBSD files, because of
+# the way its cache works, it would otherwise pick A file in ${SYMROOT}, even
+# over A .s file.
+autopatch:
+.for A in $(RC_ARCHS)
+ MACHINE_ARCH="$(A)" $(BSDMAKEJ) autopatch
+.endfor # RC_ARCHS
-build-$(F): $(FRAMEWORKS) $(AUTOPATCHED)
-.for A in $(RC_ARCHS) # {
-build-$(F): build-$(A)-$(F)
-.endfor # RC_ARCHS }
-.if $(NARCHS-$(F)) == 0 # {
-build-$(F):
- @echo No libc$(PSUFFIX-$(F)).a built
-.else # } {
-LIPOARGS-$(F) != perl -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/obj.$$_/libc$(SUFFIX-$(F)).a\"), qw($(ARCHS-$(F)))))'
-build-$(F):
-.if $(NARCHS-$(F)) == 1 # {
- cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc$(SUFFIX-$(F)).a" "$(SYMROOT)/libc$(PSUFFIX-$(F)).a"
-.else # } {
- lipo -create $(LIPOARGS-$(F)) -output "$(SYMROOT)/libc$(PSUFFIX-$(F)).a"
-.endif # }
-.endif # }
-.endfor # FORMS }
+installsrc:
+ pax -rw . "$(SRCROOT)"
-# We autopatch the files into the directory containing the Makefile.inc. This
-# will happen at installsrc.
-$(AUTOPATCHED):
- @set -x && \
- for m in `find $(SRCROOT) -name Makefile.inc`; do \
- cd `dirname $$m` && \
- bsdmake -I $(SRCROOT) -f $(SRCROOT)/Makefile.inc -f Makefile.inc -f $(SRCROOT)/Makefile.autopatch autopatch LIB=c SRCROOT=$(SRCROOT) || \
- exit 1; \
- done
- touch $(AUTOPATCHED)
-
-copysrc:
- pax -rw -p p . "$(SRCROOT)"
-
-installsrc: copysrc $(AUTOPATCHED)
-
-installhdrs-real:
+installhdrs-real: $(CC_PRINT_OPTIONS_FILE)
MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" MAKEFLAGS="" \
- DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
- $(BSDMAKEJ) installhdrs
-.for A in $(RC_ARCHS) # {
+ $(BSDMAKEJ) installhdrs
+.for A in $(RC_ARCHS)
mkdir -p "$(OBJROOT)/obj.$(A)" && \
MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
- DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
- MAKEFLAGS="" $(BSDMAKEJ) installhdrs-md
-.endfor # RC_ARCHS # }
+ MAKEFLAGS="" $(BSDMAKEJ) installhdrs-md
+.endfor # RC_ARCHS
-.for F in $(FORMS) # {
+.for F in $(FORMS)
BI-install-$(F): build-$(F)
mkdir -p $(DSTROOT)/usr/local/lib/system
- if [ -f "$(SYMROOT)/libc$(PSUFFIX-$(F)).a" ]; then \
- echo "Installing libc$(PSUFFIX-$(F)).a" && \
- install -c -m 444 "$(SYMROOT)/libc$(PSUFFIX-$(F)).a" \
+ if [ -f "$(SYMROOT)/libc$(SUFFIX$(F)).a" ]; then \
+ echo "Installing libc$(SUFFIX$(F)).a" && \
+ install -c -m 444 "$(SYMROOT)/libc$(SUFFIX$(F)).a" \
$(DSTROOT)/usr/local/lib/system && \
- ranlib "$(DSTROOT)/usr/local/lib/system/libc$(PSUFFIX-$(F)).a" || exit 1; \
+ ranlib "$(DSTROOT)/usr/local/lib/system/libc$(SUFFIX$(F)).a"; \
fi
-.if $(dynamic) == $(F) # {
-.for A in $(RC_ARCHS) # {
- MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
- DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
- DSTROOT=$(DSTROOT) OBJROOT=$(OBJROOT) SYMROOT=$(SYMROOT) \
- MAKEFLAGS="" $(BSDMAKE) copyfiles
-.endfor # RC_ARCHS # }
-.endif # }
-.endfor # FORMS }
+.if !empty $(RC_ppc) && ($(static) != $(F))
+ if [ -f "$(OBJROOT)/obj.ppc/libc-ldbl128$(SUFFIX$(F)).a" ]; then \
+ echo "Installing libldbl128$(SUFFIX$(F)).a" ; \
+ $(SRCROOT)/make_libldbl128 "$(OBJROOT)/obj.ppc/libc-ldbl128$(SUFFIX$(F)).a" \
+ "$(SUFFIX$(F))" "$(DSTROOT)/usr/local/lib/system" $(LIBSYS) ; \
+ fi
+.endif # RC_ppc && !static
+.endfor # FORMS
# Don't use -j here; it may try to make links before the files are copied
-MANARGS != test `id -u` -eq 0 || echo MINSTALL=/usr/bin/install
install-man:
mkdir -p $(DSTROOT)/usr/share/man/man2
mkdir -p $(DSTROOT)/usr/share/man/man3
mkdir -p $(DSTROOT)/usr/share/man/man4
mkdir -p $(DSTROOT)/usr/share/man/man5
mkdir -p $(DSTROOT)/usr/share/man/man7
- MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" \
- DSTROOT='$(DSTROOT)' OBJROOT='$(OBJROOT)' SYMROOT='$(SYMROOT)' \
- MACHINE_ARCH="$(ARCH)" MAKEFLAGS="" \
- $(BSDMAKE) autopatchman all-man maninstall $(MANARGS)
+ MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" NOMANCOMPRESS=1 \
+ MACHINE_ARCH="$(ARCH)" MAKEFLAGS="" $(BSDMAKE) autopatchman maninstall
install-all: build install-man
-.for F in $(FORMS) # {
+.for F in $(FORMS)
install-all: BI-install-$(F)
-.endfor # FORMS }
+.endfor # FORMS
clean:
-.for F in $(FORMS) # {
- rm -f $(SYMROOT)/libc$(PSUFFIX-$(F)).a
-.endfor # FORMS }
-.for A in $(RC_ARCHS) # {
+.for F in $(FORMS)
+ rm -f $(OBJROOT)/libc$(SUFFIX$(F)).a
+.endfor # FORMS
+.for A in $(RC_ARCHS)
rm -rf $(OBJROOT)/obj.$(A)
-.endfor # RC_ARCHS # }
+.endfor # RC_ARCHS