BUILDDIR = build TARGET_SRC = main build: mkdir main all: mkdir main run mkdir: # create build directory mkdir -p $(BUILDDIR) run: # run binary ./$(BUILDDIR)/main main: lex.yy.c # compile c file cc $(BUILDDIR)/lex.yy.c -o $(BUILDDIR)/$(TARGET_SRC) -lfl lex.yy.c: main.lex # generate c file flex -o $(BUILDDIR)/lex.yy.c $(TARGET_SRC).lex clean: # wipe the build directory rm -f $(BUILDDIR)/*