# Makefile for Wayclip utility
#   Invoke using "gmake"                     (build)
#         or     "gmake clean"               (remove old intermediate files)
#         or     "gmake all"                 (both 'clean' and 'build)
# Mahlon R. Smith, The Software Samurai
# Tools: Developed under GNU Linux: Fedora41
#        gnome-terminal, konsole and xterm
#        GNU C++ compiler: G++ v:14.2.1
# Note: The libraries and applications compiled with this makefile use 
#       functionality defined by the C++11 standard. As such you will need to 
#       use the -std=gnu++11 compile-time switch which became fully supported 
#       in GCC 4.7.1 and higher.
#       C++11 support is required for:
#        1) instantiating arrays of initialized class instances
#        2) scoped enums
#        3) std::chrono
#        4) std::thread
#        5) std::mutex
#        6) various additional functionality
# 24-Mar-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++11 -Wall -c
# Special compile: stop-on-error
#COMPILE = g++ -x c++ -std=gnu++11 -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 clean
> gmake --no-print-directory


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

