From 2cea0dc10d7becabf707f7b6da4c65144397257b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Jun 2010 16:51:32 +0200 Subject: Build system setup --- build/bootstrap.make | 71 ++++++++++++++++++++++++++++++++++++++ build/configuration-rules.make | 20 +++++++++++ build/configuration.make | 22 ++++++++++++ build/configure | 32 ++++++++++++++++++ build/mysql/configure | 77 ++++++++++++++++++++++++++++++++++++++++++ build/mysql/mysql | 56 ++++++++++++++++++++++++++++++ 6 files changed, 278 insertions(+) create mode 100644 build/bootstrap.make create mode 100644 build/configuration-rules.make create mode 100644 build/configuration.make create mode 100755 build/configure create mode 100755 build/mysql/configure create mode 100755 build/mysql/mysql (limited to 'build') diff --git a/build/bootstrap.make b/build/bootstrap.make new file mode 100644 index 0000000..12d3425 --- /dev/null +++ b/build/bootstrap.make @@ -0,0 +1,71 @@ +# file : build/bootstrap.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +project_name := odb-tests + +# First try to include the bundled bootstrap.make if it exist. If that +# fails, let make search for the external bootstrap.make. +# +build := build-0.3 + +-include $(dir $(lastword $(MAKEFILE_LIST)))../../$(build)/bootstrap.make + +ifeq ($(patsubst %build/bootstrap.make,,$(lastword $(MAKEFILE_LIST))),) +include $(build)/bootstrap.make +endif + +# Configuration +# +$(call include,$(scf_root)/configuration.make) + +def_goal := $(.DEFAULT_GOAL) + +# Include C++ configuration. We need to know if we are using the generic +# C++ compiler in which case we need to compensate for missing dependency +# auto-generation (see below). +# +$(call include,$(bld_root)/cxx/configuration.make) + +# Aliases +# +.PHONY: $(out_base)/ \ + $(out_base)/.test \ + $(out_base)/.clean + +ifdef %interactive% + +.PHONY: test clean + +test: $(out_base)/.test +clean: $(out_base)/.clean + +endif + +# If we don't have dependency auto-generation then we need to manually +# make sure that ODB files are generated before C++ file are compiler. +# To do this we make the object files ($2) depend in order-only on +# generated files ($3). +# +ifeq ($(cxx_id),generic) + +define include-dep +$(if $2,$(eval $2: | $3)) +endef + +else + +define include-dep +$(call -include,$1) +endef + +endif + +# Don't include dependency info for certain targets. +# +ifneq ($(filter $(MAKECMDGOALS),clean disfigure),) +include-dep = +endif + +.DEFAULT_GOAL := $(def_goal) diff --git a/build/configuration-rules.make b/build/configuration-rules.make new file mode 100644 index 0000000..19e7ef0 --- /dev/null +++ b/build/configuration-rules.make @@ -0,0 +1,20 @@ +# file : build/configuration-rules.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(dcf_root)/configuration-dynamic.make: | $(dcf_root)/. + $(call message,,$(scf_root)/configure $@) + +ifndef %foreign% + +disfigure:: + $(call message,rm $$1,rm -f $$1,$(dcf_root)/configuration-dynamic.make) + $(call message,rm $$1,rm -f $$1,$(dcf_root)/db.options) + $(call message,rm $$1,rm -f $$1,$(dcf_root)/db-driver) + +endif + +ifeq ($(.DEFAULT_GOAL),$(dcf_root)/configuration-dynamic.make) +.DEFAULT_GOAL := +endif diff --git a/build/configuration.make b/build/configuration.make new file mode 100644 index 0000000..fe27430 --- /dev/null +++ b/build/configuration.make @@ -0,0 +1,22 @@ +# file : build/configuration.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(scf_root)/configuration-rules.make,$(dcf_root)) + +# Dynamic configuration. +# +db_id := + +$(call -include,$(dcf_root)/configuration-dynamic.make) + +ifdef db_id + +$(out_root)/%: db_id := $(db_id) + +else + +.NOTPARALLEL: + +endif diff --git a/build/configure b/build/configure new file mode 100755 index 0000000..0bb1e07 --- /dev/null +++ b/build/configure @@ -0,0 +1,32 @@ +#! /usr/bin/env bash + +# file : build/configure +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# $1 out file +# +# bld_root - build root +# project_name - project name +# + +source $bld_root/dialog.bash + +$echo +$echo +$echo "configuring '$project_name'" +$echo +$echo + +$echo +$echo "Please select the database you would like to use:" +$echo +$echo "(1) MySQL" +$echo + +db_id=`read_option "mysql" "mysql"` + +echo "db_id := $db_id" >$1 + +source $scf_root/$db_id/configure diff --git a/build/mysql/configure b/build/mysql/configure new file mode 100755 index 0000000..e4bae87 --- /dev/null +++ b/build/mysql/configure @@ -0,0 +1,77 @@ +#! /usr/bin/env bash + +# file : build/mysql/configure +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# +# dcf_root - dynamic configuration root +# + +$echo +$echo "Please enter the MySQL client program path." +$echo + +driver=`read_path --command mysql` + +$echo +$echo "Please enter the MySQL database user." +$echo + +user=`read_value "odb_test"` + +$echo +$echo "Please enter the MySQL database password. Enter NULL for" +$echo "unspecified password as opposed to the empty password." +$echo + +passwd=`read_value "NULL"` + +$echo +$echo "Please enter the MySQL database name. Note that it WILL BE" +$echo "MODIFIED by the tests." +$echo + +db=`read_value "odb_test"` + +$echo +$echo "Please enter the MySQL database host." +$echo + +host=`read_value "localhost"` + +$echo +$echo "Please enter the MySQL database port." +$echo + +port=`read_value "0"` + +$echo +$echo "Please enter the MySQL database socket name. Enter NULL for" +$echo "unspecified name as opposed to the empty name." +$echo + +socket=`read_value "NULL"` + +opt=$dcf_root/db.options +drv=$dcf_root/db-driver + +echo "--user '$user'" >$opt + +if [ "$passwd" != "NULL" ]; then +echo "--passwd '$passwd'" >>$opt +fi + +echo "--db-name '$db'" >>$opt +echo "--host '$host'" >>$opt +echo "--port $port" >>$opt + +if [ "$socket" != "NULL" ]; then +echo "--socket '$socket'" >>$opt +fi + +echo "#!/bin/sh" >$drv +echo "opt=\`cat $opt\`" >>$drv +echo "eval $scf_root/mysql/mysql --driver $driver \$opt \$*" >>$drv +chmod 755 $drv diff --git a/build/mysql/mysql b/build/mysql/mysql new file mode 100755 index 0000000..766e580 --- /dev/null +++ b/build/mysql/mysql @@ -0,0 +1,56 @@ +#! /usr/bin/env bash + +# file : build/mysql/mysql +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# +# MySQL driver wrapper. +# + +while [ $# -gt 0 ]; do + case $1 in + --driver) + driver=$2 + shift 2 + ;; + --user) + opt="$opt --user=$2" + shift 2 + ;; + --passwd) + opt="$opt --password=$2" + shift 2 + ;; + --db-name) + opt="$opt --database=$2" + shift 2 + ;; + --host) + opt="$opt --host=$2" + shift 2 + ;; + --port) + opt="$opt --port=$2" + shift 2 + ;; + --socket) + opt="$opt --socket=$2" + shift 2 + ;; + *) + break + ;; + esac +done + +if [ -z "$driver" ]; then + driver=mysql +fi + +if [ -n "$1" ]; then + exec $driver $opt <$1 +else + exec $driver $opt +fi -- cgit v1.1