# Makefile for Keymap 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: 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.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
# 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 = Keymap.o KeymapAuto.o
HFILES = Keymap.hpp \
         GlobalDef.hpp NCurses.hpp NCursesKeyDef.hpp NcWindow.hpp NcDialog.hpp \
         gString.hpp \
         NCursesKeyDef_auto.hpp
# Enable NCursesKEyDef_auto.hpp if "#included" in NCursesKeyDef.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 **
keymap: $(OFILES) NcDialog.a
> g++ -o keymap $(OFILES) NcDialog.a -lncursesw

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

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

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

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

