test(tests/playground/parser): create directory and Makefile for experiment
This commit is contained in:
parent
5f6106be83
commit
dd72df26bd
4 changed files with 51 additions and 0 deletions
40
tests/playground/parser/Makefile
Normal file
40
tests/playground/parser/Makefile
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
LEANC=../../../bin/leanc
|
||||
LEAN=../../../bin/lean
|
||||
SRCS = $(shell ls *.lean)
|
||||
OLEANS = $(SRCS:.lean=.olean)
|
||||
CPPS = $(SRCS:.lean=.cpp)
|
||||
OBJS = $(SRCS:.lean=.o)
|
||||
DEPS = $(SRCS:.lean=.depend)
|
||||
CPPFLAGS = -O3
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: parser $(OLEANS)
|
||||
|
||||
depends: $(DEPS)
|
||||
|
||||
%.depend: %.lean
|
||||
@echo $(<:.lean=.olean): `$(LEAN) --deps $< | python relative.py` > $@
|
||||
|
||||
%.olean: %.lean %.depend
|
||||
$(LEAN) --make --cpp="$*.cpp.tmp" $<
|
||||
mv "$*.cpp.tmp" "$*.cpp"
|
||||
@touch $*.olean
|
||||
|
||||
%.cpp: %.olean
|
||||
@
|
||||
|
||||
%.o: %.cpp
|
||||
$(LEANC) -c $(CPPFLAGS) -o $@ $<
|
||||
|
||||
parser: $(OBJS)
|
||||
$(LEANC) -o parser $(OBJS)
|
||||
|
||||
clean:
|
||||
rm -f *.olean
|
||||
rm -f *.cpp
|
||||
rm -f *.o
|
||||
rm -f *.depend
|
||||
rm -f parser
|
||||
|
||||
include $(DEPS)
|
||||
2
tests/playground/parser/leanpkg.path
Normal file
2
tests/playground/parser/leanpkg.path
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
builtin_path
|
||||
path .
|
||||
9
tests/playground/parser/relative.py
Normal file
9
tests/playground/parser/relative.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2018 Microsoft Corporation. All rights reserved.
|
||||
# Released under Apache 2.0 license as described in the file LICENSE.
|
||||
# Authors: Simon Hudon
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
for x in sys.stdin:
|
||||
print(os.path.relpath(x))
|
||||
Loading…
Add table
Reference in a new issue