1 #
   2 # Copyright (c) 1997, 2011, 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 #
  27 # Makefile for core Java libraries
  28 # (java.lang, java.lang.ref, java.lang.reflect, java.io, java.util)
  29 #
  30 
  31 BUILDDIR = ../..
  32 PACKAGE = java.lang
  33 LIBRARY = java
  34 PRODUCT = java
  35 include $(BUILDDIR)/common/Defs.gmk
  36 
  37 # windows compiler flags
  38 ifeq ($(PLATFORM),windows)
  39   OTHER_CFLAGS =
  40   # build directly into BINDIR...
  41   LIB_LOCATION = $(BINDIR)
  42   # Exported functions
  43   OTHER_LCF = -export:winFileHandleOpen -export:handleLseek
  44 endif
  45 
  46 OTHER_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
  47                 -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
  48                 -DJDK_MICRO_VERSION='"$(JDK_MICRO_VERSION)"' \
  49                 -DJDK_BUILD_NUMBER='"$(JDK_BUILD_NUMBER)"' 
  50 
  51 ifdef JDK_UPDATE_VERSION
  52 OTHER_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
  53 endif
  54 
  55 
  56 #
  57 # Files to compile.
  58 #
  59 include FILES_c.gmk
  60 include FILES_java.gmk
  61 include Exportedfiles.gmk
  62 
  63 ifeq ($(PLATFORM),windows)
  64 FILES_java +=   java/io/Win32FileSystem.java \
  65                 java/io/WinNTFileSystem.java \
  66                 java/util/prefs/WindowsPreferences.java \
  67                 java/util/prefs/WindowsPreferencesFactory.java
  68 
  69 FILES_c    +=   ProcessImpl_md.c \
  70                 Win32FileSystem_md.c \
  71                 WinNTFileSystem_md.c \
  72                 canonicalize_md.c \
  73                 dirent_md.c \
  74                 TimeZone.c \
  75                 TimeZone_md.c \
  76                 WindowsPreferences.c \
  77                 sun/security/provider/WinCAPISeedGenerator.c \
  78                 sun/io/Win32ErrorMode.c
  79 
  80 else # PLATFORM
  81 FILES_java +=   java/lang/UNIXProcess.java \
  82                 java/io/UnixFileSystem.java \
  83                 java/util/prefs/FileSystemPreferences.java \
  84                 java/util/prefs/FileSystemPreferencesFactory.java \
  85 
  86 FILES_c    +=   UNIXProcess_md.c \
  87                 childproc.c \
  88                 UnixFileSystem_md.c \
  89                 canonicalize_md.c \
  90                 TimeZone.c \
  91                 TimeZone_md.c \
  92                 FileSystemPreferences.c
  93 
  94 INIT += $(GENSRCDIR)/java/lang/UNIXProcess.java
  95 
  96 endif # PLATFORM
  97 
  98 ifeq ($(PLATFORM), macosx)
  99 FILES_c    +=   java_props_macosx.c
 100 FILES_java +=   java/util/prefs/MacOSXPreferences.java \
 101                 java/util/prefs/MacOSXPreferencesFile.java \
 102                 java/util/prefs/MacOSXPreferencesFactory.java
 103 
 104 CFLAGS_$(VARIANT)/java_props_md.o = -Os -x objective-c
 105 endif
 106 
 107 #
 108 # Make sure first rule does 'all'
 109 #
 110 default_rule: all
 111 
 112 #
 113 # Source files to generate before we try to compile anything
 114 #
 115 
 116 #
 117 # genlocales.gmk define rules to generate LocaleDataMetaInfo.java
 118 # which contains locale string list for sun.text.resources and
 119 # sun.util.resources.
 120 #
 121 include genlocales.gmk
 122 
 123 CLASSES_INIT = gencharsrc niosrc rbcontrolsrc genlocales
 124 
 125 niosrc: ; ($(CD) ../nio; $(MAKE) sources)
 126 
 127 gencharsrc: $(GENSRCDIR)/java/lang/CharacterData00.java \
 128     $(GENSRCDIR)/java/lang/CharacterData01.java \
 129     $(GENSRCDIR)/java/lang/CharacterData02.java \
 130     $(GENSRCDIR)/java/lang/CharacterData0E.java \
 131     $(GENSRCDIR)/java/lang/CharacterDataLatin1.java \
 132     $(GENSRCDIR)/java/lang/CharacterDataUndefined.java \
 133     $(GENSRCDIR)/java/lang/CharacterDataPrivateUse.java
 134 
 135 rbcontrolsrc: $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java
 136 
 137 #
 138 # Add to the default C file search paths
 139 #
 140 vpath %.c $(PLATFORM_SRC)/native/java/lang:$(SHARE_SRC)/native/java/lang
 141 vpath %.c $(SHARE_SRC)/native/java/lang/ref
 142 vpath %.c $(SHARE_SRC)/native/java/lang/reflect
 143 vpath %.c $(SHARE_SRC)/native/java/io
 144 vpath %.c $(PLATFORM_SRC)/native/java/io
 145 vpath %.c $(SHARE_SRC)/native/java/nio
 146 vpath %.c $(SHARE_SRC)/native/java/security
 147 vpath %.c $(SHARE_SRC)/native/common
 148 vpath %.c $(SHARE_SRC)/native/sun/misc
 149 vpath %.c $(SHARE_SRC)/native/sun/reflect
 150 vpath %.c $(SHARE_SRC)/native/java/sql
 151 vpath %.c $(SHARE_SRC)/native/java/util
 152 vpath %.c $(SHARE_SRC)/native/java/util/concurrent/atomic
 153 vpath %.c $(PLATFORM_SRC)/native/common
 154 vpath %.c $(PLATFORM_SRC)/native/java/util
 155 vpath %.c $(PLATFORM_SRC)/native/sun/security/provider
 156 vpath %.c $(PLATFORM_SRC)/native/sun/io
 157 
 158 #
 159 # Includes the fdlibm header file.
 160 #
 161 OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/lang/fdlibm/include
 162 
 163 #
 164 # Also include the io_util.h header file.
 165 #
 166 OTHER_INCLUDES += -I$(SHARE_SRC)/native/java/io
 167 OTHER_INCLUDES += -I$(PLATFORM_SRC)/native/java/io
 168 
 169 #
 170 # Also include the TimeZone_md.h header file.
 171 #
 172 OTHER_INCLUDES += -I$(PLATFORM_SRC)/native/java/util
 173 
 174 #
 175 # Is the altzone extern documented in ctime(3C) available?
 176 #
 177 ifneq ($(PLATFORM), windows)
 178 ifneq ($(PLATFORM), macosx)
 179 HAVE_ALTZONE=true
 180 endif
 181 endif
 182 
 183 ifeq ($(HAVE_ALTZONE),true)
 184 OTHER_CPPFLAGS += -DHAVE_ALTZONE
 185 endif
 186 
 187 #
 188 # System.c needs RELEASE.
 189 # java_props_md.c needs ARCH on non-Solaris platforms.
 190 #
 191 OTHER_CPPFLAGS += $(VERSION_DEFINES)
 192 
 193 #
 194 # Include name of LIBARCH
 195 #
 196 OTHER_CPPFLAGS += -DARCHPROPNAME='"$(ARCHPROP)"'
 197 
 198 #
 199 # Is the key in the call nl_langinfo(CODESET) called something other than
 200 # CODESET?
 201 #
 202 ifdef ALT_CODESET_KEY
 203 OTHER_CPPFLAGS += -DALT_CODESET_KEY=$(ALT_CODESET_KEY)
 204 endif
 205 
 206 #
 207 # Install .lib file.
 208 #
 209 INSTALL_DOT_LIB = true
 210 
 211 #
 212 # What to link?
 213 # On Windows, shell32 is not normally required and so it is delay loaded.
 214 #
 215 ifeq ($(PLATFORM),windows)
 216 OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
 217                        -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib \
 218                        shell32.lib delayimp.lib /DELAYLOAD:shell32.dll
 219 else
 220 OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) $(LIBNSL) $(LIBSCF) $(LIBDL) \
 221                 -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
 222 ifeq ($(PLATFORM), macosx)
 223 OTHER_LDLIBS += \
 224         -framework CoreFoundation \
 225         -framework Security \
 226         -framework SystemConfiguration
 227 endif
 228 endif
 229 
 230 #
 231 # Rules.
 232 #
 233 ifeq ($(PLATFORM), solaris)
 234   ifneq ($(ARCH), amd64)
 235     FILES_reorder += reorder-$(ARCH)
 236   endif
 237 endif
 238 
 239 SUBDIRS = reflect
 240 include $(BUILDDIR)/common/Subdirs.gmk
 241 
 242 all build:
 243         $(SUBDIRS-loop)
 244 clean clobber::
 245         $(SUBDIRS-loop)
 246 
 247 include $(BUILDDIR)/common/Mapfile-vers.gmk
 248 include $(BUILDDIR)/common/Library.gmk
 249 
 250 ifeq ($(PLATFORM), solaris)
 251   ifeq ($(CC_VER), 5.8)
 252     ifndef REMOVE_ALL_WORKAROUNDS
 253       CFLAGS_OPT/ObjectInputStream.o = -xO3 \
 254           $(warning  "WARNING: Using workaround for SS11 bug 6346242, on $@")
 255     endif
 256   endif
 257 endif
 258 
 259 ifneq ($(PLATFORM),windows)
 260 
 261 # UNIXProcess.java is different for solaris and linux. We need to copy
 262 # the correct UNIXProcess.java over to $(GENSRCDIR)/java/lang/.
 263 
 264 ifeq ($(PLATFORM), macosx)
 265 PLATFORM_UNIX_PROCESS = \
 266     $(PLATFORM_SRC)/classes/java/lang/UNIXProcess.java.bsd
 267 else
 268 PLATFORM_UNIX_PROCESS = \
 269     $(PLATFORM_SRC)/classes/java/lang/UNIXProcess.java.$(PLATFORM)
 270 endif
 271 
 272 $(GENSRCDIR)/java/lang/UNIXProcess.java: $(PLATFORM_UNIX_PROCESS)
 273         $(install-file)
 274 
 275 clean:: 
 276         $(RM) $(GENSRCDIR)/java/lang/UNIXProcess.java
 277 
 278 endif
 279 
 280 
 281 #
 282 # Because we can't link against ourselves!
 283 #
 284 JAVALIB =
 285 
 286 #
 287 # Special rules.
 288 #
 289 clean:: 
 290         $(RM) -r $(CLASSHDRDIR)
 291 
 292 clobber:: 
 293         $(RM) -r $(CLASSBINDIR)/java/io $(CLASSBINDIR)/java/lang \
 294                 $(CLASSBINDIR)/java/security $(CLASSBINDIR)/java/util \
 295                 $(CLASSBINDIR)/sun/misc
 296 
 297 #
 298 # Additional rule from sun/net/GNUmakefile to copy content-type.properties
 299 # file so that the MimeTable class won't complain while bootstrapping...
 300 #
 301 PROPS = content-types.properties
 302 
 303 #
 304 # Rule to copy calendars.properties file.
 305 #
 306 CAL_PROPS = calendars.properties
 307 
 308 #
 309 # Rule to copy tzmappings file on Windows
 310 #
 311 ifeq ($(PLATFORM), windows)
 312 TZMAP = $(LIBDIR)/tzmappings
 313 TZMAPFILE = $(PLATFORM_SRC)/lib/tzmappings
 314 
 315 $(TZMAP): $(TZMAPFILE)
 316         $(install-file)
 317         $(call chmod-file, 444)
 318 endif
 319 
 320 build: $(LIBDIR)/$(PROPS) $(LIBDIR)/$(CAL_PROPS) $(TZMAP)
 321 
 322 $(LIBDIR)/$(PROPS): $(PLATFORM_SRC)/lib/$(PROPS)
 323         $(install-file)
 324 
 325 $(LIBDIR)/$(CAL_PROPS): $(SHARE_SRC)/lib/$(CAL_PROPS)
 326         $(install-file)
 327 
 328 clean:: 
 329         $(RM) -r $(LIBDIR)/$(PROPS) $(TZMAP)
 330 
 331 #
 332 # Rules to create lib/currency.data
 333 #
 334 
 335 CURDATA = $(LIBDIR)/currency.data
 336 GENERATECURRENCYDATA_JARFILE = $(BUILDTOOLJARDIR)/generatecurrencydata.jar
 337 
 338 build: $(CURDATA)
 339 
 340 $(CURDATA): \
 341   $(GENERATECURRENCYDATA_JARFILE) \
 342   $(SHARE_SRC)/classes/java/util/CurrencyData.properties
 343         $(RM) $(CURDATA)
 344         $(BOOT_JAVA_CMD) -jar $(GENERATECURRENCYDATA_JARFILE) -o $@.temp \
 345                 < $(SHARE_SRC)/classes/java/util/CurrencyData.properties
 346         $(MV) $@.temp $@
 347         $(call chmod-file, 444)
 348 
 349 clean:: 
 350         $(RM) $(CURDATA)
 351 
 352 
 353 #
 354 # Rules to create $(GENSRCDIR)/sun/lang/CharacterData*.java 
 355 #
 356 CHARACTERDATA = $(BUILDDIR)/tools/GenerateCharacter
 357 UNICODEDATA   = $(BUILDDIR)/tools/UnicodeData
 358 
 359 GENERATECHARACTER_JARFILE = $(BUILDTOOLJARDIR)/generatecharacter.jar
 360 
 361 $(GENSRCDIR)/java/lang/CharacterDataLatin1.java \
 362   $(GENSRCDIR)/java/lang/CharacterData00.java \
 363   $(GENSRCDIR)/java/lang/CharacterData01.java \
 364   $(GENSRCDIR)/java/lang/CharacterData02.java \
 365   $(GENSRCDIR)/java/lang/CharacterData0E.java: \
 366     $(wildcard $(CHARACTERDATA)/*) \
 367     $(GENERATECHARACTER_JARFILE)
 368         @$(prep-target)
 369         $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) \
 370                 -template $(CHARACTERDATA)/CharacterDataLatin1.java.template \
 371                 -spec $(UNICODEDATA)/UnicodeData.txt \
 372                 -specialcasing $(UNICODEDATA)/SpecialCasing.txt \
 373                 -proplist $(UNICODEDATA)/PropList.txt \
 374                 -o $(GENSRCDIR)/java/lang/CharacterDataLatin1.java -string \
 375                 -usecharforbyte -latin1 8
 376         $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 0 \
 377                 -template $(CHARACTERDATA)/CharacterData00.java.template \
 378                 -spec $(UNICODEDATA)/UnicodeData.txt \
 379                 -specialcasing $(UNICODEDATA)/SpecialCasing.txt \
 380                 -proplist $(UNICODEDATA)/PropList.txt \
 381                 -o $(GENSRCDIR)/java/lang/CharacterData00.java -string \
 382                 -usecharforbyte 11 4 1
 383         $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 1 \
 384                 -template $(CHARACTERDATA)/CharacterData01.java.template \
 385                 -spec $(UNICODEDATA)/UnicodeData.txt \
 386                 -specialcasing $(UNICODEDATA)/SpecialCasing.txt \
 387                 -proplist $(UNICODEDATA)/PropList.txt \
 388                 -o $(GENSRCDIR)/java/lang/CharacterData01.java -string \
 389                 -usecharforbyte  11 4 1
 390         $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 2 \
 391                 -template $(CHARACTERDATA)/CharacterData02.java.template \
 392                 -spec $(UNICODEDATA)/UnicodeData.txt \
 393                 -specialcasing $(UNICODEDATA)/SpecialCasing.txt \
 394                 -proplist $(UNICODEDATA)/PropList.txt \
 395                 -o $(GENSRCDIR)/java/lang/CharacterData02.java -string \
 396                 -usecharforbyte 11 4 1
 397         $(BOOT_JAVA_CMD) -jar $(GENERATECHARACTER_JARFILE) -plane 14 \
 398                 -template $(CHARACTERDATA)/CharacterData0E.java.template \
 399                 -spec $(UNICODEDATA)/UnicodeData.txt \
 400                 -specialcasing $(UNICODEDATA)/SpecialCasing.txt \
 401                 -proplist $(UNICODEDATA)/PropList.txt \
 402                 -o $(GENSRCDIR)/java/lang/CharacterData0E.java -string \
 403                 -usecharforbyte 11 4 1
 404 
 405 $(GENSRCDIR)/java/lang/%.java : $(CHARACTERDATA)/%.java.template
 406         $(install-file)
 407 
 408 clean::
 409         $(RM) $(GENSRCDIR)/java/lang/CharacterDataLatin1.java 
 410         $(RM) $(GENSRCDIR)/java/lang/CharacterData00.java
 411         $(RM) $(GENSRCDIR)/java/lang/CharacterData01.java 
 412         $(RM) $(GENSRCDIR)/java/lang/CharacterData02.java
 413         $(RM) $(GENSRCDIR)/java/lang/CharacterData0E.java
 414         $(RM) $(GENSRCDIR)/java/lang/CharacterDataUndefined.java 
 415         $(RM) $(GENSRCDIR)/java/lang/CharacterDataPrivateUse.java
 416 
 417 #
 418 # Rules to generate classes/java/lang/uniName.dat
 419 #
 420 
 421 
 422 
 423 UNINAME = $(CLASSBINDIR)/java/lang/uniName.dat
 424 GENERATEUNINAME_JARFILE = $(BUILDTOOLJARDIR)/generatecharacter.jar
 425 
 426 build: $(UNINAME)
 427 
 428 $(UNINAME): $(UNICODEDATA)/UnicodeData.txt \
 429         $(GENERATECHARACTER_JARFILE)
 430         @$(prep-target)
 431         $(BOOT_JAVA_CMD) -classpath $(GENERATECHARACTER_JARFILE) \
 432         build.tools.generatecharacter.CharacterName \
 433                 $(UNICODEDATA)/UnicodeData.txt $(UNINAME)
 434 
 435 clean:: 
 436         $(RM) $(UNINAME)
 437 
 438 #
 439 # End of rules to create $(GENSRCDIR)/java/lang/CharacterDataXX.java
 440 #
 441 
 442 #
 443 # Rule to precompile CoreResourceBundleControl.java 
 444 #
 445 LOCALES_GEN_SH = localelist.sh
 446 
 447 $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \
 448         $(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java.template $(LOCALES_GEN_SH)
 449         @$(prep-target) 
 450         NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
 451                 $< $@ 
 452 clean::
 453         $(RM) $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java
 454 
 455 
 456 HELPER_EXE = $(LIBDIR)/$(LIBARCH)/jspawnhelper
 457 BUILDHELPER =
 458 ifeq ($(PLATFORM), solaris)
 459     BUILDHELPER = 1
 460 endif
 461 ifeq ($(PLATFORM), macosx)
 462     HELPER_EXE = $(LIBDIR)/jspawnhelper
 463     BUILDHELPER = 1
 464 endif
 465 
 466 ARCHFLAG = 
 467 ifeq ($(ARCH_DATA_MODEL), 64)
 468 ARCHFLAG = -m64
 469 endif
 470 
 471 ifdef BUILDHELPER
 472 
 473 HELPER_EXE_FILES_c = jspawnhelper.c
 474 HELPER_EXE_FILES_o = $(OBJDIR)/jspawnhelper.o \
 475                 $(OBJDIR)/childproc.o
 476 
 477 $(HELPER_EXE): $(HELPER_EXE_FILES_o)
 478         $(CC) $(ARCHFLAG) $(HELPER_EXE_FILES_o) \
 479                 -o $(TEMPDIR)/jspawnhelper
 480         $(CP) $(TEMPDIR)/jspawnhelper $(HELPER_EXE)
 481 
 482 build: $(HELPER_EXE)
 483 
 484 clean clobber:: 
 485         $(RM) $(HELPER_EXE_FILES_o) $(HELPER_EXE)
 486 
 487 endif #BUILDHELPER