############################################################################# # # The Ibex upstream code Makefile # # deal with Apple's brokenness setcc := $(shell test `uname` = Darwin && echo "CC=\"/usr/bin/gcc3 -no-cpp-precomp\"") # where to get stuff url_binutils-2.13.2.1 := ftp://ftp.gnu.org/gnu/binutils/binutils-2.13.2.1.tar.gz url_w32api-2.3 := http://unc.dl.sourceforge.net/sourceforge/mingw/w32api-2.3.tar.gz url_mingw-runtime-3.0 := http://unc.dl.sourceforge.net/sourceforge/mingw/mingw-runtime-3.0.tar.gz url_freetype-2.1.4 := http://unc.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.4.tar.gz url_gcc-3.3 := http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-3.3/gcc-3.3.tar.gz url_jpeg-6b := http://www.ijg.org/files/jpegsrc.v6b.tar.gz url_libmspack-20030726 := http://www.kyz.uklinux.net/downloads/libmspack-20030726.tar.gz url_vera-1.10 := http://fgo-temp.acc.umu.se/pub/GNOME/sources/ttf-bitstream-vera/1.10/ttf-bitstream-vera-1.10.tar.gz url_WindowMaker-0.80.2 := http://windowmaker.org/pub/source/release/WindowMaker-0.80.2.tar.gz url_bcel-5.1 := http://www.apache.org/dist/jakarta/bcel/binaries/bcel-5.1.tar.gz url_gnu.regexp-1.1.4 := http://21cma.bao.ac.cn/gentoo/distfiles/gnu.regexp-1.1.4.tar.gz .install_binutils-2.13.2.1_powerpc-apple-darwin: .vendor rm -rf upstream/darwin-linker/src cd upstream/darwin-linker; tar xvzf ../install/powerpc-apple-darwin/cctools-478.tgz ifneq ($(shell uname),Darwin) cd upstream/darwin-linker/src/cctools; for A in ../../patches/*.patch; do patch -p0 < $$A; done cp upstream/darwin-linker/src/cctools/ld/fake-mach.c upstream/darwin-linker/src/cctools/libstuff cd upstream/darwin-linker/src/; mkdir macosx-include; cd macosx-include; chmod +x ../../links.sh; ../../links.sh endif make -C upstream/darwin-linker/src/cctools/libstuff make -C upstream/darwin-linker/src/cctools/misc touch upstream/darwin-linker/src/cctools/misc/makeUser.c upstream/darwin-linker/src/cctools/misc/make.h make -C upstream/darwin-linker/src/cctools/misc libtool.NEW make -C upstream/darwin-linker/src/cctools/ld; true make -C upstream/darwin-linker/src/cctools/as make -C upstream/darwin-linker/src/cctools/ar mkdir -p upstream/install/powerpc-apple-darwin/bin cp upstream/darwin-linker/src/cctools/ld/ld_dir/ld.NEW upstream/install/powerpc-apple-darwin/bin/ld.NEW echo -e "#!/bin/sh\n"`pwd`"/upstream/install/powerpc-apple-darwin/bin/ld.NEW -dylib_file /usr/lib/system/libmathCommon.A.dylib:"`pwd`"/upstream/install/powerpc-apple-darwin/lib/libmathCommon.A.dylib -L"`pwd`"/upstream/install/powerpc-apple-darwin/lib \$$@\n" > upstream/install/powerpc-apple-darwin/bin/ld chmod +x upstream/install/powerpc-apple-darwin/bin/ld echo -e "#!/bin/sh\n"`pwd`"/upstream/install/powerpc-apple-darwin/bin/apple-libtool \$$1 -o \$$1\n" > upstream/install/powerpc-apple-darwin/bin/ranlib chmod +x upstream/install/powerpc-apple-darwin/bin/ranlib cp upstream/darwin-linker/src/cctools/misc/libtool.NEW upstream/install/powerpc-apple-darwin/bin/apple-libtool cp upstream/darwin-linker/src/cctools/misc/strip.NEW upstream/install/powerpc-apple-darwin/bin/strip cp upstream/darwin-linker/src/cctools/as/appc_dir/as upstream/install/powerpc-apple-darwin/bin/as cp upstream/darwin-linker/src/cctools/ar/ar.NEW upstream/install/powerpc-apple-darwin/bin/ar.NEW echo -e "#!/bin/sh\n"`pwd`"/upstream/install/powerpc-apple-darwin/bin/ar.NEW \$$@\n"`pwd`"/upstream/install/powerpc-apple-darwin/bin/ranlib \$$2\n" > upstream/install/powerpc-apple-darwin/bin/ar chmod +x upstream/install/powerpc-apple-darwin/bin/ar mkdir -p upstream/install/bin cd upstream/install/bin; ln -sf ../powerpc-apple-darwin/bin/ld powerpc-apple-darwin-ld cd upstream/install/bin; ln -sf ../powerpc-apple-darwin/bin/as powerpc-apple-darwin-as cd upstream/install/bin; ln -sf ../powerpc-apple-darwin/bin/ar powerpc-apple-darwin-ar cd upstream/install/bin; ln -sf ../powerpc-apple-darwin/bin/ranlib powerpc-apple-darwin-ranlib cd upstream/install/bin; ln -sf ../powerpc-apple-darwin/bin/strip powerpc-apple-darwin-strip echo -e "#!/bin/sh\nc++filt \$$@\n" > upstream/install/bin/c++filt3; chmod +x upstream/install/bin/c++filt3 cd upstream/install/powerpc-apple-darwin/bin; ln -sf ../../bin/c++filt3 touch $@ # how to configure it ifneq ($(shell uname),$(platform)) configure_gcc-3.3 += --with-headers=$(shell pwd)/upstream/install/$(target)/include endif configure_gcc-3.3 += --enable-languages=c,c++,java --enable-gc-type=boehm --disable-jvmpi --without-libffi configure_gcc-3.3 += --with-ld=$(shell pwd)/upstream/install/bin/$(target)-ld configure_gcc-3.3 += --with-as=$(shell pwd)/upstream/install/bin/$(target)-as ifneq ($(platform),Darwin) configure_gcc-3.3 += --with-gnu-ld --with-gnu-as endif configure_gcc-3.3 += --disable-java-awt --disable-interpreter --enable-libgcj configure_gcc-3.3 += --disable-shared --enable-static --disable-jni configure_binutils-2.13.2.1 += --disable-shared --enable-static configure_gcc-3.3_powerpc-apple-darwin += --enable-threads=posix --disable-hash-synchronization --disable-multilib configure_gcc-3.3_i686-pc-mingw32 += --enable-threads=win32 --enable-hash-synchronization configure_gcc-3.3_i686-pc-linux-gnu += --enable-threads=posix --enable-hash-synchronization configure_gcc-3.3_sparc-sun-solaris2.7 += --enable-threads=posix --disable-hash-synchronization --disable-multilib configure_WindowMaker-0.80.2_$(target) += --prefix=$(shell pwd)/upstream/install/$(target) configure_WindowMaker-0.80.2_$(target) += --host=i686-pc-linux-gnu --x-libraries=$(shell pwd)/upstream/install/$(target)/lib #environment_gcc-3.3_i686-pc-linux-gnu += CFLAGS="-Wl,-ldl" # libjpeg's configury doesn't obey --target environment_jpeg-6b_$(target) += PATH=$(shell pwd)/upstream/install/$(target)/bin:$$PATH environment_jpeg-6b_$(target) += CC=$(shell pwd)/upstream/install/bin/$(target)-gcc environment_jpeg-6b_$(target) += CFLAGS="-Os -ffunction-sections -fdata-sections -I ." environment_jpeg-6b_$(target) += AR="$(shell pwd)/upstream/install/$(target)/bin/ar rc" environment_jpeg-6b_$(target) += AR2=$(shell pwd)/upstream/install/$(target)/bin/ranlib # libmspack configury doesn't obey --target environment_libmspack-20030726_$(target) += PATH=$(shell pwd)/upstream/install/$(target)/bin:$$PATH environment_libmspack-20030726_$(target) += CC=$(shell pwd)/upstream/install/bin/$(target)-gcc environment_libmspack-20030726_$(target) += AR="$(shell pwd)/upstream/install/$(target)/bin/ar" environment_libmspack-20030726_$(target) += AR2=$(shell pwd)/upstream/install/$(target)/bin/ranlib environment_libmspack-20030726_$(target) += OPTIM="-ffunction-sections -fdata-sections -O3" # WindowMaker configury doesn't obey --target environment_WindowMaker-0.80.2_$(target) += PATH=$(shell pwd)/upstream/install/$(target)/bin:$$PATH environment_WindowMaker-0.80.2_$(target) += CC=$(shell pwd)/upstream/install/bin/$(target)-gcc environment_WindowMaker-0.80.2_$(target) += AR="$(shell pwd)/upstream/install/$(target)/bin/ar" environment_WindowMaker-0.80.2_$(target) += AR2=$(shell pwd)/upstream/install/$(target)/bin/ranlib environment_WindowMaker-0.80.2_$(target) += LDFLAGS="-lXext -ldl" make_install_WindowMaker-0.80.2_$(target) := -C WINGs install; make -C wrlib make_WindowMaker-0.80.2_$(target) := WINGs environment_gcc_3.3_$(target) += PATH=$(shell pwd)/upstream/install/bin:$$PATH .PRECIOUS: .vendor .download_% .configure_%_$(target) .install_%_$(target) .download_org.ibex.nestedvm: @mkdir -p upstream; cd upstream; rm -rf org.ibex.$*; rm -rf org.ibex.$*_* @cd upstream; git clone http://nestedvm.ibex.org/.git org.ibex.nestedvm @touch $@ .download_org.ibex.%: @echo -e "\033[1mfetching repository org.ibex.$*\033[0m" @mkdir -p upstream; cd upstream; rm -rf org.ibex.$*; rm -rf org.ibex.$*_* @cd upstream; darcs get --verbose --partial --repo-name=org.ibex.$* http://$*.ibex.org @rm -f src/org/ibex/$* @ln -s ../../../upstream/org.ibex.$*/src/org/ibex/$* src/org/ibex/$* @touch $@ .build_org.ibex.nestedvm: .vendor .download_org.ibex.nestedvm cd upstream/org.ibex.nestedvm; make usr=$(shell pwd)/upstream/install all env.sh touch $@ .install_org.ibex.nestedvm: .build_org.ibex.nestedvm touch $@ # vendor-supplied binaries and headers; this is stuff that comes with various OSes vendor: .vendor; @true .vendor: @echo -e "\n\033[1mdownloading vendor-supplied headers and libraries...\033[0m" mkdir -p upstream/install curl http://www.megacz.com/vendor.tgz | tar xzf - -C upstream/install mkdir -p upstream/install/i686-pc-mingw32 curl $(url_w32api-2.3) | tar xzf - -C upstream/install/i686-pc-mingw32 curl $(url_mingw-runtime-3.0) | tar xzf - -C upstream/install/i686-pc-mingw32 ifeq ($(shell uname),Linux) cd upstream/install/i686-pc-linux-gnu/include; rm -rf *; ln -sf /usr/include/* . endif touch .vendor .download_gcc-3.3_powerpc-apple-darwin: @echo -e "\n\033[1mdownloading $*...\033[0m" mkdir -p upstream/gcc-3.3 curl $(url_gcc-3.3) | tar xzf - -C upstream/gcc-3.3 mv upstream/gcc-3.3/gcc-3.3 upstream/gcc-3.3/src-darwin; true mv upstream/gcc-3.3/libmspack upstream/gcc-3.3/src-darwin; true (cd upstream/gcc-3.3/src-darwin && for A in ../patches/[a-y]*.patch; do patch -p0 -l < $$A; done); true (cd upstream/gcc-3.3/src-darwin && for A in ../patches-darwin/*.patch; do patch -p0 -l < $$A; done); true touch $@ .download_%: @echo -e "\n\033[1mdownloading $*...\033[0m" mkdir -p upstream/$* curl $(url_$*) | tar xzf - -C upstream/$* mv upstream/$*/$* upstream/$*/src; true mv upstream/$*/libmspack upstream/$*/src; true (test -e upstream/$*/patches && cd upstream/$*/src && for A in ../patches/*.patch; do patch -p0 -l < $$A; done); true touch $@ .configure_gcc-3.3_powerpc-apple-darwin: .download_gcc-3.3_powerpc-apple-darwin .install_binutils-2.13.2.1_powerpc-apple-darwin @echo -e "\n\033[1mconfiguring gcc...\033[0m" mkdir -p upstream/gcc-3.3/build-$(target) cd upstream/gcc-3.3/build-$(target); \ $(setcc) $(environment_gcc-3.3_$(target)) ../src-darwin/configure \ --target=$(target) \ --prefix=`cd ../..; pwd`/install \ $(configure_gcc-3.3) \ $(configure_gcc-3.3_$(target)) touch $@ .configure_gcc-3.3_$(target): .install_binutils-2.13.2.1_$(target) .configure_%_$(target): .vendor .download_% @echo -e "\n\033[1mconfiguring $*...\033[0m" mkdir -p upstream/$*/build-$(target) cd upstream/$*/build-$(target); \ $(setcc) $(environment_$*_$(target)) ../src/configure \ --target=$(target) \ --prefix=`cd ../..; pwd`/install \ $(configure_$*) \ $(configure_$*_$(target)) touch $@ .configure_libmspack-20030726_$(target): .download_libmspack-20030726 .install_gcc-3.3_$(target) mkdir -p upstream/libmspack-20030726/build-$(target) cd upstream/libmspack-20030726/build-$(target); ln -sf ../src/mspack/* . touch $@ .install_freetype-2.1.4_mips-unknown-elf: .install_org.ibex.nestedvm .download_freetype-2.1.4 cd upstream/freetype-2.1.4/src; \ make setup ansi; \ PATH=$$PATH:`pwd`/../../install/bin make \ CC=mips-unknown-elf-gcc \ AR=mips-unknown-elf-ar \ CFLAGS="-c -ffunction-sections -fdata-sections -O3" upstream/install/bin/mips-unknown-elf-ranlib upstream/freetype-2.1.4/src/objs/libfreetype.a touch $@ .build_%_$(target): .configure_%_$(target) @echo -e "\n\033[1mbuilding $*...\033[0m" cd upstream/$*/build-$(target); \ $(setcc) PATH=$$PATH:`pwd`/../../install/bin \ $(environment_$*_$(target)) \ make $(make_$*_$(target)) $(setcc) $(environment_$*_$(target)) touch $@ .install_libmspack-20030726_$(target): .build_libmspack-20030726_$(target); true .install_gcc-3.3_mips-unknown-elf: .install_org.ibex.nestedvm touch $@ .install_%_$(target): .build_%_$(target) @echo -e "\n\033[1minstalling $*...\033[0m" cd upstream/$*/build-$(target); \ $(setcc) PATH=$$PATH:`pwd`/../../install/bin \ $(environment_$*_$(target)) \ make $(make_install_$*_$(target)) install $(setcc) $(environment_$*_$(target)) touch $@