~verifypn-cpn/verifypn/colored

« back to all changes in this revision

Viewing changes to makefile

  • Committer: Jonas Finnemann Jensen
  • Date: 2011-09-15 13:30:00 UTC
  • Revision ID: jopsen@gmail.com-20110915133000-wnywm1odf82emiuw
Import of sources from github

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#Programs for processing
 
2
LEX                             = flex
 
3
YACC                    = bison
 
4
CC                              = g++
 
5
RM                              = rm
 
6
FIND                    = find
 
7
GREP                    = grep
 
8
SED                             = sed
 
9
 
 
10
#Compiler and linker flags
 
11
CFLAGS                  = -O3 -I.
 
12
LDFLAGS                 = -static -O3 -llpsolve55 -lcolamd -ldl
 
13
 
 
14
#Target
 
15
TARGET                  = PeTAPAAL
 
16
 
 
17
#Source files
 
18
FLEX_SOURCES    = $(shell $(FIND) * -name "*.l")
 
19
BISON_SOURCES   = $(shell $(FIND) * -name "*.y")
 
20
SOURCES                 = $(shell $(FIND) * -name "*.cpp" | $(GREP) -v ".\\(parser\\|lexer\\).cpp")     \
 
21
                                  $(BISON_SOURCES:.y=.parser.cpp)                                                                                               \
 
22
                                  $(FLEX_SOURCES:.l=.lexer.cpp)
 
23
 
 
24
#Intermediate files
 
25
OBJECTS                 = $(SOURCES:.cpp=.o)                                                                                                                    \
 
26
                                  $(FLEX_SOURCES:.l=.lexer.cpp)                                                                                                 \
 
27
                                  $(BISON_SOURCES:.y=.parser.cpp)                                                                                               \
 
28
                                  $(BISON_SOURCES:.y=.parser.hpp)
 
29
 
 
30
#Build rules
 
31
%.lexer.cpp: %.l
 
32
        $(LEX) -o $@ $<
 
33
%.parser.cpp: %.y
 
34
        $(YACC) -d -o $@ $<
 
35
%.o: %.cpp
 
36
        $(CC) -c $(CFLAGS) -o $@ $<
 
37
$(TARGET): $(SOURCES:.cpp=.o)
 
38
        $(CC) $^ $(LDFLAGS) -o $@
 
39
 
 
40
all: $(TARGET)
 
41
clean:
 
42
        $(RM) -f $(OBJECTS) $(TARGET)
 
43
 
 
44
#Check the build
 
45
check: all
 
46
        @for f in Tests/*.xml; do                                                                                                                                       \
 
47
                echo "Testing $$f:";                                                                                                                                    \
 
48
                ./$(TARGET) -m 256 $$f $$f.q;                                                                                                                                   \
 
49
                if [ `echo $$f | $(SED) -e "s/.*-\([0-9]\)\.xml/\1/"` -ne $$? ]; then                                   \
 
50
                        echo " --- Test Failed!";                                                                                                                       \
 
51
                else                                                                                                                                                                    \
 
52
                        echo " +++ Test Succeeded";                                                                                                             \
 
53
                fi                                                                                                                                                                              \
 
54
        done 
 
55
 
 
56
.PHONY: all clean check