From cb249b85903c7e505a44c24ae47346e98f3485b9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Mar 2011 15:15:36 +0200 Subject: Development build system setup --- build/bootstrap.make | 72 ++++++++++++++++++ build/export/libodb-qt/stub.make | 10 +++ build/import/libodb-qt/LICENSE | 1 + build/import/libodb-qt/configuration-rules.make | 15 ++++ build/import/libodb-qt/configure | 55 ++++++++++++++ build/import/libodb-qt/stub.make | 30 ++++++++ build/import/libodb/LICENSE | 12 +++ build/import/libodb/configuration-rules.make | 15 ++++ build/import/libodb/configure | 55 ++++++++++++++ build/import/libodb/stub.make | 30 ++++++++ makefile | 37 ++++++++++ odb/qt/details/config.h.in | 14 ++++ odb/qt/details/config.hxx | 20 +++++ odb/qt/details/export.hxx | 41 +++++++++++ odb/qt/dummy.cxx | 3 + odb/qt/exception.hxx | 29 ++++++++ odb/qt/makefile | 98 +++++++++++++++++++++++++ 17 files changed, 537 insertions(+) create mode 100644 build/bootstrap.make create mode 100644 build/export/libodb-qt/stub.make create mode 120000 build/import/libodb-qt/LICENSE create mode 100644 build/import/libodb-qt/configuration-rules.make create mode 100755 build/import/libodb-qt/configure create mode 100644 build/import/libodb-qt/stub.make create mode 100644 build/import/libodb/LICENSE create mode 100644 build/import/libodb/configuration-rules.make create mode 100755 build/import/libodb/configure create mode 100644 build/import/libodb/stub.make create mode 100644 makefile create mode 100644 odb/qt/details/config.h.in create mode 100644 odb/qt/details/config.hxx create mode 100644 odb/qt/details/export.hxx create mode 100644 odb/qt/dummy.cxx create mode 100644 odb/qt/exception.hxx create mode 100644 odb/qt/makefile diff --git a/build/bootstrap.make b/build/bootstrap.make new file mode 100644 index 0000000..a6976c6 --- /dev/null +++ b/build/bootstrap.make @@ -0,0 +1,72 @@ +# file : build/bootstrap.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +project_name := libodb-qt + +# 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 + + +# Aliases +# +.PHONY: $(out_base)/ \ + $(out_base)/.test \ + $(out_base)/.dist \ + $(out_base)/.clean + +ifdef %interactive% + +.PHONY: test dist clean + +test: $(out_base)/.test +dist: $(out_base)/.dist +clean: $(out_base)/.clean + +ifneq ($(filter $(.DEFAULT_GOAL),test dist clean),) +.DEFAULT_GOAL := +endif + +endif + +# Make sure the distribution prefix is set if the goal is dist. +# +ifneq ($(filter $(MAKECMDGOALS),dist),) +ifeq ($(dist_prefix),) +$(error dist_prefix is not set) +endif +endif + +# If we don't have dependency auto-generation then we need to manually +# make sure that generated 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 dist),) +include-dep = +endif diff --git a/build/export/libodb-qt/stub.make b/build/export/libodb-qt/stub.make new file mode 100644 index 0000000..6ec954e --- /dev/null +++ b/build/export/libodb-qt/stub.make @@ -0,0 +1,10 @@ +# file : build/export/libodb-qt/stub.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(src_root)/odb/qt/makefile,$(out_root)) + +$(call export,\ + l: $(out_root)/odb/qt/odb-qt.l,\ + cpp-options: $(out_root)/odb/qt/odb-qt.l.cpp-options) diff --git a/build/import/libodb-qt/LICENSE b/build/import/libodb-qt/LICENSE new file mode 120000 index 0000000..5853aae --- /dev/null +++ b/build/import/libodb-qt/LICENSE @@ -0,0 +1 @@ +../../../LICENSE \ No newline at end of file diff --git a/build/import/libodb-qt/configuration-rules.make b/build/import/libodb-qt/configuration-rules.make new file mode 100644 index 0000000..1116405 --- /dev/null +++ b/build/import/libodb-qt/configuration-rules.make @@ -0,0 +1,15 @@ +# file : build/import/libodb-qt/configuration-rules.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(dcf_root)/import/libodb-qt/configuration-dynamic.make: | $(dcf_root)/import/libodb-qt/. + $(call message,,$(scf_root)/import/libodb-qt/configure $@) + +ifndef %foreign% + +$(dcf_root)/.disfigure:: + $(call message,rm $(dcf_root)/import/libodb-qt/configuration-dynamic.make,\ +rm -f $(dcf_root)/import/libodb-qt/configuration-dynamic.make) + +endif diff --git a/build/import/libodb-qt/configure b/build/import/libodb-qt/configure new file mode 100755 index 0000000..16d09fc --- /dev/null +++ b/build/import/libodb-qt/configure @@ -0,0 +1,55 @@ +#! /usr/bin/env bash + +# file : build/import/libodb-qt/configure +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 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 "Configuring external dependency on 'libodb-qt' for '$project_name'." +$echo + +$echo +$echo "Would you like to configure dependency on the installed version" +$echo "of 'libodb-qt' as opposed to the development build?" +$echo + +installed=`read_y_n y` + +path= + +if [ "$installed" = "n" ]; then + +$echo +$echo "Please enter the src_root for 'libodb-qt'." +$echo + +src_root=`read_path --directory --exist` + +$echo +$echo "Please enter the out_root for 'libodb-qt'." +$echo + +out_root=`read_path --directory $src_root` + +fi + +echo libodb_qt_installed := $installed >$1 + +if [ "$installed" = "n" ]; then + +echo src_root := $src_root >>$1 +echo scf_root := \$\(src_root\)/build >>$1 +echo out_root := $out_root >>$1 + +fi diff --git a/build/import/libodb-qt/stub.make b/build/import/libodb-qt/stub.make new file mode 100644 index 0000000..fe6060d --- /dev/null +++ b/build/import/libodb-qt/stub.make @@ -0,0 +1,30 @@ +# file : build/import/libodb-qt/stub.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(scf_root)/import/libodb-qt/configuration-rules.make,$(dcf_root)) + +libodb_qt_installed := + +$(call -include,$(dcf_root)/import/libodb-qt/configuration-dynamic.make) + +ifdef libodb_qt_installed + +ifeq ($(libodb_qt_installed),y) + +$(call export,l: -lodb-qt -lodb,cpp-options: ) + +else + +# Include export stub. +# +$(call include,$(scf_root)/export/libodb-qt/stub.make) + +endif + +else + +.NOTPARALLEL: + +endif diff --git a/build/import/libodb/LICENSE b/build/import/libodb/LICENSE new file mode 100644 index 0000000..ed9c55c --- /dev/null +++ b/build/import/libodb/LICENSE @@ -0,0 +1,12 @@ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License version 2 as +published by the Free Software Foundation. + +This program 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 for details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA diff --git a/build/import/libodb/configuration-rules.make b/build/import/libodb/configuration-rules.make new file mode 100644 index 0000000..9263bb0 --- /dev/null +++ b/build/import/libodb/configuration-rules.make @@ -0,0 +1,15 @@ +# file : build/import/libodb/configuration-rules.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(dcf_root)/import/libodb/configuration-dynamic.make: | $(dcf_root)/import/libodb/. + $(call message,,$(scf_root)/import/libodb/configure $@) + +ifndef %foreign% + +$(dcf_root)/.disfigure:: + $(call message,rm $(dcf_root)/import/libodb/configuration-dynamic.make,\ +rm -f $(dcf_root)/import/libodb/configuration-dynamic.make) + +endif diff --git a/build/import/libodb/configure b/build/import/libodb/configure new file mode 100755 index 0000000..90e21d4 --- /dev/null +++ b/build/import/libodb/configure @@ -0,0 +1,55 @@ +#! /usr/bin/env bash + +# file : build/import/libodb/configure +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 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 "Configuring external dependency on 'libodb' for '$project_name'." +$echo + +$echo +$echo "Would you like to configure dependency on the installed " +$echo "version of 'libodb' as opposed to the development build?" +$echo + +installed=`read_y_n y` + +path= + +if [ "$installed" = "n" ]; then + +$echo +$echo "Please enter the src_root for 'libodb'." +$echo + +src_root=`read_path --directory --exist` + +$echo +$echo "Please enter the out_root for 'libodb'." +$echo + +out_root=`read_path --directory $src_root` + +fi + +echo libodb_installed := $installed >$1 + +if [ "$installed" = "n" ]; then + +echo src_root := $src_root >>$1 +echo scf_root := \$\(src_root\)/build >>$1 +echo out_root := $out_root >>$1 + +fi diff --git a/build/import/libodb/stub.make b/build/import/libodb/stub.make new file mode 100644 index 0000000..97bb5ff --- /dev/null +++ b/build/import/libodb/stub.make @@ -0,0 +1,30 @@ +# file : build/import/libodb/stub.make +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +$(call include-once,$(scf_root)/import/libodb/configuration-rules.make,$(dcf_root)) + +libodb_installed := + +$(call -include,$(dcf_root)/import/libodb/configuration-dynamic.make) + +ifdef libodb_installed + +ifeq ($(libodb_installed),y) + +$(call export,l: -lodb,cpp-options: ) + +else + +# Include export stub. +# +$(call include,$(scf_root)/export/libodb/stub.make) + +endif + +else + +.NOTPARALLEL: + +endif diff --git a/makefile b/makefile new file mode 100644 index 0000000..68f0626 --- /dev/null +++ b/makefile @@ -0,0 +1,37 @@ +# file : makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))build/bootstrap.make + +dirs := odb/qt + +default := $(out_base)/ +dist := $(out_base)/.dist +clean := $(out_base)/.clean + +$(default): $(addprefix $(out_base)/,$(addsuffix /,$(dirs))) + +$(dist): export dirs := $(dirs) +$(dist): export docs := GPLv2 LICENSE README NEWS version +$(dist): export options := odb/qt.options +$(dist): data_dist := INSTALL libodb-qt-vc9.sln libodb-qt-vc10.sln +$(dist): exec_dist := bootstrap +$(dist): export extra_dist := $(data_dist) $(exec_dist) +$(dist): export version = $(shell cat $(src_root)/version) + +$(dist): $(addprefix $(out_base)/,$(addsuffix /.dist,$(dirs))) + $(call dist-data,$(docs) $(options) $(data_dist) libodb-qt.pc.in) + $(call dist-exec,$(exec_dist)) + $(call dist-dir,m4) + $(call meta-automake) + $(call meta-autoconf) + +$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(dirs))) + +$(call include,$(bld_root)/dist.make) +$(call include,$(bld_root)/meta/automake.make) +$(call include,$(bld_root)/meta/autoconf.make) + +$(foreach d,$(dirs),$(call import,$(src_base)/$d/makefile)) diff --git a/odb/qt/details/config.h.in b/odb/qt/details/config.h.in new file mode 100644 index 0000000..dd440c5 --- /dev/null +++ b/odb/qt/details/config.h.in @@ -0,0 +1,14 @@ +/* file : odb/qt/details/config.h.in + * author : Boris Kolpackov + * copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC + * license : GNU GPL v2; see accompanying LICENSE file + */ + +/* This file is automatically processed by configure. */ + +#ifndef ODB_QT_DETAILS_CONFIG_H +#define ODB_QT_DETAILS_CONFIG_H + +#undef LIBODB_QT_STATIC_LIB + +#endif /* ODB_QT_DETAILS_CONFIG_H */ diff --git a/odb/qt/details/config.hxx b/odb/qt/details/config.hxx new file mode 100644 index 0000000..586312c --- /dev/null +++ b/odb/qt/details/config.hxx @@ -0,0 +1,20 @@ +// file : odb/qt/details/config.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_QT_DETAILS_CONFIG_HXX +#define ODB_QT_DETAILS_CONFIG_HXX + +// no pre + +#ifdef _MSC_VER +#elif defined(ODB_COMPILER) +# define LIBODB_QT_STATIC_LIB +#else +# include +#endif + +// no post + +#endif // ODB_QT_DETAILS_CONFIG_HXX diff --git a/odb/qt/details/export.hxx b/odb/qt/details/export.hxx new file mode 100644 index 0000000..cc4ea4c --- /dev/null +++ b/odb/qt/details/export.hxx @@ -0,0 +1,41 @@ +// file : odb/qt/details/export.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_QT_DETAILS_EXPORT_HXX +#define ODB_QT_DETAILS_EXPORT_HXX + +#include + +#include + +#ifdef LIBODB_QT_STATIC_LIB +# define LIBODB_QT_EXPORT +#else +# ifdef _WIN32 +# ifdef _MSC_VER +# ifdef LIBODB_QT_DYNAMIC_LIB +# define LIBODB_QT_EXPORT __declspec(dllexport) +# else +# define LIBODB_QT_EXPORT __declspec(dllimport) +# endif +# else +# ifdef LIBODB_QT_DYNAMIC_LIB +# ifdef DLL_EXPORT +# define LIBODB_QT_EXPORT __declspec(dllexport) +# else +# define LIBODB_QT_EXPORT +# endif +# else +# define LIBODB_QT_EXPORT __declspec(dllimport) +# endif +# endif +# else +# define LIBODB_QT_EXPORT +# endif +#endif + +#include + +#endif // ODB_QT_DETAILS_EXPORT_HXX diff --git a/odb/qt/dummy.cxx b/odb/qt/dummy.cxx new file mode 100644 index 0000000..abf4e34 --- /dev/null +++ b/odb/qt/dummy.cxx @@ -0,0 +1,3 @@ +#include + +void dummy () {} diff --git a/odb/qt/exception.hxx b/odb/qt/exception.hxx new file mode 100644 index 0000000..6bf0699 --- /dev/null +++ b/odb/qt/exception.hxx @@ -0,0 +1,29 @@ +// file : odb/qt/exception.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_QT_EXCEPTION_HXX +#define ODB_QT_EXCEPTION_HXX + +#include + +#include + +#include + +namespace odb +{ + namespace qt + { + struct LIBODB_QT_EXPORT exception: odb::exception + { + virtual const char* + what () const throw () = 0; + }; + } +} + +#include + +#endif // ODB_QT_EXCEPTION_HXX diff --git a/odb/qt/makefile b/odb/qt/makefile new file mode 100644 index 0000000..888f66a --- /dev/null +++ b/odb/qt/makefile @@ -0,0 +1,98 @@ +# file : odb/qt/makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make + +cxx := dummy.cxx + +cxx_tun := $(cxx) +cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) +cxx_od := $(cxx_obj:.o=.o.d) + +odb_qt.l := $(out_base)/odb-qt.l +odb_qt.l.cpp-options := $(out_base)/odb-qt.l.cpp-options + +default := $(out_base)/ +dist := $(out_base)/.dist +clean := $(out_base)/.clean + +# Import. +# +$(call import,\ + $(scf_root)/import/libodb/stub.make,\ + l: odb.l,cpp-options: odb.l.cpp-options) + +# Build. +# +$(odb_qt.l): $(cxx_obj) $(odb.l) +$(odb_qt.l.cpp-options): value := -I$(out_root) -I$(src_root) +$(odb_qt.l.cpp-options): $(odb.l.cpp-options) + +$(cxx_obj) $(cxx_od): $(odb_qt.l.cpp-options) $(out_base)/details/config.h + +$(out_base)/details/config.h: + @echo '/* file : odb/qt/details/config.h' >$@ + @echo ' * author : automatically generated' >>$@ + @echo ' */' >>$@ + @echo '' >>$@ + @echo '#ifndef ODB_QT_DETAILS_CONFIG_H' >>$@ + @echo '#define ODB_QT_DETAILS_CONFIG_H' >>$@ + @echo '' >>$@ + @echo '' >>$@ + @echo '#endif /* ODB_QT_DETAILS_CONFIG_H */' >>$@ + +$(call include-dep,$(cxx_od),$(cxx_obj),$(out_base)/details/config.h) + +# Convenience alias for default target. +# +$(out_base)/: $(odb_qt.l) + +# Dist. +# +$(dist): export sources := $(cxx) +$(dist): export headers = $(subst $(src_base)/,,$(shell find $(src_base) \ +-name '*.hxx' -o -name '*.ixx' -o -name '*.txx')) +$(dist): export options = $(subst $(src_base)/,,$(shell find $(src_base) \ +-name '*.options')) +$(dist): export extra_dist := libodb-qt-vc9.vcproj \ +libodb-qt-vc10.vcxproj libodb-qt-vc10.vcxproj.filters +$(dist): export interface_version = $(shell sed -e \ +'s/^\([0-9]*\.[0-9]*\).*/\1/' $(src_root)/version) + +$(dist): + $(call dist-data,$(sources) $(headers) $(options) details/config.h.in) + $(call meta-vc9proj,libodb-qt-vc9.vcproj) + $(call meta-vc10proj,libodb-qt-vc10.vcxproj) + $(call meta-automake) + +# Clean. +# +$(clean): $(odb_qt.l).o.clean \ + $(odb_qt.l.cpp-options).clean \ + $(addsuffix .cxx.clean,$(cxx_obj)) \ + $(addsuffix .cxx.clean,$(cxx_od)) + $(call message,rm $$1,rm -f $$1,$(out_base)/details/config.h) + +# Generated .gitignore. +# +ifeq ($(out_base),$(src_base)) +$(odb_qt.l): | $(out_base)/.gitignore + +$(out_base)/.gitignore: files := details/config.h +$(clean): $(out_base)/.gitignore.clean + +$(call include,$(bld_root)/git/gitignore.make) +endif + +# How to. +# +$(call include,$(bld_root)/dist.make) +$(call include,$(bld_root)/meta/vc9proj.make) +$(call include,$(bld_root)/meta/vc10proj.make) +$(call include,$(bld_root)/meta/automake.make) + +$(call include,$(bld_root)/cxx/o-l.make) +$(call include,$(bld_root)/cxx/cxx-o.make) +$(call include,$(bld_root)/cxx/cxx-d.make) -- cgit v1.1