blob: 14da521eac3a8ce3fcd5a7135cb684d347179b1c [file] [log] [blame]
jat@google.com64a55cb2009-10-16 14:16:57 +00001# 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##
18GWT_ROOT = ../../
19OBJDIR := $(GWT_ROOT)build/out/jni/win32/
20OUTDIR := $(GWT_ROOT)build/jni/win32/
21OUT := $(OUTDIR)gwt-ll.dll
22STAGING := $(GWT_ROOT)build/staging/gwt-windows-0.0.0/
23
24##
25# Tools
26##
27CXX := mingw-gcc
28AR := mingw-ar
29STRIP := mingw-strip
30LD := $(CXX)
31
32##
33# List of source, object, and dependency paths plus the path to them
34##
35SRCDIRS := ./:../core/
36VPATH := .:../core
37SRCS := gwt-ll.cpp IE6.cpp
38OBJS := $(addprefix $(OBJDIR),$(SRCS:.cpp=.o))
39DEPS := $(addprefix $(OBJDIR),$(SRCS:.cpp=.d))
40
41##
42# Include path configuration
43##
44SYSINCS := \
45 $(JAVA_HOME)/include \
46 $(JAVA_HOME)/include/win32
47INCS := $(addprefix -isystem ,$(SYSINCS))
48
49##
50# Libraries and library path
51##
52LIBS := wininet
53LIBPATH := -L$(OBJDIR)
54LIBS := $(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
59CFLAGS := -Os -fno-exceptions -fshort-wchar -c -MMD -MP -Wno-system-headers $(CFLAGS)
60LDFLAGS := -s -Wl,--kill-at $(LDFLAGS)
61
62#-------------------------------------------------------------------------------
63# Rules
64#-------------------------------------------------------------------------------
65
66##
67# default rule
68##
69all: $(OUT)
70
71# install into prebuilt directory
72install: $(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##
105staging: $(OUT)
106 @[ -d $(STAGING) ] || mkdir -p $(STAGING)
107 cp $(OUT) $(STAGING)
108
109##
110# Clean rule
111##
112clean:
113 @-rm -rf $(OBJDIR) $(OUT)