From c8a0b7157d544f2359f2373160dcc69cdef8f4de Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Sun, 23 Jul 2017 22:24:32 -0500 Subject: Initial commit --- Makefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e62c90c --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +OPTFLAGS = -O2 +CFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L $(OPTFLAGS) + +TARGETS = pattern2regex +LEXERS = $(wildcard *.l) +PARSERS = $(wildcard *.y) +SOURCES = $(wildcard *.c) +OBJECTS = $(sort $(SOURCES:.c=.o) $(LEXERS:.l=.o) $(PARSERS:.y=.o)) + +all: $(TARGETS) + +clean: + rm -f $(TARGETS) + rm -f $(OBJECTS) + rm -f $(LEXERS:.l=.c) $(LEXERS:.l=.h) + rm -f $(PARSERS:.y=.c) $(PARSERS:.y=.h) + +lex-%.c lex-%.h: lex-%.l + flex $< + +parse-%.c parse-%.h: parse-%.y + bison $< + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +pattern2regex.o: lex-pattern.h parse-pattern.h +pattern2regex: pattern2regex.o lex-pattern.o parse-pattern.o ast.o + +$(TARGETS): + $(CC) $(CFLAGS) $^ -o $@ -- cgit v1.2.3