# $Id$ # # Top level makefile. # # InnoTek Systemberatung GmbHconfidential # # Copyright (c) 2003 InnoTek Systemberatung GmbH # Author: knut st. osmundsen # # All Rights Reserved # ############################################################################### ## Global Variables ## (D = no drive) ############################################################################### PWD := $(shell pwd) PWDD := $(shell pwd|sed 's/^[a-zA-Z]://') MAKEFILE = $(PWD)/Makefile ifndef BUILD_MODE export BUILD_MODE=DEBUG endif ifndef PATH_TOP export PATH_TOP := $(PWD) endif ifndef PATH_TOPD export PATH_TOPD := $(PWDD) endif export PATH_BIN = $(PATH_TOP)/bin/$(BUILD_PLATFORM)/$(BUILD_MODE) export PATH_BIND = $(PATH_TOPD)/bin/$(BUILD_PLATFORM)/$(BUILD_MODE) export PATH_OBJ = $(PATH_TOP)/obj/$(BUILD_PLATFORM)/$(BUILD_MODE) export PATH_OBJD = $(PATH_TOPD)/obj/$(BUILD_PLATFORM)/$(BUILD_MODE) export PATH_BUILTTOOLS = $(PATH_OBJ)/builttools export PATH_BUILTTOOLSD= $(PATH_OBJD)/builttools # Debug info or not (when ever we feel like passing down such options). # Several ways to do this it seems. ifeq "$(BUILD_MODE)" "RELEASE" BUILD_DEBUGINFO = -s BUILD_ENABLE_SYMBOLS = --disable-symbols else BUILD_DEBUGINFO = -g BUILD_ENABLE_SYMBOLS = --enable-symbols endif # Version and CVS defines export GCC_VERSION ?= 3.2.2 export GCC_VERSION_SHORT ?= 3022 export GCC_CVS_VENDOR ?= GNU export GCC_CVS_REL ?= GCC_3-2-2 export BINUTILS_VERSION ?= 2.11.2 export BINUTILS_VERSION_SHORT ?= 2112 export BINUTILS_CVS_VENDOR ?= GNU export BINUTILS_CVS_REL ?= BINUTILS_2-11-2 export EMX_VERSION ?= 0.9d-fix04 export EMX_VERSION_SHORT ?= 9d04 export EMX_CVS_VENDOR ?= EMX export EMX_CVS_REL ?= EMX_0-9D-FIX04 # innotek version and timestamp export INNOTEK_VERSION ?= (Innotek Build $(shell date '+%Y-%m-%d %H:%M')) # # For builds on Linux Host builds we do the environment setup here. # This is essentially a mimicking of what we do on OS/2. # ifndef BUILD_PLATFORM ifeq "$(shell uname -s)" "Linux" export BUILD_PLATFORM ?= LINUX export BUILD_PROJECT ?= GCCOS2 export SH ?= /bin/sh export ASH ?= /bin/ash export BASH ?= /bin/bash export AWK ?= /bin/gawk export GAWK ?= /bin/gawk export CONFIG_SHELL ?= $(SH) export MAKESHELL ?= $(SH) export PATH_EMX ?= /usr export PATH_EMXPGCC ?= /usr export TMP ?= /tmp export TMPDIR ?= /tmp endif endif # Misc Helpers ALL_PREFIX = $(PATH_BIND)/$(GCC_VERSION)/usr TOOL_CVS_DIFF_TREE = -cvs diff -R -N -w -u -r ############################################################################### ############################################################################### ############################################################################### ############################################################################### # # M a i n R u l e z # ############################################################################### ############################################################################### ############################################################################### ############################################################################### all: mkdir -p $(PATH_OBJ) $(MAKE) -C . all-logged 2>&1 | $(UNIXROOT)/usr/bin/tee $(PATH_OBJ)/build-`date +"%Y%m%d-%H%M%S"`.log all-logged: \ all-banner-start \ all-env \ all-sanity \ all-preload \ all-versionstamps \ all-symlinks \ \ all-stage1 \ all-stage2 \ \ all-install \ \ all-symlinks-unlink @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Make Ended Successfully: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" # # banners # all-banner-start: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Make started: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-banner-stage1: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Stage 1 - starting: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-banner-stage2: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Stage 2 - starting: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-banner-builttools-initial: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Initializing builttools tree" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-banner-builttools-stage2: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Copying stage2 builttools" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-banner-install: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Install - starting: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-banner-install-done: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Install - done: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" # # Sanity and environment dumps - to make it easier to figure out make bugs. # all-env: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "Variables:" @echo " PWD = $(PWD)" @echo " PWDD = $(PWDD)" @echo " PATH_TOP = $(PATH_TOP)" @echo " PATH_TOPD = $(PATH_TOPD)" @echo " PATH_OBJ = $(PATH_OBJ)" @echo " PATH_OBJD = $(PATH_OBJD)" @echo " PATH_BIN = $(PATH_BIN)" @echo " PATH_BIND = $(PATH_BIND)" @echo " ALL_PREFIX = $(ALL_PREFIX)" @echo " PATH_EMXPGCC = $(PATH_EMXPGCC)" @echo " PATH_EMX = $(PATH_EMX)" @echo " BUILD_MODE = $(BUILD_MODE)" @echo " BUILD_PLATFORM = $(BUILD_PLATFORM)" @echo " BUILD_PROJECT = $(BUILD_PROJECT)" @echo " GCC_VERSION = $(GCC_VERSION)" @echo " GCC_VERSION_SHORT = $(GCC_VERSION_SHORT)" @echo " GCC_CVS_VENDOR = $(GCC_CVS_VENDOR)" @echo " GCC_CVS_REL = $(GCC_CVS_REL)" @echo " BINUTILS_VERSION = $(BINUTILS_VERSION)" @echo " BINUTILS_VERSION_SHORT = $(BINUTILS_VERSION_SHORT)" @echo " BINUTILS_CVS_VENDOR = $(BINUTILS_CVS_VENDOR)" @echo " BINUTILS_CVS_REL = $(BINUTILS_CVS_REL)" @echo " EMX_VERSION = $(EMX_VERSION)" @echo " EMX_VERSION_SHORT = $(EMX_VERSION_SHORT)" @echo " EMX_CVS_VENDOR = $(EMX_CVS_VENDOR)" @echo " EMX_CVS_REL = $(EMX_CVS_REL)" @echo " MAKEFILE = $(MAKEFILE)" @echo " UNIXROOT = $(UNIXROOT)" @echo " AC_PREFIX = $(AC_PREFIX)" @echo " AC_MACRODIR = $(AC_MACRODIR)" @echo " HOSTNAME = $(HOSTNAME)" @echo " USER = $(USER)" @echo " LOGNAME = $(LOGNAME)" @echo " TMP = $(TMP)" @echo " TMPDIR = $(TMPDIR)" @echo " USER = $(USER)" @echo " AWK = $(AWK)" @echo " GAWK = $(GAWK)" @echo " SH = $(SH)" @echo " ASH = $(ASH)" @echo " BASH = $(BASH)" @echo " CONFIG_SHELL = $(CONFIG_SHELL)" @echo " MAKESHELL = $(MAKESHELL)" @echo " EMXSHELL = $(EMXSHELL)" @echo " SHELL = $(SHELL)" @echo " MAKE = $(MAKE)" @echo " PATH = $(PATH)" @echo " C_INCLUDE_PATH = $(C_INCLUDE_PATH)" @echo " CPLUS_INCLUDE_PATH = $(CPLUS_INCLUDE_PATH)" @echo " OBJC_INCLUDE_PATH = $(OBJC_INCLUDE_PATH)" @echo " LIBRARY_PATH = $(LIBRARY_PATH)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "Content of PATH_OBJ:" -ls -la $(PATH_OBJ)/ @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "Content of PATH_BIN:" -ls -la $(PATH_BIN)/ @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-sanity: @echo -n "Checking build environment sanity... " @if [ "x$(BUILD_PROJECT)" != "xGCCOS2" ]; then \ echo ""; echo "Error: BUILD_PROJECT is wrong or isn't defined!"; \ exit 8; \ fi @if [ "x$(BUILD_PLATFORM)" != "xOS2" -a "x$(BUILD_PLATFORM)" != "xLINUX" ]; then \ echo ""; echo "Error: BUILD_PLATFORM is wrong or isn't defined!"; \ exit 8; \ fi @if [ "x$(BUILD_PLATFORM)" = "xOS2" -a "x$(UNIXROOT)" = "x" ]; then \ echo ""; echo "Error: UNIXROOT isn't defined!"; \ exit 8; \ fi @if [ "x$(BUILD_PLATFORM)" != "xOS2" -a "x$(UNIXROOT)" != "x" ]; then \ echo ""; echo "Error: UNIXROOT is defined!"; \ exit 8; \ fi ifeq "$(BUILD_PLATFORM)" "OS2" @if gcc --version | grep -qe ".*[3]\.[2-9]\.[0-9]"; then \ true; \ else \ echo ""; echo "Warning: GCC v3.2.x or higher is recommended!"; \ fi @if ar --version | grep -qe ".*2\.11\.[2-9]" -e ".*[2]\.1[2-9]\.[0-9]*"; then \ true; \ else \ echo ""; echo "Warning: AR v2.11.2 or higher is recommended!"; \ fi endif @echo "ok" # # Preload tools we commonly use this speeds up stuff. # PRELOADED_TOOLS = bin/sh.exe bin/echo.exe bin/true.exe usr/bin/test.exe usr/bin/expr.exe \ usr/bin/gawk.exe usr/bin/sed.exe bin/rm.exe bin/cat.exe bin/cp.exe all-preload: @echo "Preloading tools:" ifeq "$(BUILD_PLATFORM)" "OS2" @for tool in $(PRELOADED_TOOLS); do \ echo -n " $$tool"; \ emxload -e $(UNIXROOT)/$$tool; \ done emxload -e gcc.exe g++.exe ld.exe cc1.exe as.exe cc1plus.exe ar.exe cpp0.exe ld.exe endif @echo "" all-preload-unload-obj: ifeq "$(BUILD_PLATFORM)" "OS2" -for prog in `emxload -l | sed -e 's|\\\|\/|g' -e 's@.*³[[:blank:]]*@@' | grep '$(PATH_OBJD)'`; \ do \ emxload -u $$prog; \ done endif # # Version stamping/branding. # Update various version strings which are printed from the tools to tell # the build date and that's our built. This helps us tell releases apart. # # IMPORTANT! Take care not to commit the changed files # (TODO! Try make these changes to non-cvs backed files. (long-term-goal)) .PHONY: all-versionstamps all-versionstamps: $(PATH_OBJ)/.ts.versionstamped $(PATH_OBJ)/.ts.versionstamped: echo '#define INNOTEK_VERSION "$(INNOTEK_VERSION)"' > include/innotekversion.h $(MAKE) -f $(MAKEFILE) "INNOTEK_VERSION=$(INNOTEK_VERSION)" gcc-versionstamps binutils-versionstamps emx-versionstamps mkdir -p $(@D) touch $@ # # Stages # A rebuild with the new toolsuite is usually required when there is ABI # changes and other vital changes done to the tools. # all-stage1: $(PATH_OBJ)/.all-stage1 $(PATH_OBJ)/.all-stage1: $(MAKE) -f $(MAKEFILE) all-stage1-it echo "$(@F)" > $(PATH_OBJ)/.last-stage touch $@ @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Stage 1 - done: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-stage1-it: \ all-banner-stage1 \ all-builttools-initial \ all-emx \ all-binutils \ all-gcc all-stage2: $(PATH_OBJ)/.all-stage2 $(PATH_OBJ)/.all-stage2: \ $(PATH_OBJ)/.all-stage2.save-stage1 $(MAKE) -f $(MAKEFILE) all-stage2-it echo "$(@F)" > $(PATH_OBJ)/.last-stage touch $@ @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Stage 2 - done: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" $(PATH_OBJ)/.all-stage2.save-stage1: @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Saving Stage 1 - Starting: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" $(MAKE) -f $(MAKEFILE) all-preload-unload-obj $(MAKE) -f $(MAKEFILE) all-builttools-stage2 rm -Rf $(PATH_OBJ)/stage1 mkdir -p $(PATH_OBJ)/stage1 if [ -d $(PATH_OBJ)/gcc ] ; then mv $(PATH_OBJ)/gcc $(PATH_OBJ)/stage1/gcc; fi if [ -d $(PATH_OBJ)/emx ] ; then mv $(PATH_OBJ)/emx $(PATH_OBJ)/stage1/emx; fi $(MAKE) -f $(MAKEFILE) all-preload touch $@ @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" @echo "+ Saving Stage 1 - done: $(shell date)" @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++" all-stage2-it: \ all-banner-stage2 \ all-emx \ all-binutils \ all-gcc # # Install to bin tree makeing it ready for packing. # all-install: \ all-banner-install \ gcc-install \ emx-install \ all-banner-install-done \ # # Generate all the diffs we have to supply. # all-diff: \ gcc-diff \ binutils-diff \ emx-diff \ ############################################################################### ############################################################################### ############################################################################### # # B u i l t T o o l s # ############################################################################### ############################################################################### ############################################################################### .PHONY: all-builttools-initial all-builttools-dirs all-builttools-clean all-builttools-stage2 all-builttools-initial: \ all-banner-builttools-initial \ all-builttools-clean \ all-builttools-dirs \ $(PATH_BUILTTOOLS)/bin/dllar.cmd \ all-builttools-clean: \ all-preload-unload-obj rm -Rf $(PATH_BUILTTOOLS) all-builttools-dirs: mkdir -p $(PATH_BUILTTOOLS)/bin $(PATH_BUILTTOOLS)/lib $(PATH_BUILTTOOLS)/include $(PATH_BUILTTOOLS)/bin/dllar.cmd: $(PATH_TOP)/src/misc/dllar.cmd cp $< $@ all-builttools-stage2: \ all-banner-builttools-stage2 \ $(PATH_BUILTTOOLS)/bin/dllar.cmd \ gcc-builttools-stage2 \ emx-builttools-stage2 \ all-builttools-stage2-libs all-builttools-stage2-libs: -for aoutlib in `find $(PATH_BUILTTOOLS) -name "*.a" | sed -e 's/\.a$$//' `; \ do \ if [ ! -f $(aoutlib).lib ]; then \ echo " $${aoutlib}"; \ $(PATH_BUILTTOOLS)/bin/emxomf.exe $${aoutlib}.a; \ fi;\ done ############################################################################### ############################################################################### ############################################################################### # # S y m l i n k s # # # We use symlinking of binutils stuff into the gcc tree so we can # build everything in one go and take advantage of the gcc # makesystem which will use the binutils we built when doing the # gcc libraries and such. # # On OS/2 symlinks doesn't exist so, we'll copy the source trees. # Copy because this will for directories work ok with cvs, moving # directories would cause 'cvs update -d' to refetch stuff. # # IMPORTANT! Take care, the 'symlined' stuff will be removed at the # end of the build. Remeber to do all-symlinks-unlink before a fresh # build is started as the duplicated binutils things doesn't get # updated by cvs. # # #w############################################################################## ############################################################################### ############################################################################### all-symlinks: \ all-symlinks-binutils all-symlinks-unlink: \ all-symlinks-unlink-binutils ifeq "$(BUILD_PLATFORM)" "OS2" TOOL_SYMLINK_FILE = cp -p TOOL_SYMLINK_DIR = cp -pRf TOOL_SYMLINK_MKDIR = mkdir TOOL_UNSYMLINK_DIR = rm -Rf else TOOL_SYMLINK_FILE = ln -s TOOL_SYMLINK_DIR = ln -s TOOL_SYMLINK_MKDIR = true TOOL_UNSYMLINK_DIR = rm endif # ld is broken, so don't use it! # ld \ SYMLINKS_BINUTILS_TO_GCC_DIRS = \ bfd \ binutils \ etc \ gas \ gprof \ intl \ opcodes \ texinfo \ include/aout \ include/coff \ include/elf \ include/nlm \ include/opcode \ include/regs \ SYMLINKS_BINUTILS_TO_GCC_FILES = \ include/alloca-conf.h \ include/ansidecl.h \ include/bfdlink.h \ include/bin-bugs.h \ include/bout.h \ include/callback.h \ include/ChangeLog \ include/COPYING \ include/demangle.h \ include/dis-asm.h \ include/dyn-string.h \ include/filenames.h \ include/floatformat.h \ include/fnmatch.h \ include/fopen-bin.h \ include/fopen-same.h \ include/fopen-vms.h \ include/gdbm.h \ include/getopt.h \ include/hashtab.h \ include/hp-symtab.h \ include/ieee.h \ include/libiberty.h \ include/MAINTAINERS \ include/md5.h \ include/oasys.h \ include/objalloc.h \ include/obstack.h \ include/os9k.h \ include/partition.h \ include/progress.h \ include/remote-sim.h \ include/safe-ctype.h \ include/sim-d10v.h \ include/sort.h \ include/splay-tree.h \ include/symcat.h \ # Symlink binutils stuff to gcc. # Note the test should've been "! -e", but that doesn' work in ash... :/ all-symlinks-binutils: for file in $(SYMLINKS_BINUTILS_TO_GCC_FILES); do \ if [ ! -f "$(PATH_TOP)/src/gcc/$$file" ]; then \ $(TOOL_SYMLINK_FILE) $(PATH_TOP)/src/binutils/$$file $(PATH_TOP)/src/gcc/$$file && \ touch $(PATH_TOP)/src/gcc/.symlinked.`echo $${file} | sed -e 's@/@_@g'`; \ fi ; \ done for dir in $(SYMLINKS_BINUTILS_TO_GCC_DIRS) ; do \ if [ ! -d "$(PATH_TOP)/src/gcc/$$dir" ] ; then \ $(TOOL_SYMLINK_MKDIR) $(PATH_TOP)/src/gcc/$$dir && \ touch $(PATH_TOP)/src/gcc/.symlinked.`echo $${dir} | sed -e 's@/@_@g'` && \ $(TOOL_SYMLINK_DIR) $(PATH_TOP)/src/binutils/$$dir $(PATH_TOP)/src/gcc/`echo $${dir}| sed -e '/\//!d' -e 's@\([a-zA-z0-9]*\)/.*@\1/@'` ; \ fi ; \ done -ls -a1 src/gcc/.sym* all-symlinks-unlink-binutils: for file in $(SYMLINKS_BINUTILS_TO_GCC_FILES); do \ if [ -f "$(PATH_TOP)/src/gcc/.symlinked.`echo $${file} | sed -e 's@/@_@g'`" ]; then \ rm $(PATH_TOP)/src/gcc/$${file} && \ rm $(PATH_TOP)/src/gcc/.symlinked.`echo $${file} | sed -e 's@/@_@g'` ; \ fi ; \ done for dir in $(SYMLINKS_BINUTILS_TO_GCC_DIRS) ; do \ if [ -f "$(PATH_TOP)/src/gcc/.symlinked.`echo $${dir} | sed -e 's@/@_@g'`" ] ; then \ $(TOOL_UNSYMLINK_DIR) $(PATH_TOP)/src/gcc/$${dir} && \ rm $(PATH_TOP)/src/gcc/.symlinked.`echo $${dir} | sed -e 's@/@_@g'`; \ fi ; \ done -ls -a1 src/gcc/.sym* ############################################################################### ############################################################################### ############################################################################### # # G C C # ############################################################################### ############################################################################### ############################################################################### all-gcc gcc: \ gcc-autoconf-refresh \ gcc-build echo "Successfully build GCC." GCC_DIRS = \ gcc/libiberty \ gcc/zlib \ gcc/gcc \ gcc/libstdc++-v3 \ gcc/boehm-gc \ gcc/fastjar \ gcc/libf2c \ gcc/libf2c/libF77 \ gcc/libf2c/libI77 \ gcc/libf2c/libU77 \ gcc/libffi \ gcc/libjava \ gcc/libjava/libltdl \ gcc/libobjc \ # Here is a problem, we can't regenerate binutils makefiles when symlinked into # gcc. At least not yet. The result is messed up severely. not_yet =\ gcc/bfd \ gcc/binutils \ gcc/gas \ gcc/gprof \ gcc/intl \ gcc/ld \ gcc/libiberty \ gcc/opcodes \ GCC_CONFIGURE_DIRS = $(GCC_DIRS) # configure.in/configure .PHONY: gcc-autoconf-refresh gcc-autoconf-rerun gcc-autoconf-clean gcc-autoconf-remove gcc-autoconf-refresh gcc-autoconf-rerun gcc-autoconf-clean gcc-autoconf-remove: ifeq "$(BUILD_PLATFORM)" "LINUX" -$(SH) $(PATH_TOP)/xfix.sh endif for dir in $(GCC_CONFIGURE_DIRS); do \ if $(MAKE) $(@:gcc-autoconf-%=%) -f $(PWD)/config.gmk -C src/$$dir ; then \ true; \ else \ exit 8; \ fi \ done # build the components. .PHONY: gcc-build gcc-install gcc-configure gcc-build gcc-install gcc-configure: mkdir -p $(PATH_OBJ)/gcc $(MAKE) -C $(PATH_OBJ)/gcc -f $(MAKEFILE) $@-it # When changed directory # We pass down BOOT_ flags for stage2+. # Because strip is broken on OS/2 we pass -s for release build and -g for # non release builds - This overrides some stuff in src/gcc/gcc/config/i386/t-emx! # For the 2nd stage we need a hack for using the right specs when linking... #SPEC_HACK = $(if $(wildchar $(PATH_OBJ)/.all-stage1),\ # -specs $(PATH_TOP)/src/emx/src/lib/libc.specs, \ # -specs $(PATH_TOP)/tools/x86.os2/gcc/staged/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/specs) SPECS_HACK = gcc-build-it: \ $(PATH_OBJ)/gcc/.ts.configured ifeq "$(BUILD_PLATFORM)" "OS2" unset GCCLOAD ; $(MAKE) -C $(PATH_OBJ)/gcc \ LIBGCC2_DEBUG_CFLAGS="$(BUILD_DEBUGINFO)" \ CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -O2" \ CXXFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -O2" \ BOOT_CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -O2 -mcpu=pentium -mpreferred-stack-boundary=2 -malign-strings=0 -falign-loops=2 -falign-jumps=2 -falign-functions=2" \ LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zexe -Zcrtdll" \ BOOT_LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zexe -Zcrtdll" \ bootstrap else $(MAKE) -C $(PATH_OBJ)/gcc bootstrap endif # configure it (invoked after directory change). # We set CC to help configure finding it. gcc-configure-it $(PATH_OBJ)/gcc/.ts.configured: $(PATH_TOP)/src/gcc/configure ifeq "$(BUILD_PLATFORM)" "OS2" $(ASH) -c " \ export CC=\"gcc.exe\" ; \ $< \ --enable-clh \ --enable-threads=os2 \ --enable-shared=libgcc,bfd,opcodes \ --enable-nls \ --without-included-gettext \ --with-local-prefix=$(subst \,/,$(PATH_EMXPGCC)) \ --prefix=$(ALL_PREFIX) \ --with-gnu-ld \ --with-gnu-as \ --disable-libgcj \ --enable-languages=c,c++ " else $(ASH) -c "$< \ --disable-clh \ --enable-shared=libgcc,bfd,opcodes \ --enable-nls \ --without-included-gettext \ --with-local-prefix=$(subst \,/,$(PATH_EMXPGCC)) \ --prefix=$(ALL_PREFIX) \ --with-gnu-ld \ --with-gnu-as \ --disable-libgcj \ --enable-languages=c,c++ " endif touch $(PATH_OBJ)/gcc/.ts.configured # TODO: Andy, on Linux --enable-clh result in linking errors. # Install the GCC build # Repeating the prefix doesn't hurt anybody. gcc-install-it: $(MAKE) prefix=$(ALL_PREFIX) install # easy, update src/gcc/gcc/version.c gcc-versionstamps: @echo "Version stamping gcc..." mv -f $(PATH_TOP)/src/gcc/gcc/version.c $(PATH_TOP)/src/gcc/gcc/version.tmp.c sed -e '/version_string/s/\([0-9]\.[0-9]*\.[0-9]*\).*/\1 $(INNOTEK_VERSION)";/' \ $(PATH_TOP)/src/gcc/gcc/version.tmp.c > $(PATH_TOP)/src/gcc/gcc/version.c rm -f $(PATH_TOP)/src/gcc/gcc/version.tmp.c # Install to builttools directory. ## WARNING! Another spec HACK! gcc-builttools-stage2: $(MAKE) -C $(PATH_OBJ)/gcc prefix=$(PATH_BUILTTOOLSD) install ## cp $(PATH_TOP)/src/emx/src/lib/libc.specs $(PATH_OBJ)/gcc/gcc/specs # Generate diffs for GCC (v3.2.2) - part of packing a release. .PHONY: gcc-diff $(ALL_PREFIX)/src/diffs/gcc-$(GCC_VERSION).diff gcc-diff: $(ALL_PREFIX)/src/diffs/gcc-$(GCC_VERSION).diff $(ALL_PREFIX)/src/diffs/gcc-$(GCC_VERSION).diff: mkdir -p $(@D) $(TOOL_CVS_DIFF_TREE) $(GCC_CVS_REL) src/gcc > $@ ############################################################################### ############################################################################### ############################################################################### # # B i n U t i l s # ############################################################################### ############################################################################### ############################################################################### BINUTILS_DIRS = \ binutils/bfd \ binutils/opcodes \ binutils/gas \ binutils/gprof \ binutils/binutils \ binutils/ld \ BINUTILS_NOT_DIRS =\ binutils/etc \ binutils/libiberty \ binutils/intl \ BINUTILS_CONFIGURE_DIRS = $(BINUTILS_DIRS) $(BINUTILS_NOT_DIRS) all-binutils binutils: echo "Binutils are build together with the other GNU Tools in GCC." echo "Separate building of binutils is not configured." # configure.in/configure .PHONY: binutils-autoconf-refresh binutils-autoconf-rerun binutils-autoconf-clean binutils-autoconf-remove binutils-autoconf-refresh binutils-autoconf-rerun binutils-autoconf-clean binutils-autoconf-remove: ifeq "$(BUILD_PLATFORM)" "LINUX" -$(SH) $(PATH_TOP)/xfix.sh endif for dir in $(BINUTILS_CONFIGURE_DIRS); do \ if $(MAKE) $(@:binutils-autoconf-%=%) -f $(PWD)/config.gmk -C src/$$dir ; then \ true; \ else \ exit 8; \ fi \ done # build the components. .PHONY: binutils-build binutils-install binutils-configure binutils-build binutils-install binutils-configure: mkdir -p $(PATH_OBJ)/binutils $(MAKE) -C $(PATH_OBJ)/binutils -f $(MAKEFILE) $@-it # When changed directory binutils-build-it: \ $(PATH_OBJ)/binutils/.ts.configured $(ASH) -c " unset GCCLOAD ; $(MAKE) -C $(PATH_OBJ)/binutils " # configure it (invoked after directory change). # We set CC to help configure finding it. # And we reconfigure libiberty to the gcc one. binutils-configure-it $(PATH_OBJ)/binutils/.ts.configured: $(PATH_TOP)/src/binutils/configure $(ASH) -c " \ export CC=\"gcc.exe\" ; \ $< \ --enable-shared \ --prefix=$(ALL_PREFIX) " $(ASH) -c "cd libiberty && \ $(PATH_TOP)/src/gcc/libiberty/configure \ --prefix=$(ALL_PREFIX) " touch $(PATH_OBJ)/binutils/.ts.configured # Install the Binutils build # Repeating the prefix doesn't hurt anybody. binutils-install-it: $(MAKE) prefix=$(ALL_PREFIX) install # Not so easy, need to patch a few files. binutils-versionstamps: @echo "Version stamping binutils..." cp -f $(PATH_TOP)/src/binutils/binutils/version.c $(PATH_TOP)/src/binutils/binutils/version.tmp.c sed -e '/printf.*program_version/s/%s %s.*\\n/%s %s $(INNOTEK_VERSION)\\n/' \ $(PATH_TOP)/src/binutils/binutils/version.tmp.c > $(PATH_TOP)/src/binutils/binutils/version.c rm -f $(PATH_TOP)/src/binutils/binutils/version.tmp.c if [ -f $(PATH_TOP)/src/gcc/binutils/version.c ]; then \ cp -f $(PATH_TOP)/src/gcc/binutils/version.c $(PATH_TOP)/src/gcc/binutils/version.tmp.c && \ sed -e '/printf.*program_version/s/%s %s.*\\n/%s %s $(INNOTEK_VERSION)\\n/' \ $(PATH_TOP)/src/gcc/binutils/version.tmp.c > $(PATH_TOP)/src/gcc/binutils/version.c && \ rm -f $(PATH_TOP)/src/gcc/binutils/version.tmp.c ; \ fi @echo "Version stamping gas..." cp -f $(PATH_TOP)/src/binutils/gas/as.c $(PATH_TOP)/src/binutils/gas/as.tmp.c sed -e '/printf.*GNU.*assembler/s/%s.*\\n/%s $(INNOTEK_VERSION)\\n/' \ -e '/fprintf.*GNU.*assembler.*version.*BFD.*/s/using BFD version %s.*/using BFD version %s $(INNOTEK_VERSION)"),/ ' \ $(PATH_TOP)/src/binutils/gas/as.tmp.c > $(PATH_TOP)/src/binutils/gas/as.c rm -f $(PATH_TOP)/src/binutils/gas/as.tmp.c if [ -f $(PATH_TOP)/src/gcc/gas/as.c ]; then \ cp -f $(PATH_TOP)/src/gcc/gas/as.c $(PATH_TOP)/src/gcc/gas/as.tmp.c && \ sed -e '/printf.*GNU.*assembler/s/%s.*\\n/%s $(INNOTEK_VERSION)\\n/' \ -e '/fprintf.*GNU.*assembler.*version.*BFD.*/s/using BFD version %s.*/using BFD version %s $(INNOTEK_VERSION)"),/ ' \ $(PATH_TOP)/src/gcc/gas/as.tmp.c > $(PATH_TOP)/src/gcc/gas/as.c && \ rm -f $(PATH_TOP)/src/gcc/gas/as.tmp.c ; \ fi @echo "Version stamping ld..." cp -f $(PATH_TOP)/src/binutils/ld/ldver.c $(PATH_TOP)/src/binutils/ld/ldver.tmp.c sed -e '/fprintf.*GNU.*ld.*version/s/(with BFD %s).*/(with BFD %s) $(INNOTEK_VERSION)\\n"),/' \ $(PATH_TOP)/src/binutils/ld/ldver.tmp.c > $(PATH_TOP)/src/binutils/ld/ldver.c rm -f $(PATH_TOP)/src/binutils/ld/ldver.tmp.c if [ -f $(PATH_TOP)/src/gcc/ld/ldver.c ]; then \ cp -f $(PATH_TOP)/src/gcc/ld/ldver.c $(PATH_TOP)/src/gcc/ld/ldver.tmp.c && \ sed -e '/fprintf.*GNU.*ld.*version/s/(with BFD %s).*/(with BFD %s) $(INNOTEK_VERSION)\\n"),/' \ $(PATH_TOP)/src/gcc/ld/ldver.tmp.c > $(PATH_TOP)/src/gcc/ld/ldver.c && \ rm -f $(PATH_TOP)/src/gcc/ld/ldver.tmp.c ; \ fi # Generate diffs for Binutils (part of packing). .PHONY: binutils-diff $(ALL_PREFIX)/src/diffs/binutils-$(BINUTILS_VERSION).diff binutils-diff: $(ALL_PREFIX)/src/diffs/binutils-$(BINUTILS_VERSION).diff $(ALL_PREFIX)/src/diffs/binutils-$(BINUTILS_VERSION).diff: mkdir -p $(@D) $(TOOL_CVS_DIFF_TREE) $(BINUTILS_CVS_REL) src/binutils > $@ ############################################################################### ############################################################################### ############################################################################### # # E M X # ############################################################################### ############################################################################### ############################################################################### all-emx emx: \ emx-build @echo "Successfully build EMX." # Some helpers. # TODO: Change OUT and INS to the right ones. Currently not possible as # doing such breaks the rules generating. EMX_MODE = dbg ifeq "$(BUILD_MODE)" "RELEASE" EMX_MODE = opt endif EMX_OUT = out/ EMX_INS = out/install/ EMX_RULES= $(PATH_TOP)/src/emx/$(EMX_OUT)$(EMX_MODE)/genrules.smak #EMX_OUT = $(PATH_OBJ)/emx/ #EMX_INS = $(ALL_PREFIX)/ #EMX_RULES= $(EMX_OUT)$(EMX_MODE)/genrules.smak EMX_MASM = $(PATH_TOP)/tools/x86.os2/masm/v6.0/binp/ml.exe EMX_DEFINES = OUT=$(EMX_OUT) INS=$(EMX_INS) MODE=$(EMX_MODE) "ASM=$(EMX_MASM) -c" # build the components. (directory changer rules) .PHONY: emx-build emx-install emx-configure emx-build emx-install emx-configure: mkdir -p $(PATH_OBJ)/emx $(MAKE) -C $(PATH_TOP)/src/emx -f $(MAKEFILE) $@-it # This is the configure equivalent. emx-configure-it: $(EMX_RULES) $(EMX_RULES): rm -f $(EMX_RULES) $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) $(EMX_RULES) # make handle issue here. Make portions at the time. emx-build-it: $(EMX_RULES) $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) tools $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) os2 libsocket libdl $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) libs $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) all emx-install-it: $(EMX_RULES) $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) INS=$(ALL_PREFIX)/ install # easy, update same stuff in a bunch of files. # actually, nothing any long as the global innotekversion.h takes care of it # together with proper dependencies. EMX_FILE_VER = \ emxbind/emxbind.h emxcat/emxcat.c emxdoc/emxdoc.c emxexp/emxexp.c emximp/emximp.c \ emxload/emxload.c emxomf/emxaout.c emxomf/emxomf.c emxomf/emxomfar.c emxomf/emxomfld.c \ emxomf/listomf.c emxstack/emxstack.c emxtsf/emxtsf.c os2/version.h emx-versionstamps: @echo "Version stamping EMX..." # Install the compiled emx stuff to builttools. ##emx-builttools-stage2: emx-builttools-stage2-specs emx-builttools-stage2: $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) INS=$(PATH_BUILTTOOLS)/ install ## bird: for now we will just replace the specs with the constantly updated libc specs. emx-builttools-stage2-specs: ## -mv -f $(PATH_BUILTTOOLS)/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/specs \ ## $(PATH_BUILTTOOLS)/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/emxspecs ## cp $(PATH_TOP)/src/emx/src/lib/libc.specs \ ## $(PATH_BUILTTOOLS)/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/specs # Generate diffs for Binutils (part of packing). .PHONY: binutils-diff $(ALL_PREFIX)/src/diffs/emx-$(EMX_VERSION).diff emx-diff: $(ALL_PREFIX)/src/diffs/emx-$(EMX_VERSION).diff $(ALL_PREFIX)/src/diffs/emx-$(EMX_VERSION).diff: mkdir -p $(@D) $(TOOL_CVS_DIFF_TREE) $(EMX_CVS_REL) src/emx > $@ ############################################################################### ############################################################################### ############################################################################### # # M I S C # ############################################################################### ############################################################################### ############################################################################### dejagnu: # nothing to make at the moment, it's just a all install stuff it seems. requires_autoconf_2_52_DEJAGNU_CONFIGURE_DIRS = \ src/misc/dejagnu \ src/misc/dejagnu/contrib/bluegnu2.0.3 \ src/misc/dejagnu/contrib/bluegnu2.0.3/doc \ src/misc/dejagnu/contrib/bluegnu2.0.3/example \ src/misc/dejagnu/contrib/bluegnu2.0.3/example/calc \ src/misc/dejagnu/contrib/bluegnu2.0.3/testsuite \ src/misc/dejagnu/example/calc \ src/misc/dejagnu/example/hello .PHONY: dejagnu-autoconf-refresh dejagnu-autoconf-rerun dejagnu-autoconf-clean dejagnu-autoconf-remove dejagnu-autoconf-refresh dejagnu-autoconf-rerun dejagnu-autoconf-clean dejagnu-autoconf-remove: ifeq "$(BUILD_PLATFORM)" "LINUX" -$(SH) $(PATH_TOP)/xfix.sh endif for dir in $(DEJAGNU_CONFIGURE_DIRS); do \ if $(MAKE) $(@:dejagnu-autoconf-%=%) -f $(PWD)/config.gmk -C $$dir ; then \ true; \ else \ exit 8; \ fi \ done # # Expect # expect: # build the components. .PHONY: expect-build expect-install expect-configure expect-build expect-install expect-configure: mkdir -p $(PATH_OBJ)/misc/expect $(MAKE) -C $(PATH_OBJ)/misc/expect -f $(MAKEFILE) $@-it # When changed directory expect-build-it: \ $(PATH_OBJ)/misc/expect/.ts.configured $(MAKE) -C $(PATH_OBJ)/misc/expect # configure it (invoked after directory change). # We set CC to help configure finding it. # And we reconfigure libiberty to the gcc one. expect-configure-it $(PATH_OBJ)/misc/expect/.ts.configured: $(PATH_TOP)/src/misc/expect/configure ifeq "$(BUILD_PLATFORM)" "OS2" $(ASH) -c " \ export CC=\"gcc.exe\" ; \ $< \ --disable-shared \ --host=i386-pc-os2-emx \ --with-tclconfig=$(UNIXROOT)/usr/lib \ --with-tclinclude=$(UNIXROOT)/usr/lib/tcl8.0/include \ --enable-gcc \ $(BUILD_ENABLE_SYMBOLS) \ --prefix=$(PATH_BUILTTOOLSD) " else $(ASH) -c " \ $< \ --enable-gcc \ $(BUILD_ENABLE_SYMBOLS) \ --prefix=$(PATH_BUILTTOOLSD) " endif touch $(PATH_OBJ)/misc/expect/.ts.configured # install to builttools (if anywhere!) expect-install-it: $(MAKE) prefix=$(PATH_BUILTTOOLSD) install EXPECT_CONFIGURE_DIRS = \ src/misc/expect # skipping testsuite for now as it requires some .m4 files we don't have. #src/misc/expect/testsuite .PHONY: expect-autoconf-refresh expect-autoconf-rerun expect-autoconf-clean expect-autoconf-remove expect-autoconf-refresh expect-autoconf-rerun expect-autoconf-clean expect-autoconf-remove: ifeq "$(BUILD_PLATFORM)" "LINUX" -$(SH) $(PATH_TOP)/xfix.sh endif for dir in $(EXPECT_CONFIGURE_DIRS); do \ if $(MAKE) $(@:expect-autoconf-%=%) -f $(PWD)/config.gmk -C $$dir ; then \ true; \ else \ exit 8; \ fi \ done # DO NOT DELETE