# 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++11 standard. As such you will need to 
#       use the -std=gnu++11 compile-time switch which became fully supported 
#       in GCC 4.8 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
# Note: In future releases, C++17 support (Gcc 8+) may be required, but 
#       those new features are not currently required.
# 23-Jun-2024

# 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++11 -Wall -c
# Special compile: stop-on-error
#COMPILE = g++ -x c++ -std=gnu++11 -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

