From c27f87feece2a8fb078c3b885fee64058949d016 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Sep 2009 07:40:03 +0200 Subject: New, makefile-based bundled build implementation --- TODO | 1 - build.sh | 117 --------------------- .../build/cxx/configuration-dynamic.make | 4 +- .../import/libcult/configuration-dynamic.make | 5 +- libcult/build/cxx/configuration-dynamic.make | 4 +- .../build/cxx/configuration-dynamic.make | 4 +- .../import/libcult/configuration-dynamic.make | 5 +- .../build/cxx/configuration-dynamic.make | 4 +- .../import/libcult/configuration-dynamic.make | 5 +- .../configuration-dynamic.make | 5 +- makefile | 72 +++++++++++++ xsd/build/cxx/configuration-dynamic.make | 4 +- .../libbackend-elements/configuration-dynamic.make | 5 +- .../import/libcult/configuration-dynamic.make | 5 +- .../libxsd-frontend/configuration-dynamic.make | 5 +- 15 files changed, 110 insertions(+), 135 deletions(-) delete mode 100644 TODO delete mode 100755 build.sh create mode 100644 makefile diff --git a/TODO b/TODO deleted file mode 100644 index 30be842..0000000 --- a/TODO +++ /dev/null @@ -1 +0,0 @@ -@@ allow changing the make executable name in build.sh (MAKE var). diff --git a/build.sh b/build.sh deleted file mode 100755 index cdc1bd2..0000000 --- a/build.sh +++ /dev/null @@ -1,117 +0,0 @@ -#! /usr/bin/env bash - -trap 'exit 1' ERR - -build=build -libcult=libcult -libfe=libfrontend-elements -libbe=libbackend-elements -libxsd_fe=libxsd-frontend -xsd=xsd - -pwd=`pwd` - -MAKEFLAGS="-I$pwd/stage/include $MAKEFLAGS" - -target=$1 - -if [ "$target" = "install" ]; then - # Since we only want to install XSD, we will handle - # this target at the end. - target= -fi - - -# build -# -if [ ! -d $pwd/stage/include/build-* ]; then - make -C $build install_prefix=$pwd/stage install -fi - - -# libcult -# -make $MAKEFLAGS -C $libcult/cult $target - -if [ "$target" = "clean" ]; then - rm -f $pwd/stage/include/cult - rm -f $pwd/stage/lib/libcult.a - rm -f $libcult/build/system/configuration-dynamic.make -else - if [ ! -d $pwd/stage/include/cult ]; then - ln -s ../../$libcult/cult stage/include/ - ln -s ../../$libcult/cult/libcult.a stage/lib/ - fi -fi - - -# libfrontend-elements -# -make $MAKEFLAGS -C $libfe/frontend-elements $target - -if [ "$target" = "clean" ]; then - rm -f $pwd/stage/include/frontend-elements - rm -f $pwd/stage/lib/libfrontend-elements.a -else - if [ ! -d $pwd/stage/include/frontend-elements ]; then - ln -s ../../$libfe/frontend-elements stage/include/ - ln -s ../../$libfe/frontend-elements/libfrontend-elements.a stage/lib/ - fi -fi - - -# libbackend-elements -# -make $MAKEFLAGS -C $libbe/backend-elements $target - -if [ "$target" = "clean" ]; then - rm -f $pwd/stage/include/backend-elements -else - if [ ! -d $pwd/stage/include/backend-elements ]; then - ln -s ../../$libbe/backend-elements stage/include/ - fi -fi - - -# libxsd-frontend -# -make $MAKEFLAGS -C $libxsd_fe/xsd-frontend $target - -if [ "$target" = "clean" ]; then - rm -f $pwd/stage/include/xsd-frontend - rm -f $pwd/stage/lib/libxsd-frontend.a -else - if [ ! -d $pwd/stage/include/xsd-frontend ]; then - ln -s ../../$libxsd_fe/xsd-frontend stage/include/ - ln -s ../../$libxsd_fe/xsd-frontend/libxsd-frontend.a stage/lib/ - fi -fi - - -# xsd -# -if [ "$target" = "clean" ]; then - make $MAKEFLAGS -C $xsd clean -else - make $MAKEFLAGS -C $xsd/xsd $target -fi - -if [ "$target" = "clean" ]; then - rm -f $pwd/stage/include/xsd - rm -f $pwd/stage/bin/xsd -else - if [ ! -d $pwd/stage/include/xsd ]; then - ln -s ../../$xsd/libxsd/xsd stage/include/ - ln -s ../../$xsd/xsd/xsd stage/bin/ - fi -fi - -if [ "$1" = "install" ]; then -make $MAKEFLAGS -C $xsd install -fi - -# build (clean) -# -if [ "$target" = "clean" ]; then - rm -rf $pwd/stage/include/build-* -fi diff --git a/libbackend-elements/build/cxx/configuration-dynamic.make b/libbackend-elements/build/cxx/configuration-dynamic.make index 7485fe9..568ab40 100644 --- a/libbackend-elements/build/cxx/configuration-dynamic.make +++ b/libbackend-elements/build/cxx/configuration-dynamic.make @@ -2,7 +2,7 @@ cxx_id := gnu cxx_optimize := n cxx_debug := n cxx_rpath := n -cxx_pp_extra_options := $(CPPFLAGS) -I$(out_root)/../stage/include +cxx_pp_extra_options := $(CPPFLAGS) cxx_extra_options := $(CXXFLAGS) cxx_ld_extra_options := $(LDFLAGS) cxx_extra_libs := $(LIBS) @@ -11,4 +11,4 @@ r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g') r := $(patsubst -L%,%,$(filter -L%,$(r))) r := $(shell echo $(r) | sed -e 's/ /:/g') -cxx_extra_lib_paths := $(out_root)/../stage/lib $(r) +cxx_extra_lib_paths := $(r) diff --git a/libbackend-elements/build/import/libcult/configuration-dynamic.make b/libbackend-elements/build/import/libcult/configuration-dynamic.make index 78c41d3..73c92bb 100644 --- a/libbackend-elements/build/import/libcult/configuration-dynamic.make +++ b/libbackend-elements/build/import/libcult/configuration-dynamic.make @@ -1 +1,4 @@ -libcult_installed := y +libcult_installed := n +src_root := $(abspath $(src_root)/../libcult) +scf_root := $(src_root)/build +out_root := $(src_root) diff --git a/libcult/build/cxx/configuration-dynamic.make b/libcult/build/cxx/configuration-dynamic.make index 7485fe9..568ab40 100644 --- a/libcult/build/cxx/configuration-dynamic.make +++ b/libcult/build/cxx/configuration-dynamic.make @@ -2,7 +2,7 @@ cxx_id := gnu cxx_optimize := n cxx_debug := n cxx_rpath := n -cxx_pp_extra_options := $(CPPFLAGS) -I$(out_root)/../stage/include +cxx_pp_extra_options := $(CPPFLAGS) cxx_extra_options := $(CXXFLAGS) cxx_ld_extra_options := $(LDFLAGS) cxx_extra_libs := $(LIBS) @@ -11,4 +11,4 @@ r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g') r := $(patsubst -L%,%,$(filter -L%,$(r))) r := $(shell echo $(r) | sed -e 's/ /:/g') -cxx_extra_lib_paths := $(out_root)/../stage/lib $(r) +cxx_extra_lib_paths := $(r) diff --git a/libfrontend-elements/build/cxx/configuration-dynamic.make b/libfrontend-elements/build/cxx/configuration-dynamic.make index 7485fe9..568ab40 100644 --- a/libfrontend-elements/build/cxx/configuration-dynamic.make +++ b/libfrontend-elements/build/cxx/configuration-dynamic.make @@ -2,7 +2,7 @@ cxx_id := gnu cxx_optimize := n cxx_debug := n cxx_rpath := n -cxx_pp_extra_options := $(CPPFLAGS) -I$(out_root)/../stage/include +cxx_pp_extra_options := $(CPPFLAGS) cxx_extra_options := $(CXXFLAGS) cxx_ld_extra_options := $(LDFLAGS) cxx_extra_libs := $(LIBS) @@ -11,4 +11,4 @@ r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g') r := $(patsubst -L%,%,$(filter -L%,$(r))) r := $(shell echo $(r) | sed -e 's/ /:/g') -cxx_extra_lib_paths := $(out_root)/../stage/lib $(r) +cxx_extra_lib_paths := $(r) diff --git a/libfrontend-elements/build/import/libcult/configuration-dynamic.make b/libfrontend-elements/build/import/libcult/configuration-dynamic.make index 78c41d3..73c92bb 100644 --- a/libfrontend-elements/build/import/libcult/configuration-dynamic.make +++ b/libfrontend-elements/build/import/libcult/configuration-dynamic.make @@ -1 +1,4 @@ -libcult_installed := y +libcult_installed := n +src_root := $(abspath $(src_root)/../libcult) +scf_root := $(src_root)/build +out_root := $(src_root) diff --git a/libxsd-frontend/build/cxx/configuration-dynamic.make b/libxsd-frontend/build/cxx/configuration-dynamic.make index 7485fe9..568ab40 100644 --- a/libxsd-frontend/build/cxx/configuration-dynamic.make +++ b/libxsd-frontend/build/cxx/configuration-dynamic.make @@ -2,7 +2,7 @@ cxx_id := gnu cxx_optimize := n cxx_debug := n cxx_rpath := n -cxx_pp_extra_options := $(CPPFLAGS) -I$(out_root)/../stage/include +cxx_pp_extra_options := $(CPPFLAGS) cxx_extra_options := $(CXXFLAGS) cxx_ld_extra_options := $(LDFLAGS) cxx_extra_libs := $(LIBS) @@ -11,4 +11,4 @@ r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g') r := $(patsubst -L%,%,$(filter -L%,$(r))) r := $(shell echo $(r) | sed -e 's/ /:/g') -cxx_extra_lib_paths := $(out_root)/../stage/lib $(r) +cxx_extra_lib_paths := $(r) diff --git a/libxsd-frontend/build/import/libcult/configuration-dynamic.make b/libxsd-frontend/build/import/libcult/configuration-dynamic.make index 78c41d3..73c92bb 100644 --- a/libxsd-frontend/build/import/libcult/configuration-dynamic.make +++ b/libxsd-frontend/build/import/libcult/configuration-dynamic.make @@ -1 +1,4 @@ -libcult_installed := y +libcult_installed := n +src_root := $(abspath $(src_root)/../libcult) +scf_root := $(src_root)/build +out_root := $(src_root) diff --git a/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make b/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make index 6583182..70d0da6 100644 --- a/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make +++ b/libxsd-frontend/build/import/libfrontend-elements/configuration-dynamic.make @@ -1 +1,4 @@ -libfrontend_elements_installed := y +libfrontend_elements_installed := n +src_root := $(abspath $(src_root)/../libfrontend-elements) +scf_root := $(src_root)/build +out_root := $(src_root) diff --git a/makefile b/makefile new file mode 100644 index 0000000..74722c0 --- /dev/null +++ b/makefile @@ -0,0 +1,72 @@ +# file : makefile +# author : Boris Kolpackov +# copyright : Copyright (c) 2009 Code Synthesis Tools CC +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +include $(dir $(lastword $(MAKEFILE_LIST)))/build-0.3/bootstrap.make + +default := $(out_base)/ + +.PHONY: $(default) test install clean + +# Build. +# +$(default): $(out_base)/xsd/xsd/ + +# Test. +# +test: $(out_base)/xsd/.test + +# Install. +# +install: $(out_base)/xsd/.install + +# Clean. +# +clean: $(out_base)/libcult/.clean \ + $(out_base)/libfrontend-elements/.clean \ + $(out_base)/libbackend-elements/.clean \ + $(out_base)/libxsd-frontend/.clean \ + $(out_base)/xsd/.clean + +# Reset pattern-specific variables because GNU make will use the +# first match instead of the most specific match. Here out_root +# and out_base are the same. +# +$(out_root)/%: out_root := +$(out_root)/%: out_base := +$(out_root)/%: src_root := +$(out_root)/%: src_base := +$(out_root)/%: scf_root := +$(out_root)/%: dcf_root := +$(out_root)/%: project_name := + +src_root := $(src_base)/libcult +scf_root := $(src_root)/build +out_root := $(src_root) +$(call import,$(src_base)/libcult/makefile) + +src_root := $(src_base)/libfrontend-elements +scf_root := $(src_root)/build +out_root := $(src_root) +$(call import,$(src_base)/libfrontend-elements/makefile) + +src_root := $(src_base)/libbackend-elements +scf_root := $(src_root)/build +out_root := $(src_root) +$(call import,$(src_base)/libbackend-elements/makefile) + +src_root := $(src_base)/libxsd-frontend +scf_root := $(src_root)/build +out_root := $(src_root) +$(call import,$(src_base)/libxsd-frontend/makefile) + +src_root := $(src_base)/xsd +scf_root := $(src_root)/build +out_root := $(src_root) + +ifneq ($(filter $(MAKECMDGOALS),clean test install),) +$(call import,$(src_base)/xsd/makefile) +else +$(call import,$(src_base)/xsd/xsd/makefile) +endif diff --git a/xsd/build/cxx/configuration-dynamic.make b/xsd/build/cxx/configuration-dynamic.make index 7485fe9..568ab40 100644 --- a/xsd/build/cxx/configuration-dynamic.make +++ b/xsd/build/cxx/configuration-dynamic.make @@ -2,7 +2,7 @@ cxx_id := gnu cxx_optimize := n cxx_debug := n cxx_rpath := n -cxx_pp_extra_options := $(CPPFLAGS) -I$(out_root)/../stage/include +cxx_pp_extra_options := $(CPPFLAGS) cxx_extra_options := $(CXXFLAGS) cxx_ld_extra_options := $(LDFLAGS) cxx_extra_libs := $(LIBS) @@ -11,4 +11,4 @@ r := $(shell echo $(LDFLAGS) | sed -e 's/-L *\([^ ]*\)/-L\1/g') r := $(patsubst -L%,%,$(filter -L%,$(r))) r := $(shell echo $(r) | sed -e 's/ /:/g') -cxx_extra_lib_paths := $(out_root)/../stage/lib $(r) +cxx_extra_lib_paths := $(r) diff --git a/xsd/build/import/libbackend-elements/configuration-dynamic.make b/xsd/build/import/libbackend-elements/configuration-dynamic.make index fd03110..8a6f091 100644 --- a/xsd/build/import/libbackend-elements/configuration-dynamic.make +++ b/xsd/build/import/libbackend-elements/configuration-dynamic.make @@ -1 +1,4 @@ -libbackend_elements_installed := y +libbackend_elements_installed := n +src_root := $(abspath $(src_root)/../libbackend-elements) +scf_root := $(src_root)/build +out_root := $(src_root) diff --git a/xsd/build/import/libcult/configuration-dynamic.make b/xsd/build/import/libcult/configuration-dynamic.make index 78c41d3..73c92bb 100644 --- a/xsd/build/import/libcult/configuration-dynamic.make +++ b/xsd/build/import/libcult/configuration-dynamic.make @@ -1 +1,4 @@ -libcult_installed := y +libcult_installed := n +src_root := $(abspath $(src_root)/../libcult) +scf_root := $(src_root)/build +out_root := $(src_root) diff --git a/xsd/build/import/libxsd-frontend/configuration-dynamic.make b/xsd/build/import/libxsd-frontend/configuration-dynamic.make index 1b2d3ca..5033ade 100644 --- a/xsd/build/import/libxsd-frontend/configuration-dynamic.make +++ b/xsd/build/import/libxsd-frontend/configuration-dynamic.make @@ -1 +1,4 @@ -libxsd_frontend_installed := y +libxsd_frontend_installed := n +src_root := $(abspath $(src_root)/../libxsd-frontend) +scf_root := $(src_root)/build +out_root := $(src_root) -- cgit v1.1