# APPLE LOCAL file build machinery # Apple GCC Compiler Makefile for use by buildit. # # This makefile is intended only for use with B&I buildit. For "normal" # builds use the conventional FSF top-level makefile. # # Usage: # # 1. Set BUILDIT_DIR to where you want the build to go. Buildit uses # this to set up DSTROOT, OBJROOT, etc. # # examples: # export BUILDIT_DIR=/tmp/build_goes_here [sh or bash] # setenv BUILDIT_DIR /tmp/build_goes_here [csh or tcsh] # # 2. Run buildit. Here's a brief general description generated by # running buildit --help (reformatted to fit in here): # # Usage: buildit projectSourceDirectory [build options] \ # [-- other arguments] # # Mandatory argument: # projectSourceDirectory The root directory of project source # tree (can be absolute or relative # path to the project source tree) # # Build options: # -release Use RC_CFLAGS (compiler flags) from # specified release (use release name # like Cheetah, Puma, Jaguar, ...) # -arch Build with specified architectures(s) # (-arch can be multiply specified: # -arch ppc -arch i386) # (default is native architecture) # -noclean Disables deletion of {OBJ,SYM,DST}ROOT # before start of build # -noinstall Disables invocation of 'install' target # -noinstallhdrs Disables invocation of 'installhdrs' target # -noinstallsrc Disables invocation of 'installsrc' target # -noverify Disables verification of project DSTROOT # after build # -nosum Disables before-and-after checksumming # of project source # -noprebind Disables prebinding # -noperms Disables permissions setting on DSTROOT # after build # -merge Merges resulting DSTROOT into "mergeDir" # -target Specifies an alternate Make or Jam build # target (instead of "install") # -othercflags Specified cflags are appended to RC_CFLAGS # for build # # Other arguments: # Other arguments can be passed to the makefile by putting them # at the end of the buildit argument list following a double dash ("--"). # Arguments that contain whitespace should be enclosed in quotes. # # examples: (assume $gcc3 is shell variable with gcc3 dir in it) # # Creating a new root: # mkdir /tmp/my-build # cd /tmp/my-build # export BUILDIT_DIR=`pwd` # ~rc/bin/buildit -noverify -nosum -noinstallsrc -noinstallhdrs \ # -arch ppc -arch i386 $gcc3 BOOTSTRAP= # # Rebuilding the previous root (assumes BUILDIT_DIR unchanged): # ~rc/bin/buildit -noverify -nosum -noinstallsrc -noinstallhdrs \ # -noclean -arch ppc -arch i386 $gcc3 # # You can specify BOOTSTRAP= to stop the normal bootstapping of the # compiler during it's build. # # You can specify TARGETS=ppc (or i386) to limit the build to just one # target. The default is for ppc and i386. # ####################################################################### # # ** AUTOMATIC BUILDS ** # # Automatic builds strictly follow the B&I makefile API standards. # # Include the set of standard Apple makefile definitions. ifndef CoreOSMakefiles CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS endif include $(CoreOSMakefiles)/Standard/Standard.make # Enable Apple extensions to (gnu)make. USE_APPLE_PB_SUPPORT = all HOSTS = ppc i386 # `arch` targets = echo $${TARGETS:-'ppc i386'} TARGETS := $(shell $(targets)) RC_ARCHS = $(HOSTS) SRCROOT = . SRC = `cd $(SRCROOT) && pwd | sed s,/private,,` OBJROOT = $(SRC)/obj SYMROOT = $(OBJROOT)/../sym DSTROOT = $(OBJROOT)/../dst MANPLACE := $(OBJROOT)/cc-$(firstword $(TARGETS))-on-$(firstword $(HOSTS)) # Set BOOTSTRAP to null (either here on on the buildit cmd line) to # disable a bootstrap build. BOOTSTRAP = --bootstrap # Set ENABLE_CHECKING to null (either here or on the buildit cmd line) # to disable generating a compiler the has tree and rtl access checking # code in it. #ifneq ($(RC_RELEASE),) # ENABLE_CHECKING = --disable-checking #else # ENABLE_CHECKING = --enable-checking #endif ENABLE_CHECKING= ifeq ($(ENABLE_CHECKING),) ENABLE_CHECKING1 = --disable-checking else ifeq ($(ENABLE_CHECKING),--disable-checking) ENABLE_CHECKING1 = --disable-checking else ENABLE_CHECKING1 = --enable-checking endif endif VERSION =`fgrep version_string < $(SRCROOT)/gcc/version.c | \ sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/'` ARCH = `arch` PREFIX = /usr std_include_dir = $(DSTROOT)/usr/include gcc_hdr_dir = $(std_include_dir)/gcc/darwin/$(VERSION) gcc_man1_dir = $(DSTROOT)/usr/share/man/man1 # Order of buildit events. # 1. installsrc # 2. clean # 3. installhdrs: installs $DSTROOT.hdrDst/ $DSTROOT.hdrObj/ $DSTROOT.hdrSym/ # 4. install: $DSTROOT.dst/ $DSTROOT.obj/ $DSTROOT.sym/ # DO_SYMLINKS set to 'yes' will all the full gcc3 installation which # includes generating sym links in various places. These sym links # are in the same places with the same names as those generated by # gcc2. We may not want to clobber gcc2's sym links. Thus setting # DO_SYMLINKS to 'no' will suppress them. DO_SYMLINKS = no # DO_HDR_SYMLINKS is similar to DO_SYMLINKS but only controls the # generation of the sym links for the headers in /usr/include. DO_HDR_SYMLINKS = no # OPTIMIZE controls the optimization level we build the compiler # with. The default is "yes", which is synomous with -O2. OPTIMIZE = ####################################################################### install: installhdrs build install_no_src @echo @echo ++++++++++++++ @echo + Installing + @echo ++++++++++++++ @echo if [ "$(DO_SYMLINKS)" = yes ]; then \ cd $(DSTROOT)/usr/libexec/gcc/darwin && \ for dir in *; do \ cd $(DSTROOT)/usr/libexec/gcc/darwin/$$dir && \ rm -f default && \ ln -s $(VERSION) default; \ done && \ cd $(DSTROOT)/usr/lib/gcc/darwin && \ rm -f default && \ ln -s $(VERSION) default; \ fi installhdrs: DSTROOT @echo @echo ++++++++++++++++++++++ @echo + Installing headers + @echo ++++++++++++++++++++++ @echo mkdir -p $(gcc_hdr_dir) mkdir -p $(gcc_hdr_dir)/machine if [ "$(DO_HDR_SYMLINKS)" = yes ]; then \ mkdir -p $(std_include_dir)/machine && \ rm -f $(std_include_dir)/gcc/darwin/default && \ ln -s $(VERSION) $(std_include_dir)/gcc/darwin/default; \ fi for file in gcc/ginclude/stdarg.h \ gcc/ginclude/varargs.h \ gcc/ginclude/stdbool.h \ `ls more-hdrs/*.h`; do \ install -c -m 444 $$file $(gcc_hdr_dir) && \ if [ "$(DO_HDR_SYMLINKS)" = yes -a \ "$$file" != "more-hdrs/ppc_intrinsics.h" ]; then \ file1=$${file##*/} && \ rm -f $(std_include_dir)/$$file1 && \ ln -s gcc/darwin/default/$$file1 $(std_include_dir); \ fi \ done case "${TARGETS}" in \ *i386*) install -c -m 444 gcc/config/i386/*mmintrin.h $(gcc_hdr_dir) ;;\ esac rm -f /tmp/float.$$$$ && \ more-hdrs/synthesize-float $(SRC) /tmp/float.$$$$ $(RC_RELEASE) && \ install -c -m 444 /tmp/float.$$$$ $(gcc_hdr_dir)/float.h && \ if [ "$(DO_HDR_SYMLINKS)" = yes ]; then \ rm -f $(std_include_dir)/float.h && \ ln -s gcc/darwin/default/float.h $(std_include_dir); \ fi && \ rm -f /tmp/float.$$$$ && \ rm -f /tmp/limits.$$$$ && \ more-hdrs/synthesize-limits $(SRC) /tmp/limits.$$$$ && \ install -c -m 444 /tmp/limits.$$$$ $(gcc_hdr_dir)/machine/limits.h && \ rm -f /tmp/limits.$$$$ if [ "$(DO_HDR_SYMLINKS)" = yes ]; then \ rm -f $(std_include_dir)/machine/limits.h && \ ln -s ../gcc/darwin/default/machine/limits.h $(std_include_dir)/machine; \ fi # Note for future reference: Relative symlinks like the one above are # always relative to the sym link. So in the above ln -s # $(std_include_dir)/machine is "in" the machine dir. So we need to # go "up" to $(std_include_dir) and then down to the actual # machine/limits. build: OBJROOT SYMROOT @echo @echo +++++++++ @echo + build + @echo +++++++++ @echo APPLE_CC=`if echo $(SRCROOT) | grep '[0-9]$$' >/dev/null; then \ vers_string -f cc 2>/dev/null | sed -e 's/[-A-Za-z_]*//' \ | sed -e 's/\.[0-9.]*//'; \ else date +%Y%m%d%H%M%S; \ fi`; \ export APPLE_CC; \ ./build_gcc --thins \ --srcroot=$(SRC) \ --dstroot=$(DSTROOT) \ --objroot=$(OBJROOT) \ --symroot=$(SYMROOT) \ --cflags="$(RC_CFLAGS) $(OTHER_CFLAGS) -g" \ --hosts="$(RC_ARCHS)" \ --targets="$(TARGETS)" \ --prefix="$(PREFIX)" \ --symlinks=$(DO_SYMLINKS) \ --optimize="$(OPTIMIZE)" \ $(ENABLE_CHECKING1) \ $(BOOTSTRAP) install_no_src: @echo @echo ++++++++++++++++++ @echo + install_no_src + @echo ++++++++++++++++++ @echo APPLE_CC=`if echo $(SRCROOT) | grep '[0-9]$$' >/dev/null; then \ vers_string -f cc 2>/dev/null | sed -e 's/[-A-Za-z_]*//' \ | sed -e 's/\.[0-9.]*//'; \ else date +%Y%m%d%H%M%S; \ fi`; \ export APPLE_CC; \ ./build_gcc --fats \ --srcroot=$(SRC) \ --dstroot=$(DSTROOT) \ --objroot=$(OBJROOT) \ --symroot=$(SYMROOT) \ --cflags="$(RC_CFLAGS) $(OTHER_CFLAGS)" \ --hosts="$(RC_ARCHS)" \ --targets="$(TARGETS)" \ --prefix="$(PREFIX)" \ --symlinks=$(DO_SYMLINKS) mkdir -p $(gcc_man1_dir) rm -f $(gcc_man1_dir)/g++-$(VERSION).1 rm -f $(gcc_man1_dir)/c++-$(VERSION).1 if [ -f $(MANPLACE)/gcc.1 ] ; then \ install -c -m 444 $(MANPLACE)/gcc.1 \ $(gcc_man1_dir)/gcc-$(VERSION).1 && \ install -c -m 444 $(MANPLACE)/cpp.1 \ $(gcc_man1_dir)/cpp-$(VERSION).1 && \ install -c -m 444 $(MANPLACE)/gcov.1 \ $(gcc_man1_dir)/gcov-$(VERSION).1 ; \ else \ install -c -m 444 man-pages/gcc3.1 \ $(gcc_man1_dir)/gcc-$(VERSION).1 && \ install -c -m 444 man-pages/cpp3.1 \ $(gcc_man1_dir)/cpp-$(VERSION).1 && \ install -c -m 444 man-pages/gcov3.1 \ $(gcc_man1_dir)/gcov-$(VERSION).1 ; \ fi ln -s gcc-$(VERSION).1 $(gcc_man1_dir)/g++-$(VERSION).1 ln -s gcc-$(VERSION).1 $(gcc_man1_dir)/c++-$(VERSION).1 installsrc: SRCROOT @echo @echo ++++++++++++++++++++++ @echo + Installing sources + @echo ++++++++++++++++++++++ @echo if [ $(SRCROOT) != . ]; then \ $(PAX) -rw . $(SRCROOT); \ fi find -d "$(SRCROOT)" \( -type d -a -name CVS -o \ -type f -a -name .DS_Store \) \ -exec rm -rf {} \; ####################################################################### clean: @echo @echo ++++++++++++ @echo + Cleaning + @echo ++++++++++++ @echo @if [ -d $(OBJROOT) -a "$(OBJROOT)" != / ]; then \ echo '*** DELETING ' $(OBJROOT); \ rm -rf $(OBJROOT); \ fi @if [ -d $(SYMROOT) -a "$(SYMROOT)" != / ]; then \ echo '*** DELETING ' $(SYMROOT); \ rm -rf $(SYMROOT); \ fi @if [ -d $(DSTROOT) -a "$(DSTROOT)" != / ]; then \ echo '*** DELETING ' $(DSTROOT); \ rm -rf $(DSTROOT); \ fi ####################################################################### OBJROOT SYMROOT DSTROOT KEYMGR_OBJ: mkdir -p $($@) ####################################################################### SRCROOT: @if [ -n "$($@)" ]; \ then \ exit 0; \ else \ echo Must define $@; \ exit 1; \ fi