jat@google.com | 64a55cb | 2009-10-16 14:16:57 +0000 | [diff] [blame] | 1 | # Copyright 2008 Google Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
| 15 | CC = g++ |
| 16 | JAVAH = javah |
| 17 | |
| 18 | ## |
| 19 | # Try a GWT_TOOLS default if it isn't set |
| 20 | ## |
| 21 | GWT_TOOLS ?= ../../../tools |
| 22 | GWT_ROOT ?= ../.. |
| 23 | |
| 24 | ## |
| 25 | # The location to get .class files for javah |
| 26 | ## |
| 27 | CLASSDIR := $(GWT_ROOT)/build/out/dev/mac/bin |
| 28 | |
| 29 | ## |
| 30 | # External SWT products. |
| 31 | ## |
| 32 | SWT_ORIGINAL_SRC = $(GWT_TOOLS)/lib/eclipse/org.eclipse.swt.carbon-macosx-3.2.1.src.zip |
| 33 | SWT_PATCH_DIR = ./swt-build |
| 34 | SWT_LIBS=$(SWT_PATCH_DIR)/libswt-webkit-carbon-3235.jnilib \ |
| 35 | $(SWT_PATCH_DIR)/libswt-agl-carbon-3235.jnilib \ |
| 36 | $(SWT_PATCH_DIR)/libswt-carbon-3235.jnilib \ |
| 37 | $(SWT_PATCH_DIR)/libswt-pi-carbon-3235.jnilib |
| 38 | |
| 39 | GWT_LL_LIB = libgwt-ll.jnilib |
| 40 | GWT_LL_OBJS = gwt-ll.o java-dispatch.o gwt-webkit.o trace.o |
| 41 | GWT_LL_JNI = gwt-webkit.h |
| 42 | |
| 43 | TARGETS = $(GWT_LL_LIB) $(SWT_LIBS) |
| 44 | ARCHS = -arch i386 -arch ppc |
| 45 | CFLAGS = -I/System/Library/Frameworks/JavaScriptCore.framework/Headers -I/System/Library/Frameworks/JavaVM.framework/Headers |
| 46 | LFLAGS = -bundle -framework JavaScriptCore |
| 47 | |
| 48 | ALL : $(TARGETS) |
| 49 | |
| 50 | ## |
| 51 | # Unpack and patch SWT source. |
| 52 | ## |
| 53 | $(SWT_PATCH_DIR): $(SWT_ORIGINAL_SRC) ./org.eclipse.swt/webkit.c |
| 54 | unzip $(SWT_ORIGINAL_SRC) -d $(SWT_PATCH_DIR) |
| 55 | cp ./org.eclipse.swt/webkit.c $(SWT_PATCH_DIR) |
| 56 | |
| 57 | ## |
| 58 | # Build SWT. |
| 59 | ## |
| 60 | $(SWT_LIBS):$(SWT_PATCH_DIR) |
| 61 | make -C $(SWT_PATCH_DIR) -f make_macosx.mak |
| 62 | |
| 63 | ## |
| 64 | # Build core gwt-ll object. |
| 65 | ## |
| 66 | gwt-ll.o : ../core/gwt-ll.cpp |
| 67 | $(CC) -c -Wall -o $@ $(ARCHS) $(CFLAGS) $< |
| 68 | |
| 69 | ## |
| 70 | # General coff target. |
| 71 | ## |
| 72 | %.o : %.cpp |
| 73 | $(CC) -c -Wall -o $@ $(ARCHS) $(CFLAGS) $< |
| 74 | |
| 75 | ## |
| 76 | # Generate JNI Header |
| 77 | ## |
| 78 | gwt-webkit.h : $(CLASSDIR)/com/google/gwt/dev/shell/mac/LowLevelSaf.class |
| 79 | $(JAVAH) -classpath $(CLASSDIR) -o gwt-webkit.h com.google.gwt.dev.shell.mac.LowLevelSaf |
| 80 | |
| 81 | ## |
| 82 | # Build gwt-ll library. |
| 83 | ## |
| 84 | $(GWT_LL_LIB) : $(GWT_LL_JNI) $(GWT_LL_OBJS) |
| 85 | $(CC) -Wall -o $@ $(ARCHS) $(LFLAGS) $(GWT_LL_OBJS) |
| 86 | |
| 87 | clean: |
| 88 | rm -f $(GWT_LL_JNI) $(GWT_LL_OBJS) $(TARGETS) |
| 89 | rm -rf $(SWT_PATCH_DIR) |