| 1 | OS = $(shell uname -s)
|
|---|
| 2 | NOW = $(shell date -u "+%F-%H-%M-%S")
|
|---|
| 3 |
|
|---|
| 4 | GCC_VERSION = 4.3.1
|
|---|
| 5 |
|
|---|
| 6 | PLATFORM = cocotron
|
|---|
| 7 | targetPlatform = Windows
|
|---|
| 8 | targetArchitecture = i386
|
|---|
| 9 | gccVersion = $(GCC_VERSION)
|
|---|
| 10 | installFolder = /Developer
|
|---|
| 11 | productName = Cocotron
|
|---|
| 12 | productVersion = 1.0
|
|---|
| 13 | compilerTarget = i386-mingw32msvc
|
|---|
| 14 | gmpVersion=4.2.3
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | productFolder=${installFolder}/$(productName)/$(productVersion)
|
|---|
| 19 |
|
|---|
| 20 | downloadFolder=$(productFolder)/Downloads
|
|---|
| 21 | sourceFolder=$(productFolder)/Source
|
|---|
| 22 | interfaceFolder=$(productFolder)/PlatformInterfaces/$(compilerTarget)
|
|---|
| 23 | buildFolder=$(productFolder)/build/$(targetPlatform)/$(targetArchitecture)
|
|---|
| 24 | resultFolder=$(productFolder)/$(targetPlatform)/$(targetArchitecture)/gcc-$(gccVersion)
|
|---|
| 25 | toolFolder=$(productFolder)/bin
|
|---|
| 26 |
|
|---|
| 27 | ARCHIVES = $(downloadFolder)/gcc-$(GCC_VERSION).tar.bz2
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | CONFIGARGS= -v --prefix="$(resultFolder)" --target=$(compilerTarget) \
|
|---|
| 31 | --with-gnu-as --with-gnu-ld --with-headers=$(resultFolder)/$(compilerTarget)/include \
|
|---|
| 32 | --without-newlib --disable-multilib --disable-libssp --disable-nls --enable-languages="c,objc" \
|
|---|
| 33 | --with-gmp=$(buildFolder)/gmp-$(gmpVersion) --enable-decimal-float --with-mpfr=$(resultFolder) --enable-checking=release \
|
|---|
| 34 | --enable-objc-gc --disable-bootstrap
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | all: package
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 | compile: patch
|
|---|
| 41 | mkdir build
|
|---|
| 42 | (cd build ; ../gcc-$(GCC_VERSION)/configure $(CONFIGARGS) )
|
|---|
| 43 | ifeq ($(MAKE_FUNKY_LINK),YES)
|
|---|
| 44 | ifeq ($(OS),Darwin)
|
|---|
| 45 | (cd build ; ln -s . build-`../gcc-$(GCC_VERSION)/config.guess`)
|
|---|
| 46 | endif
|
|---|
| 47 | ifeq ($(OS),Linux)
|
|---|
| 48 | (cd build ; ln -s . build-$(CONFIGTARGET))
|
|---|
| 49 | endif
|
|---|
| 50 | ifeq ($(OS),FreeBSD)
|
|---|
| 51 | (cd build ; ln -s . build-$(CONFIGTARGET))
|
|---|
| 52 | endif
|
|---|
| 53 |
|
|---|
| 54 | endif
|
|---|
| 55 | # (cd build ; $(MAKE) maybe-configure-libiberty maybe-configure-gcc maybe-configure-libcpp maybe-configure-libdecnumber)
|
|---|
| 56 | # (cd build/libiberty ; $(MAKE))
|
|---|
| 57 | # (cd build/intl ; $(MAKE))
|
|---|
| 58 | # (cd build/libcpp ; $(MAKE))
|
|---|
| 59 | # (cd build/libdecnumber ; $(MAKE))
|
|---|
| 60 | # (cd build/gcc ; $(MAKE))
|
|---|
| 61 | (cd build ; $(MAKE))
|
|---|
| 62 |
|
|---|
| 63 | patch: extract
|
|---|
| 64 | ln -sf `pwd`/source/ffi.c gcc-$(GCC_VERSION)/gcc
|
|---|
| 65 | printf "char *ffi_version = \42%s\42;\n" "$(NOW)" > gcc-$(GCC_VERSION)/gcc/ffi-version.h
|
|---|
| 66 | for f in source/gcc-$(GCC_VERSION)*.diff ; do \
|
|---|
| 67 | (cd gcc-$(GCC_VERSION)/gcc; patch -p0 <../../$$f); \
|
|---|
| 68 | done
|
|---|
| 69 |
|
|---|
| 70 | package: compile
|
|---|
| 71 | mkdir bin
|
|---|
| 72 | cp source/h-to-ffi.sh bin/
|
|---|
| 73 | chmod +x bin/h-to-ffi.sh
|
|---|
| 74 | mkdir ffigen
|
|---|
| 75 | cp -r -p gcc-$(GCC_VERSION)/gcc/ginclude ffigen
|
|---|
| 76 | mv ffigen/ginclude ffigen/include
|
|---|
| 77 | cp -p gcc-$(GCC_VERSION)/gcc/gsyslimits.h ffigen/include/syslimits.h
|
|---|
| 78 | mkdir ffigen/bin
|
|---|
| 79 | cp -p build/gcc/cc1obj ffigen/bin/ffigen
|
|---|
| 80 | strip ffigen/bin/ffigen
|
|---|
| 81 | tar cfz ffigen-bin-$(PLATFORM)-gcc-$(GCC_VERSION)-$(NOW).tar.gz bin ffigen
|
|---|
| 82 |
|
|---|
| 83 | clean:
|
|---|
| 84 | rm -rf gcc-$(GCC_VERSION) ffigen build bin ffigen*tar.gz INSTALL-FFIGEN-$(PLATFORM)-gcc-$(GCC_VERSION)*.txt
|
|---|
| 85 |
|
|---|
| 86 | %.bz2:
|
|---|
| 87 | @echo
|
|---|
| 88 | @echo Obtain the file $@ from a GNU repository \(or gcc.gnu.org mirror\) and copy it to this directory.
|
|---|
| 89 | @echo
|
|---|
| 90 | @exit 2
|
|---|
| 91 |
|
|---|
| 92 | extract: $(ARCHIVES) clean
|
|---|
| 93 | tar fxj $(ARCHIVES)
|
|---|