1 # 2 # Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 # 5 # This code is free software; you can redistribute it and/or modify it 6 # under the terms of the GNU General Public License version 2 only, as 7 # published by the Free Software Foundation. Oracle designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Oracle in the LICENSE file that accompanied this code. 10 # 11 # This code is distributed in the hope that it will be useful, but WITHOUT 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 # version 2 for more details (a copy is included in the LICENSE file that 15 # accompanied this code). 16 # 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 BUILDDIR = ../.. 27 PACKAGE = sun.awt.X11 28 LIBRARY = mawt 29 LIBRARY_OUTPUT = xawt 30 PRODUCT = sun 31 32 ifeq ($(PLATFORM), macosx) 33 LIB_LOCATION = $(LIBDIR)/xawt 34 else 35 LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/xawt 36 endif 37 38 include $(BUILDDIR)/common/Defs.gmk 39 40 GEN_DIR=$(GENSRCDIR)/sun/awt/X11 41 42 CLASSES_INIT += $(TEMPDIR)/.gen.wrappers touch.wrappers 43 44 .PHONY: generated.clean 45 46 # 47 # Files 48 # 49 include FILES_c_unix.gmk 50 include FILES_export_unix.gmk 51 AUTO_FILES_JAVA_DIRS = sun/awt/X11 52 AUTO_JAVA_PRUNE = WrapperGenerator.java 53 54 LDFLAGS += -L$(OPENWIN_LIB) 55 56 # For Xrender extension. 57 ifeq ($(PLATFORM), solaris) 58 LDFLAGS += -L/usr/openwin/sfw/lib$(ISA_DIR) -R/usr/openwin/sfw/lib$(ISA_DIR) 59 endif 60 61 ifeq ($(PLATFORM), linux) 62 LDFLAGS += -lpthread 63 dummy := $(shell $(MKDIR) -p $(LIB_LOCATION)) 64 endif 65 66 ifeq ($(PLATFORM), macosx)) 67 LDFLAGS += -pthread 68 dummy := $(shell $(MKDIR) -p $(LIB_LOCATION)) 69 endif 70 71 # Since this library will be living in a subdirectory below the other libraries 72 # we need to add an extra runpath so that libraries in the upper directory 73 # are found at runtime. 74 LD_RUNPATH_EXTRAS = .. 75 76 # 77 # Rules. 78 # 79 include $(BUILDDIR)/common/Mapfile-vers.gmk 80 include $(BUILDDIR)/common/Library.gmk 81 82 # 83 # Add to the ambient vpath to pick up files in subdirectories 84 # 85 vpath %.c $(SHARE_SRC)/native/sunawt/alphacomposite 86 vpath %.c $(PLATFORM_SRC)/native/sun/xawt 87 vpath %.c $(PLATFORM_SRC)/native/sun/awt 88 vpath %.c $(SHARE_SRC)/native/sun/awt/debug 89 vpath %.c $(SHARE_SRC)/native/sun/awt/image 90 vpath %.c $(SHARE_SRC)/native/sun/awt/image/gif 91 vpath %.c $(SHARE_SRC)/native/sun/awt/image/cvutils 92 vpath %.c $(SHARE_SRC)/native/sun/awt/shell 93 vpath %.c $(SHARE_SRC)/native/sun/java2d 94 vpath %.c $(SHARE_SRC)/native/sun/java2d/loops 95 vpath %.c $(SHARE_SRC)/native/sun/java2d/pipe 96 vpath %.c $(SHARE_SRC)/native/sun/awt/medialib 97 vpath %.c $(SHARE_SRC)/native/sun/awt/utility 98 vpath %.cpp $(SHARE_SRC)/native/sun/image 99 vpath %.c $(SHARE_SRC)/native/sun/font 100 vpath %.c $(PLATFORM_SRC)/native/sun/awt/robot_child 101 vpath %.c $(SHARE_SRC)/native/sun/java2d/opengl 102 vpath %.c $(PLATFORM_SRC)/native/sun/java2d/opengl 103 vpath %.c $(PLATFORM_SRC)/native/sun/java2d/x11 104 105 OTHER_LDLIBS = $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) \ 106 $(LDFLAGS_COMMON) $(AWT_RUNPATH) $(OTHER_LDFLAGS) -lXtst -lXi 107 108 ifeq ($(PLATFORM), solaris) 109 CPPFLAGS += -DFUNCPROTO=15 110 dummy := $(shell $(MKDIR) -p $(LIB_LOCATION)) 111 endif 112 113 CPPFLAGS += -I$(CUPS_HEADERS_PATH) 114 115 CPPFLAGS += -DXAWT -DXAWT_HACK \ 116 -I$(TEMPDIR)/../../sun.awt/awt/CClassHeaders \ 117 -I$(PLATFORM_SRC)/native/sun/awt \ 118 -I$(PLATFORM_SRC)/native/sun/xawt \ 119 -I$(PLATFORM_SRC)/native/sun/jdga \ 120 -I$(SHARE_SRC)/native/sun/awt/debug \ 121 -I$(SHARE_SRC)/native/sun/awt/image/cvutils \ 122 -I$(SHARE_SRC)/native/sun/java2d \ 123 -I$(SHARE_SRC)/native/sun/java2d/loops \ 124 -I$(SHARE_SRC)/native/sun/awt/image/cvutils \ 125 -I$(SHARE_SRC)/native/sun/awt/image \ 126 -I$(SHARE_SRC)/native/sun/font \ 127 -I$(PLATFORM_SRC)/native/sun/java2d \ 128 -I$(SHARE_SRC)/native/sun/java2d/pipe \ 129 -I$(SHARE_SRC)/native/sun/java2d/opengl \ 130 -I$(PLATFORM_SRC)/native/sun/java2d/opengl \ 131 -I$(PLATFORM_SRC)/native/sun/java2d/x11 \ 132 -I$(SHARE_SRC)/native/sun/dc/path \ 133 -I$(SHARE_SRC)/native/sun/dc/doe \ 134 -I$(SHARE_SRC)/native/sun/awt/alphacomposite \ 135 -I$(SHARE_SRC)/native/sun/awt/medialib \ 136 -I$(PLATFORM_SRC)/native/sun/awt/medialib \ 137 -I$(PLATFORM_SRC)/native/sun/font \ 138 -I$(SHARE_SRC)/native/sun/awt \ 139 -I$(PLATFORM_SRC)/native/sun/awt 140 141 ifeq ($(PLATFORM), linux) 142 ifndef CROSS_COMPILE_ARCH 143 # Allows for builds on Debian GNU Linux, X11 is in a different place 144 # This should really be handled at a higher-level so we don't have to 145 # work-around this when cross-compiling 146 CPPFLAGS += -I/usr/X11R6/include/X11/extensions \ 147 -I/usr/include/X11/extensions \ 148 -I$(OPENWIN_HOME)/include 149 else 150 CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions \ 151 -I$(OPENWIN_HOME)/include 152 endif 153 endif 154 155 # We have some odd logic here because some Solaris 10 updates 156 # have a render.h file that suggests gradients are supported, but 157 # the Xrender.h doesn't have the corresponding type definitions. 158 # Earlier updates have neither. We'd like to know if there's a mismatch. 159 # Whilst in the C preprocessor we can tell if the render.h define's are set 160 # we can't tell anything about C declarations. 161 # A grep of Xrender.h is the only way to know this. If they are absent 162 # we will set a flag indicating this mismatch and the JDK source file 163 # will interpret it to resolve the problem. 164 ifeq ($(PLATFORM), solaris) 165 CPPFLAGS += -I$(OPENWIN_HOME)/include/X11/extensions 166 OS_VERSION := $(shell uname -r) 167 XRENDER_H := $(OPENWIN_HOME)/share/include/X11/extensions/Xrender.h 168 ifeq ($(OS_VERSION),5.10) 169 LINEARGRADIENT_CNT := $(shell $(EGREP) -c XLinearGradient $(XRENDER_H)) 170 ifeq ($(LINEARGRADIENT_CNT),0) 171 CFLAGS+= -DSOLARIS10_NO_XRENDER_STRUCTS 172 endif 173 endif 174 endif 175 176 ifeq ($(PLATFORM), macosx) 177 CPPFLAGS += -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" 178 endif 179 180 ifeq ($(MILESTONE), internal) 181 CPPFLAGS += -DINTERNAL_BUILD 182 endif 183 184 # 185 # Generation of wrappers 186 # 187 SIZER_DIR=$(GEN_DIR)/generator 188 SIZER = $(SIZER_DIR)/sizer 189 SIZER_32_C = $(SIZER).32.c 190 SIZER_64_C = $(SIZER).64.c 191 CFLAGS_32=$(CFLAGS) 192 CFLAGS_64=$(CFLAGS) 193 194 ifeq ($(PLATFORM), solaris) 195 196 isalist:=$(shell $(ISAINFO)) 197 198 ifneq (,$(findstring sparcv9, $(isalist))) 199 # On sparcv9 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL. 200 # On sparcv9 CFLAGS already contain $(XARCH_OPTION/64), so to generate 32-bit sizer we need to change this option. 201 CFLAGS_32=$(subst $(XARCH_OPTION/64),$(XARCH_OPTION/32),$(CFLAGS)) 202 SIZERS = $(SIZER).32 $(SIZER).64 203 SIZERS_C = $(SIZER_32_C) $(SIZER_64_C) 204 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 $(WRAPPER_GENERATOR_DIR)/sizes.64 205 CFLAGS_64=$(CFLAGS) $(XARCH_OPTION/64) 206 else 207 ifneq (,$(findstring amd64, $(isalist))) 208 # On amd64 we generate both 32 and 64-bit sizers in spite of ARCH_DATA_MODEL. 209 # On amd64 CFLAGS already contain $(XARCH_OPTION/64), so to generate 32-bit sizer we need to change this option. 210 CFLAGS_32=$(subst $(XARCH_OPTION/64),$(XARCH_OPTION/32),$(CFLAGS)) 211 SIZERS = $(SIZER).32 $(SIZER).64 212 SIZERS_C = $(SIZER_32_C) $(SIZER_64_C) 213 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 $(WRAPPER_GENERATOR_DIR)/sizes.64 214 CFLAGS_64=$(CFLAGS) $(XARCH_OPTION/64) 215 else # !sparcv9 : includes (32-bit) sparc, i586 216 SIZERS = $(SIZER).32 217 SIZERS_C = $(SIZER_32_C) 218 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 219 endif # amd64 220 endif # sparcv9 221 222 else # !solaris 223 224 ifeq ($(PLATFORM), macosx) 225 CFLAGS_32=-arch i386 226 SIZERS = $(SIZER).32 $(SIZER).64 227 SIZERS_C = $(SIZER_32_C) $(SIZER_64_C) 228 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 $(WRAPPER_GENERATOR_DIR)/sizes.64 229 CFLAGS_64=-arch x86_64 230 else # !macosx 231 ifeq ($(ARCH_DATA_MODEL), 32) 232 SIZERS = $(SIZER).32 233 SIZERS_C = $(SIZER_32_C) 234 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.32 235 ifdef CROSS_COMPILE_ARCH 236 CFLAGS_32 = -m32 237 endif 238 else # !32 239 SIZERS = $(SIZER).64 240 SIZERS_C = $(SIZER_64_C) 241 SIZES = $(WRAPPER_GENERATOR_DIR)/sizes.64 242 ifdef CROSS_COMPILE_ARCH 243 CFLAGS_64 = -m64 244 endif 245 endif # 32 246 endif # !macosx 247 endif # solaris 248 249 # XXX Hack for 6185483 - use hard-coded sizes. 250 # Add the 64-bit platforms that need to be included into 32-bit build 251 # and have sizes.64-$(PLATFORM)-$(LIBARCH) hardcoded in the workspace 252 ifeq ($(PLATFORM)-$(LIBARCH), solaris-i386) 253 # If you define DOHACK=true for some combination of $(PLATFORM)-$(LIBARCH), 254 # make sure you have sizes.64-$(PLATFORM)-$(LIBARCH) pre-generated in 255 # $(PLATFORM_SRC)/classes/sun/awt/X11/generator/ 256 DOHACK=true 257 endif # Hack 258 259 ifeq ($(DOHACK), true) 260 PREDEFINED_SIZES_TMPL=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/sizes.64-$(PLATFORM)-$(LIBARCH) 261 PREDEFINED_SIZES=$(WRAPPER_GENERATOR_DIR)/sizes.64 262 SIZES += $(WRAPPER_GENERATOR_DIR)/sizes.64 263 endif 264 265 ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64) 266 DOCOMPARE=true 267 endif 268 # 64 bit sizers are generated on platform-libarch (left) for use 269 # on platform-libarch (right) and stored under the latter name. 270 # Do compare manually stored and automatically generated pair(s) 271 # if DOCOMPARE=true, just after the generation. 272 STORED_SIZES_TMPL_solaris_amd64=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/sizes.64-solaris-i386 273 274 WRAPPER_GENERATOR_JAVA=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/WrapperGenerator.java 275 WRAPPER_GENERATOR_DIR=$(GENSRCDIR)/sun/awt/X11/generator 276 WRAPPER_GENERATOR_TEMPDIR=$(TEMPDIR)/sun/awt/X11/generator 277 WRAPPER_GENERATOR_CLASS=$(WRAPPER_GENERATOR_TEMPDIR)/WrapperGenerator.class 278 XLIBTYPES=$(PLATFORM_SRC)/classes/sun/awt/X11/generator/xlibtypes.txt 279 280 ifndef CROSS_COMPILE_ARCH 281 SIZERS_CC = $(CC) 282 else 283 SIZERS_CC = $(HOST_CC) 284 endif 285 286 $(SIZERS): $(SIZERS_C) 287 $(prep-target) 288 $(SIZERS_CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c 289 290 $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA) 291 $(prep-target) 292 $(BOOT_JAVAC_CMD) -d $(WRAPPER_GENERATOR_TEMPDIR) $(WRAPPER_GENERATOR_JAVA) 293 294 $(SIZERS_C): $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES) 295 $(prep-target) 296 $(MKDIR) -p $(WRAPPER_GENERATOR_TEMPDIR) 297 $(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR) WrapperGenerator \ 298 $(SIZER_DIR) $(XLIBTYPES) "sizer" $(subst .,,$(suffix $(basename $@))) 299 300 $(SIZES): $(SIZERS) 301 @if [ "$(DOHACK)$@" = "true$(PREDEFINED_SIZES)" ]; then \ 302 $(ECHO) COPYING $(PREDEFINED_SIZES_TMPL) into $@; \ 303 $(CP) $(PREDEFINED_SIZES_TMPL) $@; \ 304 $(CHMOD) +w $@;\ 305 else \ 306 $(ECHO) GENERATING $@; \ 307 $(WRAPPER_GENERATOR_DIR)/sizer$(suffix $@) > $@; \ 308 fi 309 @if [ "$(DOCOMPARE)$(suffix $@)" = "true.64" ]; then \ 310 $(ECHO) COMPARING $@ and $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \ 311 $(DIFF) $@ $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \ 312 fi 313 314 $(TEMPDIR)/.gen.wrappers: $(SIZES) $(WRAPPER_GENERATOR_CLASS) $(XLIBTYPES) 315 $(BOOT_JAVA_CMD) -cp $(WRAPPER_GENERATOR_TEMPDIR) WrapperGenerator \ 316 $(GEN_DIR) $(XLIBTYPES) "gen" $(WRAPPER_GENERATOR_DIR)/sizes 317 318 touch.wrappers: $(TEMPDIR)/.gen.wrappers 319 $(MKDIR) -p $(TEMPDIR) 320 $(TOUCH) $(TEMPDIR)/.gen.wrappers 321 322 generated.clean: 323 $(RM) -r $(WRAPPER_GENERATOR_TEMPDIR) 324 $(RM) -r $(WRAPPER_GENERATOR_DIR) 325 $(RM) -r $(GEN_DIR)/*.java 326 327 328 clean clobber:: generated.clean 329 330 .PHONY: generated.clean robot_child 331