Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-10-08 23:27:02 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-10-11 22:25:18 -0400
commit6027769633abc3d8d2377caceb7b942fc7fd92aa (patch)
tree12b17cd67576d1b9d53989245f967392991b7c0a /build-aux/Makefile.am
parent88da519c5e43566871e504a4716ac7609e9adf2c (diff)
downloadtame-6027769633abc3d8d2377caceb7b942fc7fd92aa.tar.gz
tame-6027769633abc3d8d2377caceb7b942fc7fd92aa.tar.bz2
tame-6027769633abc3d8d2377caceb7b942fc7fd92aa.zip
Integrate new compilation scripts, remove cqueue and Makefile.2
This is a major step toward normalcy---removing the kluge of a build process that was causing so many issues. Rather than echoing all operations to a queue file before passing it off to dslc, the new build scripts in `bin/' are used to invoke tame normally, as needed. This solves all of the current issues with things not rebuilding when they should. And, as a bonus, tab completion on targets works. Sorry this took so long. There wasn't much motivation until we hired so many people that are suffering from this. This does a few major things, along with some miscellaneous others: - Invoke bin/tame directly; - Merge Makefile.2.in into Makefile.am; and - Fix up some targets. * build-aux/Makefile.2.in: Delete file. Mostly merged with Makefile.am. * build-aux/Makefile.am: Add a bunch of new targets and definitions from Makefile.2.in. Modify all that previously used .cqueue to now invoke `$(TAME)' directly. Remove miscellaneous targets for trying to proxy targets to Makefile.2. (saneout, _go): Remove definitions. (.NOTPARALLEL): Add to prevent parallel builds. (ui/program.expanded.xml)[.version.xml]: Remove dependency for now. (clean): Also clean generated PHP files. Follow symlinks to clean core. This is still incomplete (does not clean all rate table stuff). (suppliers.mk)[xmlo_cmd]: Remove. See `gen-make' and `gen-c1make'. (lvroot)[summary-html]: New dependency. (kill-tamed, tamed-die): New targets (former alias of latter) to kill tamed. * build-aux/gen-c1make: Generate `$(TAME)' invocation. * build-aux/gen-make: Likewise. Remove `xmlo_cmd' output. Ignore recursive `tame' symlink (this can be removed once we clean `rater/' up. * build-aux/m4/calcdsl.m4 (TAME): Update description to reflect that it should now be the path to `bin/tame'. Adjust `AC_CHECK_FILE' lines accordingly. (tame_needed_ver): Remove. We have been in the same repo as TAME itself for quite some time. Remove associated code. (AC_CONFIG_FILES): Remove `Makefile.2'. * src/current/src/com/lovullo/dslc/DslCompiler.java (_DslCompiler)[compile]: Perform validation prefore `compile' command rather than a separate `validate' step. Remove `rm'. [compileSrc]: Stop echoing command. This was only necessary because of the previous Makefile klugery; now Make echoes on its own correctly.
Diffstat (limited to 'build-aux/Makefile.am')
-rw-r--r--build-aux/Makefile.am230
1 files changed, 151 insertions, 79 deletions
diff --git a/build-aux/Makefile.am b/build-aux/Makefile.am
index 4ddec3b..e1f07a8 100644
--- a/build-aux/Makefile.am
+++ b/build-aux/Makefile.am
@@ -16,15 +16,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# This fragment exists as a kluge to provide support for running a command
-# after all targets have been run (in this case, dslc).
-#
-# A list of everything to be compiled is output into .cqueue, which is then
-# picked up by dslc; this avoids the overhead of starting the JVM,
-# recompiling XSL stylesheets, etc, which is quite substantial.
-#
-# !!! Unfortunately, this does not yet support parallel job execution.
+##
path_rates := $(path_suppliers)/rates
path_map := map
@@ -38,63 +30,153 @@ path_srv := srv
path_lvroot := lvroot
path_intralov_root := "intralov-root/@program@"
-.PHONY: FORCE prepare program-data-copy lvroot program-ui-immediate test
-
-JAVA_HEAP_SIZE ?= 5120M
-JAVA_STACK_SIZE ?= 5M
+src_suppliers := $(wildcard $(path_suppliers)/*.xml)
+src_map := $(wildcard $(path_map)/*.xml)
+src_c1map := $(wildcard $(path_c1map)/*.xml)
+
+dest_summary_html := $(patsubst \
+ $(path_suppliers)/%.xml, \
+ $(path_suppliers)/%.html, \
+ $(src_suppliers))
+dest_standalone := $(patsubst \
+ $(path_suppliers)/%.xml, \
+ $(path_suppliers)/%.js, \
+ $(src_suppliers))
+dest_map := $(patsubst \
+ $(path_map)/%.xml, \
+ $(path_map)/%.xmle, \
+ $(src_map))
+dest_c1map := $(patsubst \
+ $(path_c1map)/%.xml, \
+ $(path_c1map)/%.php, \
+ $(src_c1map))
+
+compiled_suppliers := $(src_suppliers:.xml=.xmlo)
+linked_suppliers := $(src_suppliers:.xml=.xmle)
+
+comma := ,
+extless_supp_delim := $(subst .xml,,$(subst .xml ,$(comma),$(src_suppliers)))
+
+ant = @ANT@ -e
+
+.PHONY: FORCE default program-data-copy lvroot program-ui-immediate test \
+ default clean interp-rate-tables summary-html c1map standalones \
+ program-ui version FORCE
+
+default: program-ui c1map FORCE
.DELETE_ON_ERROR:
-
-# less verbose output; all to runlog
-define saneout
- time -f 'total time: %E' awk ' \
- BEGIN { e=0; w=0; } \
- { printf "[%d] ", systime() >> ".runlog"; print >> ".runlog"; } \
- /^~~~~\[begin /,/^~~~~\[end / { next } \
- /^rm / { next } \
- /^Exception|^\t+at / { \
- if ( /^E/ ) { \
- print; \
- print "Stack trace written to .runlog"; \
- } \
- next; \
- } \
- /[Ww]arning:|[Nn]otice:/ { printf "\033[0;33m"; w++; out=1; } \
- /[Ff]atal:/ { printf "\033[0;31m"; out=1; } \
- /!|[Ee]rror:/ { printf "\033[0;31m"; e++; out=1; } \
- /internal:/ { printf "\033[0;35m"; out=1; } \
- /internal error:/ { printf "\033[1m"; out=1; } \
- /^[^[]/ || out { print; printf "\033[0;0m"; out=0; } \
- END { printf "%d error(s); %d warning(s).\n", e, w; } \
- '
-endef
-
-define _go
- touch .cqueue \
- && ( test -s .cqueue || echo "Nothing to be done for \`$@'." ) \
- && echo "$(JAVA_HEAP_SIZE) $(JAVA_STACK_SIZE)" \ \
- && CLASSPATH="$(RATER_CLASSPATH):rater/src/dslc.jar" \
- $(JAVA) -Xmx$(JAVA_HEAP_SIZE) -Xss$(JAVA_STACK_SIZE) \
- com.lovullo.dslc.DslCompiler < .cqueue 2>&1 \
- | $(saneout); \
- exit $${PIPESTATUS[0]}; \
- @>.cqueue
-endef
+.NOTPARALLEL:
SHELL = /bin/bash -O extglob
-all: program-data-copy
+# these files will never be deleted when Make considers them to be intermediate
+# (e.g. when building summary pages), since they are still needed or take a
+# while to build
+.PRECIOUS: %.js %.xml %.xmle %.xmlo
-program-ui-immediate:
- @>.cqueue
- @$(MAKE) --no-print-directory -f Makefile.2 program-ui-immediate
- @$(MAKE) program-data-copy
- @$(_go)
+all: program-data-copy
-program-data-copy:
- @>.cqueue
- @$(MAKE) --no-print-directory -f Makefile.2 standalones program-ui c1map
- @$(_go)
+program-ui: standalones ui/package.js ui/Program.js program-ui-immediate
+program-ui-immediate: ui/html/index.phtml
+
+# Note the `$()' here to prevent Automake from inlining this file---it is
+# to be generated when imports change, which can be at any time.
+include $()suppliers.mk
+
+summary-html: $(dest_summary_html) ;
+
+%.html: %.js
+ $(TAME) summary $*.xmle $@
+
+standalones: $(dest_standalone)
+%.xmle: %.xmlo
+ $(TAME) link $< $@
+%.js: %.xmle
+ $(TAME) standalone $< $@
+
+# C1 XML (specific recipes are in suppliers.mk)
+c1map: $(dest_c1map)
+
+%.dot: %.xmlo
+ $(TAME) dot $< $@
+%.dote: %.xmle
+ $(TAME) dot $< $@
+
+%.svg: %.dote
+ dot -Tsvg "$<" > "$@"
+%.svg: %.dot
+ dot -Tsvg "$<" > "$@"
+
+%.xml: %.dat
+ rater/tools/tdat2xml $< > $@
+
+%.xml: %.typelist
+ rater/tame/build-aux/list2typedef $(*F) < $< > $@
+
+%.csvo: %.csvm
+ rater/tools/csvm2csv $< > $@
+%.csvo: %.csvi
+ rater/tools/csvi $< > $@
+%.csvo: %.csv
+ cp $< $@
+
+%.xml: %.csvo
+ rater/tools/csv2xml $< > $@
+
+version: .version.xml
+.version.xml: FORCE
+ git log HEAD^.. -1 --pretty=format:'<version>%h</version>' > .version.xml
+
+ui/program.expanded.xml: ui/program.xml
+ $(TAME) progui-expand $< $@
+ui/Program.js: ui/program.expanded.xml ui/package.js
+ $(TAME) progui-class $< $@ include-path=../../../ui/
+ui/html/index.phtml: ui/program.expanded.xml
+ $(TAME) progui-html $< $@ out-path=./
+ui/package-dfns.xmlo: ui/package-dfns.xml
+ui/package-dfns.xml: ui/program.expanded.xml
+ $(TAME) progui-pkg $< $@
+ui/package-map.xmlo: ui/package-map.xml
+ui/package-map.xml: ui/program.expanded.xml ui/package-dfns.xml
+ $(TAME) progui-pkg-map $< $@
+
+# for the time being, this does not depend on clean-rate-tables because $(ant) will
+specs:
+ $(MAKE) -C doc/specs
+
+# for the time being, this does not depend on clean-rate-tables because ant will
+# run it
+clean:
+ find -L $(path_suppliers) $(path_map) $(path_c1map) common/ rater/core rater/lv \( \
+ -name '*.xmlo' \
+ -o -name '*.xmle' \
+ -o -name '*.js' \
+ -o -name '*.html' \
+ -o -name '*.dep' \
+ -o -name '*.tmp' \
+ -o -name '*.php' \
+ \) -exec rm -v {} \;
+ rm -rf $(path_ui)/package-dfns.* \
+ $(path_ui)/package-map.* \
+ $(path_ui)/program.expanded.xml \
+ $(path_ui)/include.js \
+ $(path_ui)/Program.js \
+ $(path_ui)/html
+ find . -path '*/tables/*.csvm' -o -path '*/territories/*.dat' \
+ | sed 's/\.csvm$$/\.xml/; s/\.dat$$/\.xml/' \
+ | xargs rm -fv
+
+# generates a Makefile that will properly build all package dependencies; note
+# that territory and rate packages also have includes; see top of this file for
+# an explanation
+suppliers.mk:
+ $(ant) pkg-dep
+ mv $(path_ui)/program.dep $(path_ui)/package-dfns.dep
+ ./rater/tame/build-aux/gen-make common/ $(path_suppliers)/ $(path_dsl)/ $(path_map)/ $(path_ui)/ >$@
+ ./rater/tame/build-aux/gen-c1make $(path_c1map)/*.xml >>$@
+
+program-data-copy: standalones program-ui c1map .version.xml
mkdir -p "$(path_lv)/src/node/program/rater/programs/@program@"
mkdir -p "$(path_lv)/src/node/program/classify"
mkdir -p "$(path_lv)/src/node/program/ui/custom"
@@ -124,7 +206,7 @@ program-data-copy:
ant -f "$(path_lv)/build.xml" js-mod-order
# TODO: merge this and the above
-lvroot: prepare
+lvroot: summary-html
mkdir -p "$(path_lvroot)/src/node/program/rater/programs/@program@"
mkdir -p "$(path_lvroot)/src/node/program/classify"
mkdir -p "$(path_lvroot)/src/node/program/ui/custom"
@@ -155,28 +237,18 @@ intralov-root: summary-html
ln -fL $(path_dsl)/scripts/*.js "$(path_intralov_root)/rater/scripts/"
ln -fL $(path_suppliers)/*.{html,js} "$(path_intralov_root)/suppliers"
-
-# because of the crazy wildcard target below, we want to ignore
-# some Automake-generated stuff
-%.am:
-%.m4:
-%.ac:
-
-%: prepare
- @if [[ "$@" != [Mm]akefile ]]; then \
- $(MAKE) --no-print-directory -f Makefile.2 $@; \
- $(_go); \
- fi
-
-clean:
- $(MAKE) --no-print-directory -f Makefile.2 clean
-
-prepare: FORCE
- @>.cqueue
-
test: check
check-am: standalones ui/package.js
@$(path_dsl)/build-aux/progtest-runner $(path_suppliers) $(path_tests)
@$(path_dsl)/build-aux/progtest-runner ui/package.xml $(path_tests)/ui
+kill-tamed: tamed-die
+tamed-die:
+ $(TAME) --kill
+
+me-a-sandwich:
+ @test $$EUID -eq 0 \
+ && echo 'You actually ran me as root? Are you insane!?' \
+ || echo 'Make it yourself.'
+
FORCE: ;