####################################################################### # # Makefile to build a linux hosted PPC cross compiler for # PPC vxWorks 5.5.1 / Tornado 2.2.1 # # Note: # To build the toolchain on newer linux systems, # we need to temporary install 'sed' and 'bison' to be # compatible for gcc configure and make scripts. # ####################################################################### CWD = $(shell readlink -f .) ifeq ($(BUILD_NUMBER),) BUILD_NO=0 else BUILD_NO=$(BUILD_NUMBER) endif VERSION=0.4.1 SRCDIR=$(CWD)/SOURCES BUILDDIR=$(CWD)/build #WIND_BASE=$(HOME)/tornado/2.2.1 WIND_USR=$(WIND_BASE)/target HOST=i686-pc-linux-gnu GCC_TARGET=powerpc-wrs-vxworks55 MASCH=$(shell uname -m) INSTDIR=$(CWD)/inst/crossppc GCC_VERSION=2.95.3 GCC_TARGET_VERSION=2.95.4 LANGUAGES=c,c++ PACKAGE=$(CWD)/vxw55-crossppc-$(GCC_TARGET_VERSION)-$(BUILD_NO)-$(HOST).tar.gz ifeq ($(WIND_BASE),) $(error WIND_BASE not specified ) endif JOBS=-j4 all: prepare mktools binutils xgcc uninsttools pack clean prepare: mkdir -p $(BUILDDIR) mkdir -p $(INSTDIR) rm -Rf $(CWD)/unpacked mkdir -p $(CWD)/unpacked/sys-includes cp -Rvf $(WIND_BASE)/target/h/* $(CWD)/unpacked/sys-includes cd $(CWD)/unpacked/sys-includes/sys && \ patch -p0 < $(SRCDIR)/fdmatch.patch cd $(CWD)/unpacked && \ tar -zxf $(SRCDIR)/gcc-2.95.3.tar.gz cd $(CWD)/unpacked/gcc-$(GCC_VERSION) && \ patch -p1 < $(SRCDIR)/gcc2.95.3-2.95.4vxw55.patch cd $(CWD)/unpacked && \ tar -zxf $(SRCDIR)/sed-3.02.tar.gz cd $(CWD)/unpacked && \ tar -zxf $(SRCDIR)/bison-1.28.tar.gz cd $(CWD)/unpacked && \ tar -zxf $(SRCDIR)/binutils-2.10.1.tar.gz cd $(CWD)/unpacked/binutils-* && \ patch -p1 < $(SRCDIR)/vx-ppc-binutils-2.10.diff mktools: cd $(CWD)/unpacked/sed-* && \ CC="gcc -m32 -std=gnu89" \ CXX="g++ -m32" \ ./configure --prefix=$(INSTDIR) && \ make && make install cd $(CWD)/unpacked/bison-* && \ CC="gcc -m32 -std=gnu89" \ CXX="g++ -m32" \ ./configure --prefix=$(INSTDIR) && \ make && make install uninsttools: lll: cd $(CWD)/unpacked/sed-* && \ export PATH=$(PATH):/sbin && \ make uninstall cd $(CWD)/unpacked/bison-* && \ export PATH=$(PATH):/sbin && \ make uninstall binutils: rm -Rf $(BUILDDIR)/binutils mkdir -p $(BUILDDIR)/binutils cd $(BUILDDIR)/binutils && \ export PATH=$(INSTDIR)/bin:$(PATH) && \ CC="gcc -m32 -std=gnu89" \ CXX="g++ -m32" \ HOST_LD_FLAGS="-m32" \ $(CWD)/unpacked/binutils-2.10.1/configure \ --build=$(HOST) \ --host=$(HOST) \ --prefix=$(INSTDIR) \ --target=$(GCC_TARGET) \ --with-headers=$(CWD)/unpacked/sys-includes \ --with-libs=$(WIND_BASE)/target/lib cd $(BUILDDIR)/binutils && \ export PATH=$(INSTDIR)/bin:$(PATH) && \ make $(JOBS) && \ make install xgcc: rm -Rf $(BUILDDIR)/gcc mkdir -p $(BUILDDIR)/gcc cd $(BUILDDIR)/gcc && \ export WIND_BASE=$(WIND_BASE) && \ export WIND_USR=$(WIND_USR) && \ export PATH=$(INSTDIR)/bin:$(PATH) && \ export YACC="$(INSTDIR)/bin/bison -y" && \ bison --version && \ CC="gcc -m32 -std=gnu89" \ CXX="g++ -m32" \ HOST_LD_FLAGS="-m32" \ CFLAGS="-O2 -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" \ $(CWD)/unpacked/gcc-$(GCC_VERSION)/configure \ --build=$(HOST) \ --host=$(HOST) \ --prefix=$(INSTDIR) \ --target=$(GCC_TARGET) \ --with-headers=$(CWD)/unpacked/sys-includes \ --with-libs=$(WIND_BASE)/target/lib \ --enable-languages="$(LANGUAGES)" \ --disable-multilib \ --with-gnu-as --with-gnu-ld cd $(BUILDDIR)/gcc && \ export WIND_BASE=$(WIND_BASE) && \ export WIND_USR=$(WIND_USR) && \ export PATH=$(INSTDIR)/bin:$(PATH) && \ make $(JOBS) && \ make install rm -Rf $(INSTDIR)/$(GCC_TARGET)/sys-include rm -f $(INSTDIR)/bin/powerpc-wrs-vxworks55-gccbug strip $(INSTDIR)/bin/$(GCC_TARGET)-* pack: cd $(INSTDIR) && \ tar -zcf $(PACKAGE) . clean: rm -Rf $(BUILDDIR) rm -Rf $(CWD)/unpacked #rm -Rf $(CWD)/inst