# Makefile for CommExtract -  Invoke using "gmake" or "gmake clean"
# 
# Mahlon R. Smith
# Tools: G++ / Gcc 13.3.1 for Linux (Fedora 39 workstation)
# 
# 30-Sep-2024

# This variable is defined for technical reasons
# (see 'make' documentation for more information)
.RECIPEPREFIX = >

# Header-file groups and Object-file groups
HFILES  = CommExtract.hpp CxFile.hpp gString.hpp 
OFILES  = CommExtract.o CxFile.o gString.o

COMPILE = g++ -x c++ -std=gnu++11 -Wall -c
# Special compile: stop-on-error
#COMPILE = g++ -x c++ -std=gnu++11 -Wall -fmax-errors=1 -c


comex: $(OFILES)
> g++ -o comex $(OFILES)

CommExtract.o: CommExtract.cpp $(HFILES)
> $(COMPILE) CommExtract.cpp

CxFile.o: CxFile.cpp $(HFILES)
> $(COMPILE) CxFile.cpp

gString.o: gString.cpp gString.hpp
> $(COMPILE) gString.cpp

#** Build All **
# NOTE: The '-i' (ignore) option is used here in case none of the targets to 
#       be removed by "clean" exist. The '-s' (silent) option is also used here.
.PHONY: all
all:
> gmake -si clean
> gmake --no-print-directory

#** Remove old object files and the executable for a clean build **
.PHONY: clean
clean:
> rm --force $(OFILES) comex

