Permalink
Browse files

[enhance] build: moved config files in tools/build

  • Loading branch information...
1 parent 148033d commit 94ed07bc41f38afd765dc133dd81121d91d6d172 @Aqua-Ye Aqua-Ye committed Jul 10, 2012
Showing with 31 additions and 23 deletions.
  1. +4 −2 Makefile
  2. +15 −14 configure
  3. +4 −2 tools/build/Makefile.bld
  4. 0 { → tools/build}/config.mli
  5. +8 −5 tools/build/gen_myocamlbuild.sh
View
@@ -10,8 +10,10 @@
.PHONY: default
default: all
+CONFIG_PATH = tools/build
+
# Makefile inclusions
-include config.make
+include $(CONFIG_PATH)/config.make
include tools/build/Makefile.bld
MAKE ?= $_
@@ -246,7 +248,7 @@ install-bld:
@echo "BLDDIR=$(PREFIX)/share/opa/bld $(PREFIX)/share/opa/bld/gen_myocamlbuild.sh" >> $(INSTALL_DIR)/bin/bld
@echo "_build/myocamlbuild -no-plugin $(OCAMLBUILD_OPT) \"\$$@\"" >> $(INSTALL_DIR)/bin/bld
@mkdir -p $(INSTALL_DIR)/share/opa/bld
- @$(INSTALL) build/gen_myocamlbuild.sh build/myocamlbuild_*fix.ml config.sh config.mli config.ml\
+ @$(INSTALL) build/gen_myocamlbuild.sh build/myocamlbuild_*fix.ml $(CONFIG_PATH)/config.sh $(CONFIG_PATH)/config.mli $(CONFIG_PATH)/config.ml\
$(INSTALL_DIR)/share/opa/bld
# Install an opa wrapper with different stdlib and options (for some backwards-compatibility)
View
@@ -93,18 +93,19 @@ done
: ${IS_RELEASE:=}
: ${LIBDIR:=$PREFIX}
-CONFIG_LOG=$PWD/config.log
+CONFIG_PATH=`pwd`/tools/build
+CONFIG_LOG=$CONFIG_PATH/config.log
-echo -n >$CONFIG_LOG
+echo -n > $CONFIG_LOG
-echo-check() { echo -n "Checking $*... " >&2 ; echo "# CHECK-START: $*" >>$CONFIG_LOG; }
+echo-check() { echo -n "Checking $*... " >&2 ; echo "# CHECK-START: $*" >> $CONFIG_LOG; }
echo-ok() {
local opts=; if [ "X$1" = "X-n" ]; then shift; opts="-n"; fi
- echo $opts "[1m$*[0m" >&2 ; echo $opts -e "# CHECK-OK: $*\n" >>$CONFIG_LOG;
+ echo $opts "[1m$*[0m" >&2 ; echo $opts -e "# CHECK-OK: $*\n" >> $CONFIG_LOG;
}
-echo-ok-tag() { echo "[1m[32mOK[0m" >&2 ; echo -e "# CHECK-OK\n" >>$CONFIG_LOG; }
-echo-err() { echo "[1m[31m$*[0m" >&2 ; echo -e "# CHECK-FAIL: $*\n" >>$CONFIG_LOG; }
-echo-skip() { echo "[1m[33m$*[0m" >&2 ; echo -e "# CHECK-SKIP: $*\n" >>$CONFIG_LOG; }
+echo-ok-tag() { echo "[1m[32mOK[0m" >&2 ; echo -e "# CHECK-OK\n" >> $CONFIG_LOG; }
+echo-err() { echo "[1m[31m$*[0m" >&2 ; echo -e "# CHECK-FAIL: $*\n" >> $CONFIG_LOG; }
+echo-skip() { echo "[1m[33m$*[0m" >&2 ; echo -e "# CHECK-SKIP: $*\n" >> $CONFIG_LOG; }
# check OS
echo-check your OS
@@ -242,15 +243,15 @@ check-ocaml () {
local DIR=$(mktemp -d /tmp/opa-configure.XXXXX)
trap "rm -rf /tmp/${DIR#/tmp/}" EXIT
cd $DIR
- cat >test.ml <<EOF
+ cat > test.ml <<EOF
let p = Unix.getpid()
let _ = Printf.printf "%s, %s %dbit" Sys.ocaml_version Sys.os_type Sys.word_size
let _ =
exit Sys.word_size
EOF
echo "# $OCAMLBUILD $OCAMLBUILD_FLAGS -tag use_unix test.native" >> $CONFIG_LOG
- R=0; $OCAMLBUILD $OCAMLBUILD_FLAGS -tag use_unix test.native >test.log 2>&1 || R=$?
+ R=0; $OCAMLBUILD $OCAMLBUILD_FLAGS -tag use_unix test.native > test.log 2>&1 || R=$?
cat test.log >> $CONFIG_LOG
@@ -713,7 +714,7 @@ for tag in $ALL_TAGS_LIST; do
done
# See config.mli for the documentation and spec of these variables
-cat >config.ml <<EOF
+cat > $CONFIG_PATH/config.ml <<EOF
let prefix = "$PREFIX"
let lib_dir = "$LIBDIR"
let ocamllib = "$OCAMLLIB"
@@ -762,7 +763,7 @@ let ext_shared = "$EXT_SHARED"
EOF
-cat >config.sh <<EOF
+cat > $CONFIG_PATH/config.sh <<EOF
PREFIX="$PREFIX"
LIBDIR="$LIBDIR"
OCAMLLIB="$OCAMLLIB"
@@ -806,11 +807,11 @@ EXT_OBJ="$EXT_OBJ"
EXT_SHARED="$EXT_SHARED"
EOF
-sed 's/=["(]\(.*\)[)"]$/ := \1/' config.sh > config.make
+sed 's/=["(]\(.*\)[)"]$/ := \1/' $CONFIG_PATH/config.sh > $CONFIG_PATH/config.make
if [ -n "${IS_MAC:-}" ]; then
- echo "INSTALL := gcp -u -L" >>config.make
+ echo "INSTALL := gcp -u -L" >> $CONFIG_PATH/config.make
elif [ -n "${IS_FREEBSD:-}" ]; then
- echo "INSTALL := cp" >>config.make
+ echo "INSTALL := cp" >> $CONFIG_PATH/config.make
fi
{
View
@@ -47,13 +47,15 @@ DESTDIR ?=
INSTALL_DIR = $(DESTDIR)$(PREFIX)
LIB_INSTALL_DIR = $(INSTALL_DIR)/lib/opa/static
+CONFIG_PATH = tools/build
+
.PHONY: clean
clean::
rm -rf _build/*
.PHONY: distclean
distclean: clean
- rm -f config.sh config.ml config.make config.log
+ rm -f $(CONFIG_PATH)/config.sh $(CONFIG_PATH)/config.ml $(CONFIG_PATH)/config.make $(CONFIG_PATH)/config.log
-include $(BUILD_DIR)/build_libs.make
@@ -69,7 +71,7 @@ else
BUILD_TOOLS := $(BLDDIR)/build_tools
endif
-MYOCAMLBUILD_SOURCES = $(BLDDIR)/gen_myocamlbuild.sh $(BLDDIR)/myocamlbuild_prefix.ml $(BLDDIR)/myocamlbuild_suffix.ml config.ml $(BUILD_RULES) $(BUILD_LIBS) $(BUILD_TOOLS)
+MYOCAMLBUILD_SOURCES = $(BLDDIR)/gen_myocamlbuild.sh $(BLDDIR)/myocamlbuild_prefix.ml $(BLDDIR)/myocamlbuild_suffix.ml $(CONFIG_PATH)/config.ml $(BUILD_RULES) $(BUILD_LIBS) $(BUILD_TOOLS)
$(MYOCAMLBUILD): $(MYOCAMLBUILD_SOURCES)
@echo "Ocamlbuild plugin generation"
File renamed without changes.
@@ -3,16 +3,19 @@
set -u
set -e
-# This script reads files config.{sh,ml}, build_rules*.ml, build_libs, build_tools and uses them
+# This script reads files config.{sh,ml}, build_rules*.ml, build_libs, build_tools
+# in tools/build/ and uses them
# to build an ocamlbuild plugin in <build_dir>/myocamlbuild
#
# You can then run your compilations with:
# $ <build_dir>/myocamlbuild -no-plugin -j 6 <targets>
-CONFIG_SH=config.sh
+CONFIG_PATH=tools/build
+
+CONFIG_SH=$CONFIG_PATH/config.sh
if [ ! -e $CONFIG_SH ]; then
- if [ -e $(dirname "$0")/config.sh ]; then
- CONFIG_SH=$(dirname "$0")/config.sh
+ if [ -e $CONFIG_PATH/config.sh ]; then
+ CONFIG_SH=$CONFIG_PATH/config.sh
else
echo "Error: config.sh not found. Please run ./configure"
exit 1
@@ -25,7 +28,7 @@ fi
: ${BLDDIR:="$PWD"/tools/build}
-CONFIG_ML=config.ml
+CONFIG_ML=$CONFIG_PATH/config.ml
if [ ! -e $CONFIG_ML ]; then
echo $BLDDIR/config.ml >&2
if [ -e $BLDDIR/config.ml ]; then

0 comments on commit 94ed07b

Please sign in to comment.