jat@google.com | 64a55cb | 2009-10-16 14:16:57 +0000 | [diff] [blame] | 1 | # Copyright 2006 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 | ## |
| 16 | # Target settings |
| 17 | ## |
| 18 | GWT_ROOT = ../../ |
| 19 | OBJDIR := $(GWT_ROOT)build/out/jni/win32/ |
| 20 | OUTDIR := $(GWT_ROOT)build/jni/win32/ |
| 21 | OUT := $(OUTDIR)gwt-ll.dll |
| 22 | STAGING := $(GWT_ROOT)build/staging/gwt-windows-0.0.0/ |
| 23 | |
| 24 | ## |
| 25 | # Tools |
| 26 | ## |
| 27 | CXX := mingw-gcc |
| 28 | AR := mingw-ar |
| 29 | STRIP := mingw-strip |
| 30 | LD := $(CXX) |
| 31 | |
| 32 | ## |
| 33 | # List of source, object, and dependency paths plus the path to them |
| 34 | ## |
| 35 | SRCDIRS := ./:../core/ |
| 36 | VPATH := .:../core |
| 37 | SRCS := gwt-ll.cpp IE6.cpp |
| 38 | OBJS := $(addprefix $(OBJDIR),$(SRCS:.cpp=.o)) |
| 39 | DEPS := $(addprefix $(OBJDIR),$(SRCS:.cpp=.d)) |
| 40 | |
| 41 | ## |
| 42 | # Include path configuration |
| 43 | ## |
| 44 | SYSINCS := \ |
| 45 | $(JAVA_HOME)/include \ |
| 46 | $(JAVA_HOME)/include/win32 |
| 47 | INCS := $(addprefix -isystem ,$(SYSINCS)) |
| 48 | |
| 49 | ## |
| 50 | # Libraries and library path |
| 51 | ## |
| 52 | LIBS := wininet |
| 53 | LIBPATH := -L$(OBJDIR) |
| 54 | LIBS := $(addprefix -l,$(LIBS)) |
| 55 | |
| 56 | # for notes on auto-dependency generation, see |
| 57 | # http://make.paulandlesley.org/autodep.html |
| 58 | # -MP obviates the need for sed hackery |
| 59 | CFLAGS := -Os -fno-exceptions -fshort-wchar -c -MMD -MP -Wno-system-headers $(CFLAGS) |
| 60 | LDFLAGS := -s -Wl,--kill-at $(LDFLAGS) |
| 61 | |
| 62 | #------------------------------------------------------------------------------- |
| 63 | # Rules |
| 64 | #------------------------------------------------------------------------------- |
| 65 | |
| 66 | ## |
| 67 | # default rule |
| 68 | ## |
| 69 | all: $(OUT) |
| 70 | |
| 71 | # install into prebuilt directory |
| 72 | install: $(OUT) |
| 73 | cp $(OUT) prebuilt/ |
| 74 | |
| 75 | ## |
| 76 | # Include the dependency rules |
| 77 | ## |
| 78 | -include $(DEPS) |
| 79 | |
| 80 | ## |
| 81 | # Compilation rule for cpp files |
| 82 | ## |
| 83 | $(OBJDIR)%.o : $(SRCDIR)%.cpp |
| 84 | @[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR) |
| 85 | $(CXX) $(CFLAGS) $(INCS) -o $@ $< |
| 86 | |
| 87 | ## |
| 88 | # Compilation rule for .def files to lib*.a files |
| 89 | ## |
| 90 | $(OBJDIR)lib%.a : $(SRCDIR)%.def |
| 91 | @[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR) |
| 92 | mingw-dlltool -k -d $< -l $@ |
| 93 | |
| 94 | ## |
| 95 | # Actual output file |
| 96 | ## |
| 97 | $(OUT): $(OBJS) $(OBJDIR)libwininet.a |
| 98 | @[ -d $(OUTDIR) ] || mkdir -p $(OUTDIR) |
| 99 | $(LD) -shared $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS) |
| 100 | $(STRIP) --strip-unneeded $@ |
| 101 | |
| 102 | ## |
| 103 | # copy to staging area for hosted-mode development |
| 104 | ## |
| 105 | staging: $(OUT) |
| 106 | @[ -d $(STAGING) ] || mkdir -p $(STAGING) |
| 107 | cp $(OUT) $(STAGING) |
| 108 | |
| 109 | ## |
| 110 | # Clean rule |
| 111 | ## |
| 112 | clean: |
| 113 | @-rm -rf $(OBJDIR) $(OUT) |