Main.gmk 19.8 KB
Newer Older
O
ohair 已提交
1
#
2
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
O
ohair 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

C
chegar 已提交
26 27 28 29 30 31
################################################################################
# This is the main makefile containing most actual top level targets. It needs
# to be called with a SPEC file defined.

# Declare default target
default:
O
ohair 已提交
32 33 34 35

# Now load the spec
include $(SPEC)

C
chegar 已提交
36 37
include $(SRC_ROOT)/make/MakeHelpers.gmk

38
# Load the vital tools for all the makefiles.
I
ihse 已提交
39
include $(SRC_ROOT)/make/common/MakeBase.gmk
40
include $(SRC_ROOT)/make/common/Modules.gmk
O
ohair 已提交
41

C
chegar 已提交
42 43 44 45 46 47 48 49
# Load common profile names definitions
include $(JDK_TOPDIR)/make/ProfileNames.gmk

# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
# valid top level targets. It's used to declare them all as PHONY and to 
# generate the -only targets.
ALL_TARGETS :=

50 51
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Main.gmk))
O
ohair 已提交
52

C
chegar 已提交
53 54 55
# All modules for the current target platform.
# Manually add jdk.hotspot.agent for now.
ALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
O
ohair 已提交
56

C
chegar 已提交
57 58 59 60 61 62
################################################################################
################################################################################
#
# Recipes for all targets. Only recipes, dependencies are declared later.
#
################################################################################
O
ohair 已提交
63

C
chegar 已提交
64 65
################################################################################
# Interim/build tools targets, compiling tools used during the build
O
ohair 已提交
66

C
chegar 已提交
67 68
interim-langtools:
	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
O
ohair 已提交
69

C
chegar 已提交
70 71
interim-corba:
	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCorba.gmk)
O
ohair 已提交
72

C
chegar 已提交
73 74
interim-rmic:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
75

C
chegar 已提交
76 77
build-tools-jdk:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
O
ohair 已提交
78

C
chegar 已提交
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
ALL_TARGETS += interim-langtools interim-corba build-tools-jdk

################################################################################
# Special targets for certain modules

import-hotspot:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)

unpack-sec:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)

policy-jars:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreatePolicyJars.gmk)

ALL_TARGETS += import-hotspot unpack-sec policy-jars

################################################################################
# Gensrc targets, generating source before java compilation can be done
JDK_GENSRC_MODULES := $(call FindModulesWithMakefileFor, gensrc, Gensrc)
LANGTOOLS_GENSRC_MODULES := jdk.compiler.tools
CORBA_GENSRC_MODULES := java.corba
GENSRC_MODULES := $(JDK_GENSRC_MODULES) $(LANGTOOLS_GENSRC_MODULES) \
    $(CORBA_GENSRC_MODULES)
JDK_GENSRC_TARGETS := $(addsuffix -gensrc, $(JDK_GENSRC_MODULES))
LANGTOOLS_GENSRC_TARGETS := $(addsuffix -gensrc, $(LANGTOOLS_GENSRC_MODULES))
CORBA_GENSRC_TARGETS := $(addsuffix -gensrc, $(CORBA_GENSRC_MODULES))
GENSRC_TARGETS := $(addsuffix -gensrc, $(GENSRC_MODULES))

jdk.compiler.tools-gensrc:
	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcLangtools.gmk)

java.corba-gensrc:
	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcCorba.gmk)

# Declare recipes for all jdk <module>-gensrc targets
$(foreach m, $(JDK_GENSRC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
    $m, gensrc, gensrc, Gensrc)))

ALL_TARGETS += $(GENSRC_TARGETS)

################################################################################
# Generate data targets
GENDATA_MODULES := $(call FindModulesWithMakefileFor, gendata, Gendata)
GENDATA_TARGETS := $(addsuffix -gendata, $(GENDATA_MODULES))

# Declare recipes for all <module>-gendata targets
$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
    $m, gendata, gendata, Gendata)))

$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareGendataRecipe,$m)))

ALL_TARGETS += $(GENDATA_TARGETS)

################################################################################
# Copy files targets
COPY_MODULES := $(call FindModulesWithMakefileFor, copy, Copy)
COPY_TARGETS := $(addsuffix -copy, $(COPY_MODULES))

# Declare recipes for all <module>-copy targets
$(foreach m, $(COPY_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
    $m, copy, copy, Copy)))

ALL_TARGETS += $(COPY_TARGETS)

################################################################################
# Targets for compiling all java modules. Nashorn is treated separately.
JAVA_MODULES := $(call FindJavaModules)
JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))

define DeclareCompileJavaRecipe
  $1-java:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
	    $1 JAVA_MODULES=$1)
endef

$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
    $(eval $(call DeclareCompileJavaRecipe,$m)))

# Build nashorn. Needs to be compiled separately from the rest of the modules
# due to nasgen.
jdk.scripting.nashorn-java:
	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)

ALL_TARGETS += $(JAVA_TARGETS)

################################################################################
# Targets for running rmic.
RMIC_MODULES := $(call FindModulesWithMakefileFor, rmic, Rmic)
RMIC_TARGETS := $(addsuffix -rmic, $(RMIC_MODULES))

# Declare recipes for all <module>-rmic targets
$(foreach m, $(RMIC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
    $m, rmic, rmic, Rmic)))

ALL_TARGETS += $(RMIC_TARGETS)

################################################################################
# Targets for compiling native libraries
ALL_LIB_MODULES := $(call FindModulesWithMakefileFor, lib, Lib)
LIB_MODULES := $(filter $(ALL_MODULES), $(ALL_LIB_MODULES))
LIB_TARGETS := $(addsuffix -libs, $(LIB_MODULES))

# Declare recipes for all <module>-libs targets
$(foreach m, $(LIB_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
    $m, libs, lib, Lib)))

ALL_TARGETS += $(LIB_TARGETS)
186

C
chegar 已提交
187 188 189 190 191 192 193 194 195 196 197 198 199 200
################################################################################
# Targets for compiling native executables
ALL_LAUNCHER_MODULES := $(call FindModulesWithMakefileFor, launcher, Launcher)
LAUNCHER_MODULES := $(filter $(ALL_MODULES), $(ALL_LAUNCHER_MODULES))
LAUNCHER_TARGETS := $(addsuffix -launchers, $(LAUNCHER_MODULES))

# Declare recipes for all <module>-launchers targets
$(foreach m, $(LAUNCHER_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
    $m, launchers, launcher, Launcher)))

ALL_TARGETS += $(LAUNCHER_TARGETS)

################################################################################
# Build hotspot target
O
ohair 已提交
201

202
ifeq ($(BUILD_HOTSPOT),true)
C
chegar 已提交
203 204
  hotspot:
	($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
205
endif
O
ohair 已提交
206

C
chegar 已提交
207
ALL_TARGETS += hotspot
208

C
chegar 已提交
209 210
################################################################################
# Build demos and samples targets
211

C
chegar 已提交
212 213 214 215 216 217 218
demos:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)

samples:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)

ALL_TARGETS += demos samples
O
ohair 已提交
219

C
chegar 已提交
220 221
################################################################################
# Image targets
O
ohair 已提交
222 223 224 225 226 227 228

# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
source-tips: $(OUTPUT_ROOT)/source_tips
$(OUTPUT_ROOT)/source_tips: FRC
	@$(MKDIR) -p $(@D)
	@$(RM) $@
229
	@$(call GetSourceTips)
O
ohair 已提交
230

C
chegar 已提交
231 232 233 234 235 236 237
security-jars:
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateSecurityJars.gmk)

nashorn-jar:
	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk all)

# Creates the jar files (rt.jar resources.jar etc)
238
main-jars:
239
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f CreateJars.gmk)
C
chegar 已提交
240 241 242

# Creates the images (j2sdk-image j2re-image etc)
images:
243
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f Images.gmk)
C
chegar 已提交
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288
        ifeq ($(OPENJDK_TARGET_OS), macosx)
	  +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk)
        endif

# Create Compact Profile jars
PROFILE_JARS_TARGETS := $(addsuffix -jars, $(ALL_PROFILES))
$(PROFILE_JARS_TARGETS):
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-jars=%) -f CreateJars.gmk)

# Create Compact Profile images
PROFILE_IMAGES_TARGETS := $(addsuffix -images, $(ALL_PROFILES))
$(PROFILE_IMAGES_TARGETS):
	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-images=%) \
	    JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$(@:%-images=%)),$(PROFILE_NAMES))-image \
	    -f Images.gmk profile-image)

profiles-oscheck:
        ifneq ($(OPENJDK_TARGET_OS), linux)
	  @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
        endif

bootcycle-images:
	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk images

ALL_TARGETS += source-tips security-jars nashorn-jar main-jars images \
    $(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
    bootcycle-images

################################################################################
# Docs targets

docs-javadoc:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)

docs-jvmtidoc:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)

ALL_TARGETS += docs-javadoc docs-jvmtidoc

################################################################################
# Test target

test:
	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
289
	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_OUTPUTDIR) \
C
chegar 已提交
290 291 292 293 294 295 296 297 298 299 300
	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true

test-make:
	($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))

ALL_TARGETS += test test-make

################################################################################
# Verification targets

verify-modules:
301
	@$(call TargetEnter)
302
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CheckModules.gmk)
303
	@$(call TargetExit)
C
chegar 已提交
304

305
ALL_TARGETS += verify-modules
C
chegar 已提交
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355

################################################################################
# Install targets

install:
	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)

ALL_TARGETS += install

################################################################################
#
# Dependency declarations between targets. 
#
# These are declared in two groups. First all dependencies between targets that 
# have recipes above as these dependencies may be disabled. Then the aggregator
# targets that do not have recipes of their own, which will never have their
# dependencies disabled.
#
################################################################################
# Targets with recipes above

# If running an *-only target, parallel execution and dependencies between 
# recipe targets are disabled. This makes it possible to run a select set of 
# recipe targets in order. It's the responsibility of the user to make sure
# all prerequisites are fulfilled. 
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
  .NOTPARALLEL:
else
  interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)

  build-tools-jdk: interim-langtools

  $(CORBA_GENSRC_TARGETS): interim-langtools

  $(JDK_GENSRC_TARGETS): interim-langtools build-tools-jdk

  interim-corba: $(CORBA_GENSRC_TARGETS)

  $(GENDATA_TARGETS): interim-langtools build-tools-jdk

  interim-rmic: interim-langtools

  $(RMIC_TARGETS): interim-langtools interim-corba interim-rmic

  import-hotspot: hotspot

  $(LIB_TARGETS): import-hotspot

  $(LAUNCHER_TARGETS): java.base-libs

356 357 358
  # The demos are currently linking to libjvm and libjava, just like all other
  # jdk libs, even though they don't need to. To avoid warnings, make sure they
  # aren't built until after libjava and libjvm are available to link to.
C
chegar 已提交
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
  demos: $(JAVA_TARGETS)

  # Declare dependency from <module>-java to <module>-gensrc
  $(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))

  # Declare dependencies between java modules
  $(foreach m, $(JAVA_MODULES), \
      $(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
      $(call FindDepsForModule,$m)))))

  # Declare dependencies between <module>-rmic to <module>-java
  $(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))

  # Declare dependencies from <module>-lib to <module>-java
  # Skip jdk.jdwp.agent as it contains no java code.
  $(foreach m, $(filter-out jdk.jdwp.agent, $(LIB_MODULES)), $(eval $m-libs: $m-java))

  # Declare dependencies from all other <module>-lib to java.base-lib
  $(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \
      $(eval $t: java.base-libs))
  # Declare the special case dependency for jdk.deploy.osx where libosx 
  # links against libosxapp.
  jdk.deploy.osx-libs: java.desktop-libs

  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a 
  # header file used by jdk.jdwp libs.
385
  jdk.jdwp.agent-libs: jdk.jdi-gensrc
C
chegar 已提交
386

387 388 389 390
  # The swing beans need to have java base properly generated to avoid errors
  # in javadoc.
  java.desktop-gensrc: java.base-gensrc

C
chegar 已提交
391 392 393
  # Explicitly add dependencies for special targets
  java.base-java: unpack-sec

394 395
  jdk.dev-gendata: java rmic

C
chegar 已提交
396 397 398 399
  security-jars: java

  nashorn-jar: jdk.scripting.nashorn-java

400
  main-jars: java rmic security-jars nashorn-jar policy-jars import-hotspot gendata
C
chegar 已提交
401 402 403 404 405 406 407 408

  # On windows, the jars target needs to wait for jgss libs to be built.
  # Should ideally split out the sec-bin zip file generation to avoid
  # this dependency.
  ifeq ($(OPENJDK_TARGET_OS), windows)
    main-jars: java.security.jgss-libs
  endif

409
  images: jars demos samples exploded-image verify-modules source-tips
C
chegar 已提交
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427

  bootcycle-images: images

  # Need to depend on jars as otherwise there will a race between all the
  # invocations of CreateJars.gmk.
  $(PROFILE_JARS_TARGETS): jars profiles-oscheck

  $(PROFILE_IMAGES_TARGETS): demos samples exploded-image source-tips

  # Declare dependencies from <profile>-images to <profile>-jars
  $(foreach p, $(ALL_PROFILES), $(eval $p-images: $p-jars))

  docs-javadoc: $(GENSRC_TARGETS) rmic

  docs-jvmtidoc: hotspot

  test: exploded-image

428
  verify-modules: exploded-image
C
chegar 已提交
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464

endif

################################################################################
# Virtual targets without recipes

gensrc: $(GENSRC_TARGETS)

gendata: $(GENDATA_TARGETS)

copy: $(COPY_TARGETS)

java: $(JAVA_TARGETS)

rmic: $(RMIC_TARGETS)

libs: $(LIB_TARGETS)

launchers: $(LAUNCHER_TARGETS)

# Explicitly add dependencies for these special targets
java.base: import-hotspot policy-jars

# Declare dependencies from <module> to all the individual targets specific
# to that module <module>-*.
$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
$(foreach m, $(LIB_MODULES), $(eval $m: $m-libs))
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))

ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
    $(GENDATA_MODULES) $(LIB_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))

465
exploded-image: $(ALL_MODULE_TARGETS)
466 467 468
# The old 'jdk' target most closely matches the new exploded-image. Keep an
# alias for ease of use.
jdk: exploded-image
C
chegar 已提交
469 470 471 472 473 474 475 476 477 478 479

jars: main-jars nashorn-jar security-jars policy-jars

# Make each profile name a target that depends on it's images target.
$(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))

profiles: $(ALL_PROFILES)

docs: docs-javadoc docs-jvmtidoc

ALL_TARGETS += gensrc gendata copy java rmic libs launchers \
480
    $(ALL_MODULE_TARGETS) exploded-image jdk jars \
C
chegar 已提交
481 482 483 484
    $(ALL_PROFILES) profiles docs

################################################################################

485
all: images docs
C
chegar 已提交
486 487 488 489 490 491 492 493 494 495
default: exploded-image

ALL_TARGETS += default all

################################################################################
################################################################################
#
# Clean targets
#
################################################################################
496 497
# Clean targets are automatically run serially by the Makefile calling this 
# file.
C
chegar 已提交
498 499

CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \
500
    bootcycle-build docs docstemp test make-support
C
chegar 已提交
501
CLEAN_TARGETS := $(addprefix clean-, $(CLEAN_COMPONENTS))
O
ohair 已提交
502 503

# Remove everything, except the output from configure.
C
chegar 已提交
504 505 506 507 508 509 510 511
clean: $(CLEAN_TARGETS)
	($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
	$(ECHO) Cleaned all build artifacts.

$(CLEAN_TARGETS):
	$(call CleanComponent,$(patsubst clean-%, %, $@))

clean-docs: clean-docstemp
O
ohair 已提交
512 513 514 515

# Remove everything, including configure configuration.
# If the output directory was created by configure and now becomes empty, remove it as well.
dist-clean: clean
C
chegar 已提交
516
	($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments \
I
ihse 已提交
517
	    Makefile compare.sh tmp javacservers)
C
chegar 已提交
518
	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
519 520 521
	  if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
	  else \
C
chegar 已提交
522 523
	    ($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
	        && $(RM) -r $(OUTPUT_ROOT)) \
524 525
	  fi \
	)
C
chegar 已提交
526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
	$(ECHO) Cleaned everything, you will have to re-run configure.

ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS)

################################################################################

# Setup a rule for SPEC file that fails if executed. This check makes sure the 
# configuration is up to date after changes to configure. 
ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), )
  $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
	@$(ECHO) "ERROR: $(SPEC) is not up to date."
	@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
	@$(ECHO) "'make reconfigure'."
	@$(ECHO) "It may also be ignored by setting IGNORE_OLD_CONFIG=true"
	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
endif

543 544 545
# The reconfigure target is automatically run serially from everything else
# by the Makefile calling this file.

546 547 548 549 550 551
reconfigure:
        ifneq ($(CONFIGURE_COMMAND_LINE), )
	  @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
        else
	  @$(ECHO) "Re-running configure using default settings"
        endif
552
	@( cd $(OUTPUT_ROOT) && $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
O
ohair 已提交
553

C
chegar 已提交
554 555 556 557 558 559 560 561 562 563 564
ALL_TARGETS += reconfigure

################################################################################
# Declare *-only targets for each normal target
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))

ALL_TARGETS += $(addsuffix -only, $(ALL_TARGETS))

################################################################################

.PHONY: $(ALL_TARGETS)
O
ohair 已提交
565

C
chegar 已提交
566
include $(SRC_ROOT)/make/Jprt.gmk
567

O
ohair 已提交
568
FRC: # Force target