X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/8e029c653e0567df7ce6933dde41f5830dbbbcda..b5d655f7532a546b54809da387f7467d128a756b:/Makefile diff --git a/Makefile b/Makefile index d8357bc..1cea12a 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,6 @@ # @(#)Makefile 8.2 (Berkeley) 2/3/94 # $FreeBSD: src/lib/libc/Makefile,v 1.31 2001/08/13 21:48:43 peter Exp $ # -# All library objects contain rcsid strings by default; they may be -# excluded as a space-saving measure. To produce a library that does -# not contain these strings, delete -DLIBC_RCS and -DSYSLIBC_RCS -# from CFLAGS below. To remove these strings from just the system call -# stubs, remove just -DSYSLIBC_RCS from CFLAGS. -# # Yes, we build everything with -g, and strip it out later... # # -faltivec now disables inlining, so we can't use it globally. Fortunately, @@ -22,29 +16,48 @@ MACHINE_ARCH != /usr/bin/arch .if !empty $(MACHINE_ARCH:M*64) LP64 = 1 .endif -CC = gcc-4.0 -# always set __DARWIN_UNIX03 to zero (variant will set to one) except for ppc64 -.ifdef LP64 -CFLAGS += -D__DARWIN_UNIX03=1 -.else -CFLAGS += -D__DARWIN_UNIX03=0 +# 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 -CFLAGS += -D__LIBC__ -DNOID -I${.CURDIR}/include + +#use default compiler +#CC = gcc-4.0 +GCC_VERSION != cc -dumpversion | sed -e 's/^\([^.]*\.[^.]*\).*/\1/' +GCC_42 != perl -e "print ($(GCC_VERSION) >= 4.2 ? 'YES' : 'NO')" + .ifdef ALTLIBCHEADERS INCLUDEDIR = ${ALTLIBCHEADERS} -CFLAGS += -I${INCLUDEDIR} +LIBCFLAGS += -I${INCLUDEDIR} +.else # !ALTLIBCHEADERS +INCLUDEDIR = ${SDKROOT}/usr/include +.endif # ALTLIBCHEADERS +FRAMEWORKS = ${OBJROOT}/Frameworks +PRIVATEHEADERS = ${FRAMEWORKS}/System.framework/PrivateHeaders +PRIVINC = -I${PRIVATEHEADERS} +LIBCFLAGS += ${PRIVINC} + +SYMROOTINC = ${SYMROOT}/include +CFLAGS = -g -arch ${CCARCH} ${RC_NONARCH_CFLAGS} -std=gnu99 -fno-common -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 +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 ALTFRAMEWORKSPATH -PRIVINC = -F${ALTFRAMEWORKSPATH} -I${ALTFRAMEWORKSPATH}/System.framework/PrivateHeaders -.else -PRIVINC = -I${NEXT_ROOT}/System/Library/Frameworks/System.framework/PrivateHeaders +.ifdef SDKROOT +CFLAGS += -isysroot '${SDKROOT}' +AINC += -isysroot '${SDKROOT}' +.endif # SDKROOT + +.if ${GCC_42} != YES +CFLAGS += -no-cpp-precomp +AINC += -no-cpp-precomp .endif -CFLAGS += ${PRIVINC} -CFLAGS += -DLIBC_MAJOR=${SHLIB_MAJOR} -no-cpp-precomp -force_cpusubtype_ALL -CFLAGS += -fno-common -pipe -Wmost -g -D__FBSDID=__RCSID -CFLAGS += -finline-limit=1500 --param inline-unit-growth=200 -Winline -AINC= -I${.CURDIR}/${MACHINE_ARCH} -no-cpp-precomp -force_cpusubtype_ALL -AINC+=-arch ${MACHINE_ARCH} -g CLEANFILES+=tags INSTALL_PIC_ARCHIVE= yes PRECIOUSLIB= yes @@ -52,14 +65,6 @@ PRECIOUSLIB= yes # workaround for 3649783 AINC += -fdollars-in-identifiers -# ppc64 optimizer still blows up on some files, so we use -O0 to turn it -# off on a per file basis -.if (${MACHINE_ARCH} == ppc64) -OPTIMIZE-acl_entry.c = -O0 -# glob-fbsd.c fails with -static -Os (3869444) so turn off optimization -OPTIMIZE-glob-fbsd.c = -O0 -.endif - # If these aren't set give it expected defaults DSTROOT ?= / OBJROOT ?= . @@ -71,10 +76,16 @@ _x_ != test -d ${SYMROOT} || mkdir -p ${SYMROOT} DESTDIR ?= ${DSTROOT} MAKEOBJDIR ?= ${OBJROOT} -CFLAGS += -I${SYMROOT} +# add version string +SRCS += libc_version.c +libc_version.c: + ${SDKROOT}/Developer/Makefiles/bin/version.pl Libc > $@ + +.include "Makefile.features" .include "${.CURDIR}/Makefile.inc" -.PATH: ${SYMROOT} .include "Makefile.xbs" + +MANFILTER = unifdef -t ${UNIFDEFARGS} .if exists(/usr/share/mk/bsd.init.mk) .include .endif