# Makefile for Dialog4  -  Invoke using "gmake" or "gmake clean"
# Mahlon R. Smith, The Software Samurai
# Tools: See information on development tools in "../Dialog1/Makefile"
# 
# NOTE: This application uses the C++11 std::thread class and requires that the 
# pthread library be linked. 
# 
# Note the '-pthread' parameter for the 'COMPILE' macro. This allows the 
# preprocessor to scan for syntax problems with thread-specific code. 
# (Of course, you and I would never make a coding mistake.)
# 
# 11-Jul-2025

# This variable is defined for technical reasons
# (see 'make' documentation for more information)
.RECIPEPREFIX = >

# Files for Dialog4 Application
HFILES = GlobalDef.hpp NCurses.hpp NCursesKeyDef.hpp NcWindow.hpp NcDialog.hpp \
         gString.hpp WaylandCB.hpp CMouseTest.hpp DMouseTest.hpp \
         BillboardTest.hpp RTL_ContentTest.hpp ThreadTest.hpp \
         ShellTest.hpp ProgbarTest.hpp ExpandTest.hpp

# Files associated with the NcDialog API
APIFILES = GlobalDef.hpp NCurses.hpp NCursesKeyDef.hpp NcWindow.hpp \
           NcDialog.hpp gString.hpp WaylandCB.hpp

# File associated with ExtendTest group
ETFILES = PinwheelTest.hpp Pinwheel.hpp \
          ChartTest.hpp Chart.hpp \
          SliderTest.hpp \
          ClInfoTest.hpp 

LFILES = NcDialog.a
OFILES = Dialog4.o CMouseTest.o DMouseTest.o BillboardTest.o RTL_ContentTest.o \
         ThreadTest.o ShellTest.o ProgbarTest.o Progbar.o \
         ExpandTest.o PinwheelTest.o ChartTest.o Chart.o SliderTest.o ClInfoTest.o

COMPILE = g++ -x c++ -std=gnu++11 -pthread -Wall -c
# Special compile: stop-on-error
#COMPILE = g++ -x c++ -std=gnu++11 -pthread -Wall -fmax-errors=1 -c

Dialog4: $(OFILES) $(LFILES)
> g++ -o Dialog4 $(OFILES) NcDialog.a -lncursesw -lpthread

Dialog4.o: Dialog4.cpp $(HFILES) DialogAppShared.hpp 
> $(COMPILE) Dialog4.cpp

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

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

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

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

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

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

ProgbarTest.o: ProgbarTest.cpp $(HFILES) Progbar.hpp
> $(COMPILE) ProgbarTest.cpp

Progbar.o: Progbar.cpp $(HFILES) Progbar.hpp
> $(COMPILE) Progbar.cpp

ExpandTest.o: ExpandTest.cpp $(HFILES) $(ETFILES)
> $(COMPILE) ExpandTest.cpp

PinwheelTest.o: PinwheelTest.cpp $(HFILES) PinwheelTest.hpp Pinwheel.hpp
> $(COMPILE) PinwheelTest.cpp

ChartTest.o: ChartTest.cpp $(HFILES) ChartTest.hpp Chart.hpp
> $(COMPILE) ChartTest.cpp

Chart.o: Chart.cpp $(APIFILES) Chart.hpp
> $(COMPILE) Chart.cpp

SliderTest.o: SliderTest.cpp $(HFILES) SliderTest.hpp
> $(COMPILE) SliderTest.cpp

ClInfoTest.o: ClInfoTest.cpp $(HFILES) ClInfoTest.hpp
> $(COMPILE) ClInfoTest.cpp


#** Remove old object files and the executable for a clean build **
.PHONY: clean
clean:
> rm -f $(OFILES) Dialog4 1>/dev/null 2>/dev/null

