|
|
|
SHELL=/bin/bash
|
|
|
|
OPTFLAGS=-O2 -flto -g
|
|
|
|
EXPORTFLAGS=-fvisibility=hidden -fpic -Wl,--export-dynamic
|
|
|
|
CPPFLAGS=-std=gnu++11 -I../include
|
|
|
|
LIBSFLAGS=-ldl -lpthread $(MODLIBS)
|
|
|
|
WARNFLAGS=-Wall
|
|
|
|
|
|
|
|
CFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(CPPFLAGS)
|
|
|
|
LDFLAGS=$(OPTFLAGS) $(EXPORTFLAGS) $(WARNFLAGS) $(LIBSFLAGS)
|
|
|
|
|
|
|
|
CC=g++
|
|
|
|
|
|
|
|
SOURCE = $(wildcard *.cpp) parser/lexical.cpp parser/grammatical.cpp
|
|
|
|
DEPENDS = $(subst .cpp,.d,$(SOURCE))
|
|
|
|
OBJECTS = $(subst .cpp,.o,$(SOURCE))
|
|
|
|
|
|
|
|
makemap: $(OBJECTS) $(MODOBJECTS)
|
|
|
|
$(CC) -o $@ $(OBJECTS) $(MODOBJECTS) $(LDFLAGS)
|
|
|
|
|
|
|
|
include $(DEPENDS)
|
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
%.d: %.cpp
|
|
|
|
$(CC) $(CPPFLAGS) -MM -MT $(subst .cpp,.o,$<) $< | sed 's%\(^.*\):%\1 $@ :%g' >$@
|
|
|
|
|
|
|
|
$(DEPENDS): ../include/grammatical.h ../include/lexical.h
|
|
|
|
|
|
|
|
|
|
|
|
parser/grammatical.d: ../include/lexical.h
|
|
|
|
|
|
|
|
parser/lexical.cpp: parser/lexical.l
|
|
|
|
cd parser && flex lexical.l
|
|
|
|
[ -f ../include/lexical.h ] && touch ../include/lexical.h
|
|
|
|
|
|
|
|
parser/grammatical.cpp: parser/grammatical.y
|
|
|
|
cd parser && bison grammatical.y
|
|
|
|
[ -f ../include/grammatical.h ] && touch ../include/grammatical.h
|
|
|
|
|
|
|
|
../include/grammatical.h: parser/grammatical.y parser/grammatical.cpp
|
|
|
|
../include/lexical.h: parser/lexical.l parser/lexical.cpp
|
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.o *.d parser/*.{o,d} parser/{lexical,grammatical}.cpp ../include/{lexical,grammatical}.h
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -f makemap
|