Commit a47603ff authored by dbarbera's avatar dbarbera
Browse files

Refactor makefiles

parent 0faf9936
all: compile-all all: compile-all
test-parse: test-parse:
@make -s -C tests/regression test-parse @$(MAKE) -s -C tests/regression test-parse
test-ada: test-ada:
@make -s -C tests/regression test-ada @$(MAKE) -s -C tests/regression test-ada
test-llvm: test-llvm:
@make -s -C tests/regression test-llvm @$(MAKE) -s -C tests/regression test-llvm
benchmark: benchmark:
@make -s -C tests/regression benchmark @$(MAKE) -s -C tests/regression benchmark
coverage: coverage:
@make -s -C tests/regression coverage @$(MAKE) -s -C tests/regression coverage
flake8: flake8:
@echo Generating flake8_report file @echo Generating flake8_report file
flake8 opengeode.py Pr.py sdlSymbols.py genericSymbols.py ogParser.py AdaGenerator.py Renderer.py Clipboard.py Lander.py ogAST.py undoCommands.py Connectors.py Asn1scc.py Helper.py Statechart.py >flake8_report @flake8 opengeode.py Pr.py sdlSymbols.py genericSymbols.py ogParser.py \
AdaGenerator.py Renderer.py Clipboard.py Lander.py ogAST.py \
undoCommands.py Connectors.py Asn1scc.py Helper.py \
Statechart.py > flake8_report
compile-all: compile-all:
pyside-rcc opengeode.qrc -o icons.py @pyside-rcc opengeode.qrc -o icons.py
if [ ! -f antlr-3.1.3.tar.bz2 ]; then wget http://download.tuxfamily.org/taste/misc/antlr-3.1.3.tar.bz2 ; tar jxvf antlr-3.1.3.tar.bz2 ; fi @if [ ! -f antlr-3.1.3.tar.bz2 ] ; \
CLASSPATH=$$PWD/antlr-3.1.3/lib/antlr-3.1.3.jar java org.antlr.Tool sdl92.g then wget http://download.tuxfamily.org/taste/misc/antlr-3.1.3.tar.bz2 ; \
tar jxvf antlr-3.1.3.tar.bz2 ; \
fi
@CLASSPATH=$$PWD/antlr-3.1.3/lib/antlr-3.1.3.jar java org.antlr.Tool sdl92.g
install: compile-all install: compile-all
mkdir -p opengeode @mkdir -p opengeode
for f in AdaGenerator.py __init__.py Pr.py genericSymbols.py icons.py ogAST.py ogParser.py opengeode.py Renderer.py samnmax.py sdl92Lexer.py sdl92Parser.py sdlSymbols.py undoCommands.py Clipboard.py Statechart.py LlvmGenerator.py Lander.py Helper.py Connectors.py Asn1scc.py; do echo Installing $$f && cp $$f opengeode; done @for f in AdaGenerator.py __init__.py Pr.py genericSymbols.py icons.py \
python setup.py install ogAST.py ogParser.py opengeode.py Renderer.py samnmax.py \
sdl92Lexer.py sdl92Parser.py sdlSymbols.py undoCommands.py \
Clipboard.py Statechart.py LlvmGenerator.py Lander.py Helper.py \
Connectors.py Asn1scc.py ; \
do echo Installing $$f && cp $$f opengeode ; \
done
@python setup.py install
publish: install publish: install
python setup.py sdist upload @python setup.py sdist upload
clean: clean:
@make -s -C tests/regression clean @$(MAKE) -s -C tests/regression clean
@find . -name '*~' | xargs rm -f @find . -name '*~' | xargs rm -f
@find . -name '*.o' | xargs rm -f @find . -name '*.o' | xargs rm -f
......
TEST_CASES = \ DISABLED_TESTS=test-branchcoverage/
test1 \ TEST_CASES=$(filter-out $(DISABLED_TESTS), $(sort $(dir $(wildcard */))))
test2 \
test3 \ DISABLED_BENCHMARKS=test1/ test2/ test3/ test4/ test5/ test6/ test7/ test12/
test4 \ BENCHMARK_CASES=$(filter-out $(DISABLED_BENCHMARKS), $(sort $(dir $(wildcard */))))
test5 \
test6 \
test7 \
test8 \
test9 \
test10 \
test11 \
test12 \
test-controlflow \
test-exitnested \
test-expressions \
test-operators \
test-substrings \
BENCHMARK_CASES = \
test8 \
test9 \
test10 \
test11 \
test-controlflow \
test-exitnested \
test-expressions \
test-operators \
test-substrings \
test-parse: test-parse:
@python test.py test-parse $(TEST_CASES) @python test.py test-parse $(TEST_CASES)
...@@ -39,13 +15,16 @@ test-llvm: ...@@ -39,13 +15,16 @@ test-llvm:
benchmark: benchmark:
@python benchmark.py $(BENCHMARK_CASES) @python benchmark.py $(BENCHMARK_CASES)
@make clean
coverage: coverage:
for v in $(TEST_CASES) ; do make -C $$v coverage && mv $$v/.coverage* . \ @for v in $(TEST_CASES) ; \
|| exit 1 ; done ; coverage combine do $(MAKE) -C $$v coverage && mv $$v/.coverage* . || exit 1 ; \
done
@coverage combine
clean: clean:
for v in $(TEST_CASES); do make -C $$v clean ; done @for v in $(TEST_CASES) ; \
do $(MAKE) -s -C $$v clean ; \
done
.PHONY: test-parse test-ada test-llvm benchmark coverage clean .PHONY: test-parse test-ada test-llvm benchmark coverage clean
...@@ -10,6 +10,7 @@ def main(): ...@@ -10,6 +10,7 @@ def main():
errors = 0 errors = 0
for testfolder in sys.argv[1:]: for testfolder in sys.argv[1:]:
result = benchmark(testfolder) result = benchmark(testfolder)
make(testfolder, 'clean')
if result: if result:
results.append(result) results.append(result)
else: else:
...@@ -20,7 +21,7 @@ def main(): ...@@ -20,7 +21,7 @@ def main():
sys.stdout.write('\n') sys.stdout.write('\n')
elapsed = t.time() - start elapsed = t.time() - start
summarize(results, errors, elapsed) sys.exit(summarize(results, errors, elapsed))
def benchmark(testfolder): def benchmark(testfolder):
...@@ -35,7 +36,7 @@ def benchmark(testfolder): ...@@ -35,7 +36,7 @@ def benchmark(testfolder):
if not os.path.isfile(bin_name): if not os.path.isfile(bin_name):
return return
return { result = {
"size": { "size": {
"ada": os.path.getsize(llvm_bin), "ada": os.path.getsize(llvm_bin),
"llvm": os.path.getsize(ada_bin), "llvm": os.path.getsize(ada_bin),
...@@ -46,6 +47,8 @@ def benchmark(testfolder): ...@@ -46,6 +47,8 @@ def benchmark(testfolder):
} }
} }
return result
def time(file, iters=1000): def time(file, iters=1000):
start = t.time() start = t.time()
...@@ -55,16 +58,18 @@ def time(file, iters=1000): ...@@ -55,16 +58,18 @@ def time(file, iters=1000):
def summarize(results, errors, elapsed): def summarize(results, errors, elapsed):
print "Finished in %.3fs" % elapsed print "Finished in %.3fs" % elapsed
print "%s cases, %s errors" % (len(results), errors) print "%s benchmarks, %s errors" % (len(results) + errors, errors)
if not results: if not results:
print "No results" print "No results"
return return 1
print "Summary:" print "Summary:"
print " Size: Ada %.2f%% LLVM %.2f%%" % diff(results, "size") print " Size: Ada %.2f%% LLVM %.2f%%" % diff(results, "size")
print " Time: Ada %.2f%% LLVM %.2f%%" % diff(results, "time") print " Time: Ada %.2f%% LLVM %.2f%%" % diff(results, "time")
return 0 if results and not errors else 1
def diff(results, metric): def diff(results, metric):
metrics = [r[metric] for r in results] metrics = [r[metric] for r in results]
......
benchmark: OPENGEODE=../../../opengeode.py
@python ../benchmark.py . ASN1SCC=asn1.exe
CC=gcc
LLC=llc
GNATMAKE=gnatmake
GNATBIND=gnatbind
GNATLINK=gnatlink
clean: clean:
@rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg \ rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg \
examiner bin *.wrn *.gpr *.ll *.s dataview-uniq.c dataview-uniq.h \ examiner bin *.wrn *.gpr *.ll *.s dataview-uniq.c dataview-uniq.h \
real.c xer.c ber.c acn.c asn1crt.c asn1crt.h test_ada test_llvm real.c xer.c ber.c acn.c asn1crt.c asn1crt.h test_ada test_llvm \
*.autosave
.PHONY: benchmark clean .PHONY: clean
\ No newline at end of file \ No newline at end of file
...@@ -3,18 +3,18 @@ include ../shared.mk ...@@ -3,18 +3,18 @@ include ../shared.mk
all: test-ada all: test-ada
edit: edit:
../../../opengeode.py myfunction.pr system_structure.pr $(OPENGEODE) myfunction.pr system_structure.pr
check: check:
../../../opengeode.py myfunction.pr system_structure.pr --check $(OPENGEODE) myfunction.pr system_structure.pr --check
test-parse: test-parse:
../../../opengeode.py myfunction.pr system_structure.pr --check $(OPENGEODE) myfunction.pr system_structure.pr --check
test-ada: test-ada:
../../../opengeode.py --toAda myfunction.pr system_structure.pr 2>&1 | sort | diff expected - || exit 0 $(OPENGEODE) --toAda myfunction.pr system_structure.pr 2>&1 | sort | diff expected - || exit 0
coverage: coverage:
coverage run -p ../../../opengeode.py myfunction.pr system_structure.pr --toAda coverage run -p $(OPENGEODE) myfunction.pr system_structure.pr --toAda
.PHONY: all edit check test-parse test-ada coverage .PHONY: all edit check test-parse test-ada coverage
\ No newline at end of file
include ../shared.mk include ../shared.mk
all: test-ada all: test-ada test-llvm
edit: edit:
../../../opengeode.py controlflow.pr system_structure.pr $(OPENGEODE) controlflow.pr system_structure.pr
test-parse: test-parse:
../../../opengeode.py controlflow.pr system_structure.pr --check $(OPENGEODE) controlflow.pr system_structure.pr --check
test-ada: test-ada:
../../../opengeode.py controlflow.pr system_structure.pr --check --toAda $(OPENGEODE) controlflow.pr system_structure.pr --check --toAda
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc
gnatmake -c *.adb $(GNATMAKE) -c *.adb
gcc -c test_ada.c $(CC) -c test_ada.c
gnatbind -n controlflow.ali $(GNATBIND) -n controlflow.ali
gnatlink test_ada.o controlflow.ali -lgnat -lm -o test_ada $(GNATLINK) test_ada.o controlflow.ali -lgnat -lm -o test_ada
./test_ada | diff expected - ./test_ada | diff expected -
test-llvm: test-llvm:
../../../opengeode.py controlflow.pr system_structure.pr --check --llvm $(OPENGEODE) controlflow.pr system_structure.pr --check --llvm
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
llc controlflow.ll $(LLC) controlflow.ll
gcc -c controlflow.s $(CC) -c controlflow.s
gcc -c dataview-uniq.c $(CC) -c dataview-uniq.c
gcc -c test_llvm.c $(CC) -c test_llvm.c
gcc controlflow.o dataview-uniq.o test_llvm.o -o test_llvm -lm $(CC) controlflow.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected - ./test_llvm | diff expected -
.PHONY: all edit test-parse test-ada test-llvm coverage:
\ No newline at end of file coverage run -p $(OPENGEODE) controlflow.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
...@@ -3,31 +3,31 @@ include ../shared.mk ...@@ -3,31 +3,31 @@ include ../shared.mk
all: test-ada test-llvm all: test-ada test-llvm
edit: edit:
../../../opengeode.py challenge.pr system_structure.pr $(OPENGEODE) challenge.pr system_structure.pr
test-parse: test-parse:
../../../opengeode.py challenge.pr system_structure.pr --check $(OPENGEODE) challenge.pr system_structure.pr --check
test-ada: test-ada:
../../../opengeode.py --toAda challenge.pr system_structure.pr $(OPENGEODE) --toAda challenge.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c *.adb $(GNATMAKE) -c *.adb
gcc -c test_ada.c $(CC) -c test_ada.c
gnatbind -n challenge.ali $(GNATBIND) -n challenge.ali
gnatlink -o test_ada test_ada.o challenge.ali -lgnat -lm $(GNATLINK) -o test_ada test_ada.o challenge.ali -lgnat -lm
./test_ada | diff expected - ./test_ada | diff expected -
test-llvm: test-llvm:
../../../opengeode.py challenge.pr system_structure.pr --check --llvm $(OPENGEODE) challenge.pr system_structure.pr --check --llvm
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
llc challenge.ll $(LLC) challenge.ll
gcc -c challenge.s $(CC) -c challenge.s
gcc -c dataview-uniq.c $(CC) -c dataview-uniq.c
gcc -c test_llvm.c $(CC) -c test_llvm.c
gcc challenge.o dataview-uniq.o test_llvm.o -o test_llvm -lm $(CC) challenge.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected - ./test_llvm | diff expected -
coverage: coverage:
coverage run -p ../../../opengeode.py challenge.pr system_structure.pr --toAda coverage run -p $(OPENGEODE) challenge.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage .PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
include ../shared.mk include ../shared.mk
all: test-ada all: test-ada test-llvm
edit: edit:
../../../opengeode.py expressions.pr system_structure.pr $(OPENGEODE) expressions.pr system_structure.pr
test-parse: test-parse:
../../../opengeode.py expressions.pr system_structure.pr --check $(OPENGEODE) expressions.pr system_structure.pr --check
test-ada: test-ada:
../../../opengeode.py expressions.pr system_structure.pr --check --toAda $(OPENGEODE) expressions.pr system_structure.pr --check --toAda
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc
gnatmake -c *.adb $(GNATMAKE) -c *.adb
gcc -c test_ada.c $(CC) -c test_ada.c
gnatbind -n expressions.ali $(GNATBIND) -n expressions.ali
gnatlink test_ada.o expressions.ali -lgnat -lm -o test_ada $(GNATLINK) test_ada.o expressions.ali -lgnat -lm -o test_ada
./test_ada ./test_ada
test-llvm: test-llvm:
../../../opengeode.py expressions.pr system_structure.pr --check --llvm $(OPENGEODE) expressions.pr system_structure.pr --check --llvm
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
llc expressions.ll $(LLC) expressions.ll
gcc -c expressions.s $(CC) -c expressions.s
gcc -c dataview-uniq.c $(CC) -c dataview-uniq.c
gcc -c test_llvm.c $(CC) -c test_llvm.c
gcc expressions.o dataview-uniq.o test_llvm.o -o test_llvm -lm $(CC) expressions.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm ./test_llvm
.PHONY: all edit test-parse test-ada test-llvm coverage:
\ No newline at end of file coverage run -p $(OPENGEODE) expressions.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
include ../shared.mk include ../shared.mk
all: test-ada all: test-ada test-llvm
edit: edit:
../../../opengeode.py operators.pr system_structure.pr $(OPENGEODE) operators.pr system_structure.pr
test-parse: test-parse:
../../../opengeode.py operators.pr system_structure.pr --check $(OPENGEODE) operators.pr system_structure.pr --check
test-ada: test-ada:
../../../opengeode.py operators.pr system_structure.pr --check --toAda $(OPENGEODE) operators.pr system_structure.pr --check --toAda
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc
gnatmake -c *.adb $(GNATMAKE) -c *.adb
gcc -c test_ada.c $(CC) -c test_ada.c
gnatbind -n operators.ali $(GNATBIND) -n operators.ali
gnatlink test_ada.o operators.ali -lgnat -lm -o test_ada $(GNATLINK) test_ada.o operators.ali -lgnat -lm -o test_ada
./test_ada | diff expected - ./test_ada | diff expected -
test-llvm: test-llvm:
../../../opengeode.py operators.pr system_structure.pr --check --llvm $(OPENGEODE) operators.pr system_structure.pr --check --llvm
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc -equal
llc operators.ll $(LLC) operators.ll
clang -c operators.s $(CC) -c operators.s
clang -c dataview-uniq.c $(CC) -c dataview-uniq.c
clang -c test_llvm.c $(CC) -c test_llvm.c
clang operators.o dataview-uniq.o test_llvm.o -o test_llvm -lm $(CC) operators.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected - ./test_llvm | diff expected -
.PHONY: all edit test-parse test-ada test-llvm coverage:
\ No newline at end of file coverage run -p $(OPENGEODE) operators.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
include ../shared.mk include ../shared.mk
all: test-ada all: test-ada test-llvm
edit: edit:
../../../opengeode.py myfunction.pr system_structure.pr $(OPENGEODE) myfunction.pr system_structure.pr
test-parse: test-parse:
../../../opengeode.py myfunction.pr system_structure.pr --check $(OPENGEODE) myfunction.pr system_structure.pr --check
test-ada: test-ada:
../../../opengeode.py --toAda myfunction.pr system_structure.pr || exit 1 $(OPENGEODE) --toAda myfunction.pr system_structure.pr || exit 1
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
asn1.exe -c dataview-uniq.asn -typePrefix asn1Scc $(ASN1SCC) -c dataview-uniq.asn -typePrefix asn1Scc
gnatmake -c myfunction.adb $(GNATMAKE) -c myfunction.adb
gcc -c test_ada.c $(CC) -c test_ada.c
gnatbind -n myfunction.ali $(GNATBIND) -n myfunction.ali
gnatlink -o test_ada test_ada.o myfunction.ali -lgnat $(GNATLINK) -o test_ada test_ada.o myfunction.ali -lgnat
./test_ada | diff expected - ./test_ada | diff expected -
test-llvm: test-llvm:
../../../opengeode.py myfunction.pr system_structure.pr --check --llvm $(OPENGEODE) myfunction.pr system_structure.pr --check --llvm
asn1.exe -c dataview-uniq.asn -equal -typePrefix asn1Scc $(ASN1SCC) -c dataview-uniq.asn -equal -typePrefix asn1Scc
llc myfunction.ll $(LLC) myfunction.ll
gcc -c myfunction.s $(CC) -c myfunction.s
gcc -c dataview-uniq.c $(CC) -c dataview-uniq.c
gcc -c test_llvm.c $(CC) -c test_llvm.c
gcc myfunction.o dataview-uniq.o test_llvm.o -o test_llvm -lm $(CC) myfunction.o dataview-uniq.o test_llvm.o -o test_llvm -lm
./test_llvm | diff expected - ./test_llvm | diff expected -
coverage: coverage:
coverage run -p ../../../opengeode.py myfunction.pr system_structure.pr --toAda coverage run -p $(OPENGEODE) myfunction.pr system_structure.pr --toAda
.PHONY: all edit test-parse test-ada test-llvm coverage .PHONY: all edit test-parse test-ada test-llvm coverage
\ No newline at end of file
...@@ -3,22 +3,22 @@ include ../shared.mk ...@@ -3,22 +3,22 @@ include ../shared.mk
all: test-ada test-llvm all: test-ada test-llvm
edit: edit:
../../../opengeode.py og.pr system_structure.pr $(OPENGEODE) og.pr system_structure.pr
test-parse: test-parse:
../../../opengeode.py og.pr system_structure.pr --check $(OPENGEODE) og.pr system_structure.pr --check
test-ada: test-ada:
../../../opengeode.py --toAda og.pr system_structure.pr $(OPENGEODE) --toAda og.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal $(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c og.adb $(GNATMAKE) -c og.adb
test-llvm: test-llvm:
../../../opengeode.py og.pr system_structure.pr --llvm $(OPENGEODE) og.pr system_structure.pr --llvm