OPTFLAGS = -Os CFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L $(OPTFLAGS) GENSRCS = lexer.c parser.c GENHDRS = lexer.h parser.h SRCS = $(sort $(wildcard *.c) $(GENSRCS)) OBJS = $(SRCS:.c=.o) TARGET = nqasm all: $(TARGET) clean: rm -f $(GENSRCS) $(GENHDRS) $(OBJS) $(TARGET) lexer.c lexer.h: lexer.l flex $< parser.c parser.h: parser.y bison $< lexer.o: parser.h parser.o: lexer.h %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ $(TARGET): $(OBJS) $(CC) $(CFLAGS) $^ -o $@ .PHONY: all clean