########################################################
# Makefile for CSCI 435 
# Gary M. Zoppetti
########################################################

########################################################
# Variable definitions
########################################################
# C++ compiler
CXX := g++
#CXX := clang++

# Include directories, prefaced with "-I"
INCDIRS  := 

# C++ compiler flags
# Use the first for debugging, the second for release
CXXFLAGS := -g -Wall -std=c++20 $(INCDIRS)
#CXXFLAGS := -O3 -Wall -std=c++20 $(INCDIRS)

# Linker. For C++ should be $(CXX).
LINK := $(CXX)

# Linker flags. Usually none.
LDFLAGS := 

# Library paths, prefaced with "-L". Usually none.
LDPATHS := 

# Libraries used, prefaced with "-l".
LDLIBS := -lfl

GENERATED := WordCountBroke.cc

#############################################################
# Rules
#   Rules have the form
#   target : prerequisites
#   	  recipe
#############################################################

WordCountDriver : WordCountDriver.o WordCountBroke.o
	$(LINK) $(LDFLAGS) $^ -o $@ $(LDLIBS)

WordCountDriver.o : WordCountDriver.cc

WordCountBroke.o : WordCountBroke.cc

WordCountBroke.cc : WordCountBroke.l
	flex --nounput -o $@ $<

#############################################################

.PHONY : clean
clean :
	$(RM) a.out core
	$(RM) *.o *.d *~
	$(RM) WordCountDriver
	$(RM) $(GENERATED)

#############################################################
