# Makefile for TFMTest:
#     "gmake"           Build the EarthPoints application
#     "gmake clean"     Delete the executable file, all object files and AnsiCmd.lib
#     "gmake all"       Combined refresh of support modules + "gmake clean" + "gmake"
# 
# Mahlon R. Smith
# Tools: G++ / Gcc 14.3.1 for Linux (Fedora 41 workstation)
# 
# 24-Dec-2025

# This variable is defined for technical reasons
# i.e. to eliminate tab characters from the makefile.
.RECIPEPREFIX = >

# Header-file groups and Object-file groups
HFILES  = TFMan.hpp gString.hpp
OFILES  = TFMTest.o gString.o

COMPILE = g++ -x c++ -std=gnu++17 -Wall -c

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

TFMTest.o: TFMTest.cpp $(HFILES)
> $(COMPILE) TFMTest.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.
#       The 'rsync' utility compares mod dates and updates if source is newer.
.PHONY: all
all:
> @echo '** Refreshing Support Modules **'
> rsync -pogtiu ../TFMan.hpp ./.
> rsync -pogtiu ../gString.hpp ./.
> rsync -pogtiu ../gString.cpp ./.
> gmake -si clean
> gmake --no-print-directory

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

