# Makefile for Wayclip utility
#   Invoke using "gmake -f wMakefile"        (build)
#         or     "gmake -f wMakefile clean"  (remove old intermediate files)
#         or     "gmake -f wMakefile all"    (both 'clean' and 'build)
# Mahlon R. Smith, The Software Samurai
# Tools: Developed under GNU Linux: Fedora39
#        gnome-terminal, konsole and xterm
#        GNU C++ compiler: G++ v:13.3.1
# Note: The libraries and applications compiled with this makefile use 
#       functionality defined by the C++17 standard. As such you will need to 
#       use the -std=gnu++17 compile-time switch which became fully supported 
#       in GCC 8.0.0 and higher.
#       Earlier versions of the compiler using other switches that preceeded 
#       the C++17 standard may also work: -std=gnu++0x or -std=c++0x 
#       C++17 support is required for:
#        1) instantiating arrays of initialized class instances
#        2) scoped enums.
#        3) std::chrono
#        4) std::thread
#        5) std::mutex
#        6) std::filesystem
#        7) various additional functionality
# 21-Dec-2025

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

OFILES = Wayclip.o WaylandCB.o gString.o
HFILES = Wayclip.hpp WaylandCB.hpp gString.hpp


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

#** Build the application **
wayclip: $(OFILES)
> g++ -o wayclip $(OFILES)

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

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

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

#** Build All **
.PHONY: all
all:
> gmake -si -f wMakefile clean
> gmake --no-print-directory -f wMakefile


#** Remove object files and binary **
.PHONY: clean
clean:
> rm --force $(OFILES) wayclip

