Improvements to libjs makefile: only reconfigure/rebuild when necessary.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4384 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Michael Werle 2011-02-20 10:09:29 +00:00
parent 79949f2eba
commit a2790a34da

View File

@ -1,8 +1,14 @@
# #
# This makefile is used to build the Javascript dependency for Oolite # This makefile is used to build the Javascript dependency for Oolite
# #
# It can be used to make both a release Javascript library and a # This Makefile is used to download and build the Javascript library
# debug library. # for use by Oolite.
# Depending on invocation, a debug or release (default) version of the
# library will be built.
#
# To use:
# $ make -f libjs.make debug=(yes|no)
include config.make include config.make
LIBJS_SRC_DIR = deps/Cross-platform-deps/mozilla/js/src LIBJS_SRC_DIR = deps/Cross-platform-deps/mozilla/js/src
@ -13,7 +19,7 @@ ifeq ($(OO_JAVASCRIPT_TRACE),yes)
LIBJS_CONFIG_FLAGS += --enable-trace-jscalls LIBJS_CONFIG_FLAGS += --enable-trace-jscalls
endif endif
ifeq ($(debug),yes) ifeq ($(debug),yes)
LIBJS_BUILD_DIR=$(LIBJS_SRC_DIR)/build-debug LIBJS_BUILD_DIR = $(LIBJS_SRC_DIR)/build-debug
LIBJS_CONFIG_FLAGS += --enable-debug LIBJS_CONFIG_FLAGS += --enable-debug
LIBJS_CONFIG_FLAGS += --disable-optimize LIBJS_CONFIG_FLAGS += --disable-optimize
LIBJS_BUILD_FLAGS = LIBJS_BUILD_FLAGS =
@ -22,20 +28,46 @@ else
LIBJS_BUILD_FLAGS = LIBJS_BUILD_FLAGS =
endif endif
LIBJS = $(LIBJS_BUILD_DIR)/libjs_static.a LIBJS = $(LIBJS_BUILD_DIR)/libjs_static.a
LIBJS_BUILD_STAMP = $(LIBJS_BUILD_DIR)/build_stamp
LIBJS_CONFIG = $(LIBJS_BUILD_DIR)/config.status
LIBJS_CONFIG_STAMP = $(LIBJS_BUILD_DIR)/config_stamp
$(LIBJS): LIBJS_SRC
.PHONY: all
all: LIBJS_SRC $(LIBJS)
$(LIBJS): $(LIBJS_BUILD_STAMP)
$(LIBJS_BUILD_STAMP): $(LIBJS_CONFIG_STAMP)
@echo @echo
@echo "Building Javascript library..." @echo "Building Javascript library..."
@echo @echo
cd $(LIBJS_BUILD_DIR) && ../configure $(LIBJS_CONFIG_FLAGS)
make -C $(LIBJS_BUILD_DIR) $(LIBJS_BUILD_FLAGS) make -C $(LIBJS_BUILD_DIR) $(LIBJS_BUILD_FLAGS)
touch $@
$(LIBJS_CONFIG_STAMP):
@echo
@echo "Configuring Javascript library..."
@echo
cd $(LIBJS_BUILD_DIR) && ../configure $(LIBJS_CONFIG_FLAGS)
touch $@
.PHONY: LIBJS_SRC .PHONY: LIBJS_SRC
LIBJS_SRC: LIBJS_SRC:
echo "Updating Javascript sources..." @echo
@echo "Updating Javascript sources..."
@echo
cd deps/Cocoa-deps/scripts && ./update-mozilla.sh cd deps/Cocoa-deps/scripts && ./update-mozilla.sh
mkdir -p $(LIBJS_BUILD_DIR) mkdir -p $(LIBJS_BUILD_DIR)
.PHONY: clean .PHONY: clean
clean: clean:
-make -C $(LIBJS_BUILD_DIR) clean -make -C $(LIBJS_BUILD_DIR) clean
-rm -f $(LIBJS_BUILD_STAMP)
# This target also removes the configuration status, forcing
# a reconfiguration. Use this after changing LIBJS_CONFIG_FLAGS
.PHONY: distclean
distclean:
-make -C $(LIBJS_BUILD_DIR) distclean
-rm -f $(LIBJS_CONFIG_STAMP)