]> git.saurik.com Git - apple/libc.git/blobdiff - Makefile
Libc-594.9.4.tar.gz
[apple/libc.git] / Makefile
index 34a4b2d13fedbc0cb7f1463d90cf91cf7bd68a6c..d2a3e7c07c821e63f7e25b37bbf3edeec5f330d2 100644 (file)
--- a/Makefile
+++ b/Makefile
 LIB=c
 SHLIB_MAJOR= 1
 SHLIB_MINOR= 0
-.if (${MACHINE_ARCH} == unknown)
-MACHINE_ARCH != /usr/bin/arch
-.endif 
-.if !empty $(MACHINE_ARCH:M*64)
+
+.include <CoreOS/Standard/Commands.mk>
+.include <CoreOS/Standard/Variables.mk>
+
+.if !empty(MACHINE_ARCH:M*64)
 LP64 = 1
 .endif
-CC = gcc-4.0
-CFLAGS += -D__LIBC__ -D__DARWIN_UNIX03=1 -D__DARWIN_64_BIT_INO_T=1 -D__DARWIN_NON_CANCELABLE=1 -D__DARWIN_VERS_1050=1
-CFLAGS += -DNOID -I${.CURDIR}/include -std=gnu99
+# RC_TARGET_CONFIG may not be set, so default to MacOSX (which is good enough
+# for installsrc to autopatch all files).
+.ifndef RC_TARGET_CONFIG
+RC_TARGET_CONFIG = MacOSX
+.endif
+
+# Use default compiler, so comment out OTHERCC
+#OTHERCC = gcc-4.0
+# HOSTCC is the compiler on the local host, so we need to unset any SDKROOT
+# to before calling PATH_OF_COMMAND
+.ifdef OTHERCC
+MYCC != ${PATH_OF_COMMAND} ${OTHERCC}
+HOSTCC != export -n SDKROOT && ${PATH_OF_COMMAND} ${OTHERCC}
+.else
+MYCC = ${CC}
+HOSTCC != export -n SDKROOT && ${PATH_OF_COMMAND} cc
+.endif
+GCC_VERSION != ${MYCC} -dumpversion | ${SED} -e 's/^\([^.]*\.[^.]*\).*/\1/'
+GCC_42 != ${PERL} -e "print ($(GCC_VERSION) >= 4.2 ? 'YES' : 'NO')"
+
 .ifdef ALTLIBCHEADERS
 INCLUDEDIR = ${ALTLIBCHEADERS}
 LIBCFLAGS += -I${INCLUDEDIR}
-.endif
-LIBCFLAGS += -I$(SRCROOT)/include -include _.libc_internal.h
+.else # !ALTLIBCHEADERS
+INCLUDEDIR = ${SDKROOT}/usr/include
+.endif # ALTLIBCHEADERS
 FRAMEWORKS = ${OBJROOT}/Frameworks
 PRIVATEHEADERS = ${FRAMEWORKS}/System.framework/PrivateHeaders
-PRIVINC = -F${FRAMEWORKS} -I${PRIVATEHEADERS}
-CFLAGS += ${PRIVINC} -I${.OBJDIR}
-CFLAGS += -DLIBC_MAJOR=${SHLIB_MAJOR} -no-cpp-precomp -force_cpusubtype_ALL
-CFLAGS += -fno-common -pipe -Wmost -g -D__FBSDID=__RCSID
-AINC=  -I${.CURDIR}/${MACHINE_ARCH} -no-cpp-precomp -force_cpusubtype_ALL
-AINC+=-arch ${MACHINE_ARCH} -g
+PRIVINC = -I${PRIVATEHEADERS}
+LIBCFLAGS += ${PRIVINC}
+
+SYMROOTINC = ${SYMROOT}/include
+CFLAGS = -g -arch ${CCARCH} ${RC_NONARCH_CFLAGS} -std=gnu99 -fno-common -fno-builtin -Wmost
+CFLAGS += -D__LIBC__ -D__DARWIN_UNIX03=1 -D__DARWIN_64_BIT_INO_T=1 -D__DARWIN_NON_CANCELABLE=1 -D__DARWIN_VERS_1050=1 -D_FORTIFY_SOURCE=0
+CFLAGS += -DNOID -DLIBC_MAJOR=${SHLIB_MAJOR}
+CFLAGS += -I${.OBJDIR} -I${SYMROOTINC} -I${.CURDIR}/include
+AINC = -g -arch ${CCARCH} ${RC_NONARCH_CFLAGS}
+AINC += -I${.CURDIR}/${MACHINE_ARCH} ${PRIVINC}
+.if $(MACHINE_ARCH) != arm
+CFLAGS += -force_cpusubtype_ALL
+AINC += -force_cpusubtype_ALL
+.endif
+.ifdef SDKROOT 
+CFLAGS += -isysroot '${SDKROOT}'
+AINC += -isysroot '${SDKROOT}'
+.endif # SDKROOT
+
+.if ${GCC_42} != YES
+CFLAGS += -no-cpp-precomp
+AINC += -no-cpp-precomp
+.endif
 CLEANFILES+=tags
 INSTALL_PIC_ARCHIVE=   yes
 PRECIOUSLIB=   yes
@@ -39,18 +75,13 @@ PRECIOUSLIB=        yes
 # workaround for 3649783
 AINC += -fdollars-in-identifiers
 
-# workaround for 4268581
-.if make(lib${LIB}_static.a)
-OPTIMIZE-glob-fbsd.c += -O0
-.endif
-
 # If these aren't set give it expected defaults
 DSTROOT ?= /
 OBJROOT ?= .
 SRCROOT ?= ${.CURDIR}
 .ifndef SYMROOT
 SYMROOT = ${.CURDIR}/SYMROOT
-_x_ != test -d ${SYMROOT} || mkdir -p ${SYMROOT}
+_x_ != ${TEST} -d ${SYMROOT} || ${MKDIR} ${SYMROOT}
 .endif
 DESTDIR ?= ${DSTROOT}
 MAKEOBJDIR ?= ${OBJROOT}
@@ -58,11 +89,12 @@ MAKEOBJDIR ?= ${OBJROOT}
 # add version string
 SRCS += libc_version.c
 libc_version.c:
-       /Developer/Makefiles/bin/version.pl Libc > $@
+       ${SDKROOT}/Developer/Makefiles/bin/version.pl Libc > $@
 
+.include "Makefile.features"
 .include "${.CURDIR}/Makefile.inc"
 .include "Makefile.xbs"
-.if exists(/usr/share/mk/bsd.init.mk)
+
+MANFILTER = ${UNIFDEF} -t ${UNIFDEFARGS}
 .include <bsd.init.mk>
-.endif
 .include <bsd.man.mk>