You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

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)
9 years ago
CC=g++
9 years ago
SOURCE = $(wildcard *.cpp) parser/lexical.cpp parser/grammatical.cpp
DEPENDS = $(subst .cpp,.d,$(SOURCE))
OBJECTS = $(subst .cpp,.o,$(SOURCE))
9 years ago
makemap: $(OBJECTS) $(MODOBJECTS)
$(CC) -o $@ $(OBJECTS) $(MODOBJECTS) $(LDFLAGS)
include $(DEPENDS)
%.o: %.cpp
$(CC) -c $(CFLAGS) -o $@ $<
9 years ago
%.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
9 years ago
parser/lexical.cpp: parser/lexical.l
flex -o $@ --header-file=../include/lexical.h $<
[ -f ../include/lexical.h ] && touch ../include/lexical.h
9 years ago
parser/grammatical.cpp: parser/grammatical.y
bison -o $@ --defines=../include/grammatical.h $<
[ -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
9 years ago
clean:
rm -f *.o *.d parser/*.{o,d} parser/{lexical,grammatical}.cpp ../include/{lexical,grammatical}.h
9 years ago
distclean: clean
rm -f makemap