build-aux/gen-c1make: New build script
This solves the dependency-related problems with rebuilding c1map files. * build-aux/gen-c1make: New file. * build-aux/Makefile.2.in (suppliers.mk): Use it.master v2.17.3
parent
0453d78329
commit
844c6512c9
|
@ -117,11 +117,8 @@ standalones: $(dest_standalone)
|
||||||
@echo "standalone $< $@" >>.cqueue
|
@echo "standalone $< $@" >>.cqueue
|
||||||
@touch $@
|
@touch $@
|
||||||
|
|
||||||
# C1 XML
|
# C1 XML (specific recipes are in suppliers.mk)
|
||||||
c1map: $(dest_c1map)
|
c1map: $(dest_c1map)
|
||||||
%.php: %.xml
|
|
||||||
@echo "c1map $< $@" >>.cqueue
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
%.dot: %.xmlo
|
%.dot: %.xmlo
|
||||||
@echo "dot $< $@" >> .cqueue
|
@echo "dot $< $@" >> .cqueue
|
||||||
|
@ -204,7 +201,8 @@ suppliers.mk:
|
||||||
&& echo "rm $$(patsubst %.xmlo,%.tmp,$$@)" >> .cqueue \
|
&& echo "rm $$(patsubst %.xmlo,%.tmp,$$@)" >> .cqueue \
|
||||||
&& touch $$@ \
|
&& touch $$@ \
|
||||||
&& touch -d +1sec $$(patsubst %.xmlo,%.tmp,$$@) >> .cqueue' \
|
&& touch -d +1sec $$(patsubst %.xmlo,%.tmp,$$@) >> .cqueue' \
|
||||||
./rater/tools/gen-make common/ $(path_suppliers)/ $(path_dsl)/ $(path_map)/ $(path_ui)/ >$@
|
./rater/tame/build-aux/gen-make common/ $(path_suppliers)/ $(path_dsl)/ $(path_map)/ $(path_ui)/ >$@ \
|
||||||
|
&& ./rater/tame/build-aux/gen-c1make $(path_c1map)/*.xml >>$@
|
||||||
|
|
||||||
me-a-sandwich:
|
me-a-sandwich:
|
||||||
@test $$EUID -eq 0 \
|
@test $$EUID -eq 0 \
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Generates GNU Make recipes for c1map build
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 R-T Specialty, LLC.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# 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 more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
##
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
# Recursively produce list of dependencies for given package
|
||||||
|
#
|
||||||
|
# Since all compilation occurs on the base package in the root of the c1map
|
||||||
|
# directory, recursive dependencies are output as part of the recipe for the
|
||||||
|
# base package rather than as dependencies of individual sub-packages.
|
||||||
|
include-list()
|
||||||
|
{
|
||||||
|
local -r dir="${1?Missing base directory}"
|
||||||
|
local -r file="${2?Missing package filename}"
|
||||||
|
|
||||||
|
# get name of all includes, recursively
|
||||||
|
grep -o 'lvm:include name="[^"]\+"' "$file" \
|
||||||
|
| cut -d\" -f2 \
|
||||||
|
| tee >(
|
||||||
|
while read dep; do
|
||||||
|
include-list "$dir" "$dir/$dep.xml"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Format includes for GNUMakefile recipe
|
||||||
|
#
|
||||||
|
# All unique dependencies will be prefixed with the appropriate base path
|
||||||
|
# and will be output on a single line.
|
||||||
|
format-includes()
|
||||||
|
{
|
||||||
|
local -r dir="${1?Missing base directory}"
|
||||||
|
|
||||||
|
sort -u \
|
||||||
|
| sed "s#^.*\$#$dir/&.xml#" \
|
||||||
|
| tr '\n' ' '
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Produce recipe for base package
|
||||||
|
#
|
||||||
|
# This should only be provided with the filename of a base package (that is,
|
||||||
|
# an immediate child of c1map).
|
||||||
|
#
|
||||||
|
# A recipe will be output for generating a PHP file from the source code
|
||||||
|
# and all package dependencies, recursively.
|
||||||
|
c1recipe()
|
||||||
|
{
|
||||||
|
local -r file="${1?Missing source filename}"
|
||||||
|
|
||||||
|
local -r dir=$( dirname "$file" )
|
||||||
|
local -r base=$( basename "$file" .xml )
|
||||||
|
|
||||||
|
local -r includes=$(
|
||||||
|
include-list "$dir" "$file" \
|
||||||
|
| format-includes "$dir" \
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "$dir/$base.php: $file $includes"
|
||||||
|
echo -e '\t@echo "c1map $< $@" >> .cqueue'
|
||||||
|
echo -e '\t@touch $@'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Produce recipe for each provided base package
|
||||||
|
#
|
||||||
|
# This should only be provided with filenames of a base package (that is,
|
||||||
|
# an immediate children of c1map).
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
c1recipe "$1"
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
main "$@"
|
Loading…
Reference in New Issue