1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# Default target
all: release
# Build rules
%.o: %.cpp
$(CC) -c $(CFLAGS) -o $@ $<
$(TARGET): $(DEPS) $(OBJECTS)
$(CC) $^ $(LDFLAGS) -o $@
release: CFLAGS += -O3
release: LDFLAGS += -O3
release: $(TARGET)
debug: CFLAGS += -g
debug: $(TARGET)
# Rules for updating lexer and parser
%.lexer.cpp: %.l
$(LEX) -o $@ $<
%.parser.cpp: %.y
$(YACC) -d -o $@ $<
generate: $(BISON_SOURCES:.y=.parser.cpp) $(FLEX_SOURCES:.l=.lexer.cpp)
# Clean rule
clean:
rm -f $(OBJECTS) $(DEPS) $(TARGET)
# Pattern to replace All with strategies using sed
REPLACE_ALL := "s/All/BestFS BFS DFS RDFS/"
# Check the build
check: $(TARGET)
@failed=0; \
for f in Tests/*.xml; do \
for s in `echo $$f | cut -d- -f3 | cut -d. -f1 | sed -e $(REPLACE_ALL)`; do \
echo "----------------------------------------------------------------------"; \
echo "Testing $$f using $$s"; \
./$< -s $$s -m 256 $$f $$f.q; \
if [ $$? -ne `echo $$f | cut -d- -f2` ]; then \
echo " --- Test Failed!"; \
failed=$$(($$failed + 1)); \
else \
echo " +++ Test Succeeded"; \
fi \
done \
done; \
if [ "$$failed" -ne "0" ]; then \
echo "----------------------------------------------------------------------"; \
echo "\033[1m $$failed test(s) Failed \033[0m"; \
echo "----------------------------------------------------------------------"; \
else \
echo "----------------------------------------------------------------------"; \
echo "\033[1m All tests was successful \033[0m"; \
echo "----------------------------------------------------------------------"; \
fi
.PHONY: all generate clean check test
|