# Makefile for SourceProfiler  -  Invoke using "gmake" or "gmake clean"
# Mahlon R. Smith - The Software Samurai
# Tools: G++ / Gcc 4.8.1 (or greater) for GNU/Linux (full C++11 support)
#        ncursesw link library:  5.9.20130511 (or greater)
#        libncursesw.so.5 dynamic-link library (or greater)
# 
# This Makefile is for building srcprof with both dialog-based and 
# text-based interfaces.
# 
# See 'Make_textonly' for building srcprof with the text-only interface.
# 
# 30-Oct-2015

.RECIPEPREFIX = >

HFILES = SrcProf.hpp SrcProf_File.hpp GlobalDef.hpp NCurses.hpp \
         NCursesKeyDef.hpp NcWindow.hpp NcDialog.hpp gString.hpp 
LFILES = NcDialog.a
OFILES = SrcProf.o SrcProf_Analyze.o SrcProf_List.o SrcProf_Dialog.o \
         SrcProf_File.o

COMPILE = g++ -x c++ -std=gnu++11 -Wall -c

srcprof: $(OFILES) $(LFILES)
> g++ -o srcprof $(OFILES) $(LFILES) -lncursesw

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

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

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

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

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


# Refresh the NcDialog family of header files and the link library
# from the source directory. Note that the path to the NcDialog/Dialog directory 
# may be different on your system, depending on where you installed it.
.PHONY: refreshlib
refreshlib:
> echo '** Refreshing SrcProf copy of NcDialog headers and library **'
> rsync -pogtiu ../NcDialog/Dialog/NcDialog.a ./.
> rsync -pogtiu ../NcDialog/Dialog/GlobalDef.hpp ./.
> rsync -pogtiu ../NcDialog/Dialog/NCurses.hpp ./.
> rsync -pogtiu ../NcDialog/Dialog/NCursesKeyDef.hpp ./.
> rsync -pogtiu ../NcDialog/Dialog/NcWindow.hpp ./.
> rsync -pogtiu ../NcDialog/Dialog/gString.hpp ./.
> rsync -pogtiu ../NcDialog/Dialog/NcDialog.hpp ./.
> rsync -pogtiu ../NcDialog/Dialog/gString.cpp ./.


#** Remove old object files and the executable for a clean build **
.PHONY: clean
clean:
> rm $(OFILES) srcprof

