# Makefile for Dialogx application.
#   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: See information on development tools in: "../Dialog1/Makefile"

# 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 = Dialogx.o WaylandCB.o
HFILES = Dialogx.hpp WaylandCB.hpp \
         GlobalDef.hpp NCurses.hpp NCursesKeyDef.hpp NcWindow.hpp NcDialog.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 **
Dialogx: $(OFILES) NcDialog.a
> g++ -o Dialogx $(OFILES) NcDialog.a -lncursesw

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

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


#** Build All **
.PHONY: all
all:
> gmake clean
> gmake


#** Remove object files and binary **
.PHONY: clean
clean:
> rm -f $(OFILES) Dialogx 1>/dev/null 2>/dev/null

