2004/01/17 23:07:20
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:44:47 +0000 (07:44 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:44:47 +0000 (07:44 +0000)
darcs-hash:20040130074447-2ba56-e71d0ff62b472a554cb039cd9ce646946349b592.gz

Makefile
Makefile.upstream

index 075a471..e413644 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,10 +14,10 @@ dist-clean:
        find upstream -name config.cache -exec rm {} \;
 
 JVM:        build/JVM/xwt.jar
-Linux:    ; make gcj platform=Linux   target=i686-pc-linux-gnu    link_flags="-lX11 -lXext"
-Solaris:  ; make gcj platform=Solaris target=sparc-sun-solaris2.7 link_flags="-lX11 -lXext -static-libgcc -lpthread"
-Win32:    ; make gcj platform=Win32   target=i686-pc-mingw32      link_flags="-Wl,--subsystem,console -lcomdlg32" target_bin=xwt.exe
-Darwin:   ; make gcj platform=Darwin target=powerpc-apple-darwin link_flags="$(darwin_linker_flags)"
+Linux:    ; make gcj platform=Linux   link_flags="-lX11 -lXext"
+Solaris:  ; make gcj platform=Solaris link_flags="-lX11 -lXext -lpthread"
+Win32:    ; make gcj platform=Win32   link_flags="-Wl,--subsystem,windows -lcomdlg32"
+Darwin:   ; make gcj platform=Darwin  link_flags="$(darwin_linker_flags)"
 
 # default
 platform            := JVM
@@ -29,11 +29,22 @@ darwin_linker_flags += -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framewo
 darwin_linker_flags += -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib:$(darwin_libdir)/libGLU.dylib
 darwin_linker_flags += -lSystem.B -lmathCommon.A -lGL -lGLU
 
+target_Darwin := powerpc-apple-darwin
+target_Win32  := i686-pc-mingw32
+target_Solaris := sparc-sun-solaris2.7
+target_Linux := i686-pc-linux-gnu
+target := $(target_$(platform))
+
+gcj: .install_gcc-3.3_$(target); make $(target_bin) link_flags="$(link_flags)" platform=$(platform)
 
 #############################################################################
 # Configurables:
 #
-target_bin             := xwt.$(shell echo $(platform) | tr A-Z a-z)
+ifeq ($(platform),Win32)
+target_bin             := build/$(platform)/xwt.exe
+else
+target_bin             := build/$(platform)/xwt.$(shell echo $(platform) | tr A-Z a-z)
+endif
 jikes_flags            := -nowarn -sourcepath src/
 gcc_optimizations      := -O2
 #gcc_optimizations      := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls
@@ -104,7 +115,7 @@ compile: .compile
 # PHASE 4: gcj-generated headers
 java_headers          := $(all_java_sources:build/java/%.java=build/h/%.h) 
 build/h/edu/stanford/ejalbert/BrowserLauncher.h:; mkdir -p $(@D); touch $@
-build/h/%.h: build/class/%.class
+build/h/%.h: build/class/%.class .compile
        @echo -e "\n\033[1mextracting        .class -> .h:     $<\033[0m"
        mkdir -p `dirname $@`
        ls `echo $< | sed s/.class\$$//`*.class |\
@@ -113,13 +124,13 @@ build/h/%.h: build/class/%.class
 # a hack since we've disabled gcj's awt implementation
 build/$(platform)/org/xwt/plat/Java2.java.o:
        touch .empty.c; mkdir -p $(@D); $(gcc) -c .empty.c -o $@;
-build/$(platform)/org/xwt/translators/MIPSApps.java.o: build/class/org/xwt/translators/MIPSApps.class
+build/$(platform)/org/xwt/translators/MIPSApps.java.o: build/class/org/xwt/translators/MIPSApps.class .install_gcc-3.3_$(target)
        @echo -e "\n\033[1mcompiling         .class -> .o:     $<\033[0m"
        mkdir -p `dirname $@`
        $(gcj) -Os -c $< -o $@
 build/$(platform)/org/xwt/plat/AWT.java.o:
        touch .empty.c; mkdir -p $(@D); $(gcc) -c .empty.c -o $@;
-build/$(platform)/%.java.o: build/java/%.java
+build/$(platform)/%.java.o: build/java/%.java .install_gcc-3.3_$(target)
        @echo -e "\n\033[1mcompiling          .java -> .o:     $<\033[0m"
        mkdir -p `dirname $@`
        $(gcj) -c $< -o $@
@@ -156,7 +167,7 @@ build/$(platform)/$(platform).ar: $(java_objects) $(plat_java_sources:build/java
 $(target_bin): build/$(platform)/org/xwt/plat/$(platform).cc.o upstream/jpeg-6b/build-$(target)/libjpeg.a build/$(platform)/builtin.o build/$(platform)/$(platform).ar 
        @echo -e "\n\033[1mlinking               .o -> $(target_bin)\033[0m"
        mkdir -p build/$(platform)
-       PATH=upstream/install/bin:$$PATH $(gcj) -v --main=org.xwt.Main -o build/$(platform)/$(target_bin) -Lupstream/install/$(target)/lib build/$(platform)/org/xwt/plat/$(platform).java.o $^ $(link_flags)
+       PATH=upstream/install/bin:$$PATH $(gcj) -v --main=org.xwt.Main -o $@ -Lupstream/install/$(target)/lib build/$(platform)/org/xwt/plat/$(platform).java.o $^ $(link_flags)
 
 
 ##############################################################################
@@ -183,10 +194,6 @@ build/$(platform)/builtin.o: build/res/builtin.jar
                echo "};") > .builtin.c
        $(gcc) -c .builtin.c -o build/$(platform)/builtin.o
 
-# compile is here to force compilation of the .class files (they get used via -Ibuild) without
-# having the individual .o's depend on the .java's (otherwise every .o gets recompiled when one .java changes)
-gcj: .vendor .compile .install_gcc-3.3_$(target) $(target_bin)
-
 build/JVM/xwt.jar: .compile build/res/builtin.jar
        @echo -e "\n\033[1marchiving         .class -> .jar:   build/JVM/xwt.jar\033[0m"
        mkdir -p build/JVM
index 3425855..841493f 100644 (file)
@@ -54,16 +54,17 @@ endif
        cd upstream/install/powerpc-apple-darwin/bin; ln -sf ../../bin/c++filt3
        touch $@
 
-# building gcc requires binutils
-.configure_gcc-3.3_$(target): .install_binutils-2.13.2.1_$(target)      
 
 # 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
-configure_gcc-3.3                       += --with-ld=$(shell pwd)/upstream/install/bin/$(target)-ld --with-gnu-ld
-configure_gcc-3.3                       += --with-as=$(shell pwd)/upstream/install/bin/$(target)-as --with-gnu-as
+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-static --enable-libgcj
 configure_gcc-3.3                       += --disable-shared --enable-static
 configure_gcc-3.3_powerpc-apple-darwin  += --enable-threads=posix --disable-hash-synchronization --disable-multilib
@@ -103,24 +104,39 @@ ifeq ($(shell uname),Linux)
 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
+       (test -e upstream/gcc-3.3/patches && cd upstream/gcc-3.3/src-darwin && for A in ../patches/*.patch; do patch -p0 -l < $$A; done); true
+       (test -e upstream/gcc-3.3/patches-darwin && 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/$*
-ifeq ($(target),powerpc-apple-darwin)
-       mv upstream/$*/$* upstream/$*/src-darwin; true
-       mv upstream/$*/libmspack upstream/$*/src-darwin; true
-       (test -e upstream/$*/patches && cd upstream/$*/src-darwin && for A in ../patches/*.patch; do patch -p0 -l < $$A; done); true
-       (test -e upstream/$*/patches-darwin && cd upstream/$*/src-darwin && for A in ../patches/*.patch; do patch -p0 -l < $$A; done); true
-endif
-ifneq ($(target),powerpc-apple-darwin)
        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
-endif
        touch $@
 
-.configure_%_$(target): .download_% 
+.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); \