Some scripts are generated automatically at compilation time. If the shell environment is set properly, these scripts are accessible from a shell terminal.
- get_cpp gives the compiler options used to build the library
- get_inc gives all the include directive options required for C++ compilation with the GET library
- get_lib gives the options required to link a program with the GET library and all other needed libraries
The scripts get_base_inc and get_base_lib show only the options related to the GET library, and not the other libraries.
The following is an example of a simplified makefile:
# Compilation options
CPP := g++
CPPFLAGS := ${shell get_cpp}
INCFLAGS := ${shell get_inc}
LDFLAGS := ${shell get_lib}
# Library source file
MY_SRC := #$(shell ls *.cpp)
MY_OBJ := #$(LIB_SRC:%.cpp=%.o)
MY_INC := #$(shell ls *.hh)
# Program executable
EXE := my_program
#===============================================================
# Dependencies
all: ${EXE}
@echo ""
@echo "Programs:"
@echo " "${EXE}
@echo ""
# Object files
%.o: %.cpp ${MY_INC}
@echo ""
@echo "--> Compiling object $*"
${CPP} $< ${CPPFLAGS} ${INCFLAGS} -c -o $@
@echo ""
# Program
${EXE}: ${MY_OBJ}
@echo ""
@echo "--> Linking program $*"
${CPP} $< ${CPPFLAGS} ${INCFLAGS} ${LDFLAGS} -o $*
@echo ""