# 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: Fedora43
#        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++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 
# 31-Aug-2026

# 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 clean
> gmake --no-print-directory


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

