#
# Copyright 2004 Peter Mills. All rights reserved.
#
# The make file for building a set of templated libraries of various
# algorithmic constructs. Chief amongst these are: binary search
# routines, heapsort routines, a class for working with dates and times,
# a Runge-Kutta integrator and a linked list class.
#
OPT=-O2
CPP = g++
CFLAGS = $(OPT) -Wno-deprecated
#BASE_PATH = /home/petey
#BASE_PATH = /home/home/pmills
#BASE_PATH = /home/pmills
BASE_PATH = /work/patmills
LIB_PATH = $(BASE_PATH)/lib
INCLUDE_PATH = $(BASE_PATH)/include
BIN_PATH = $(BASE_PATH)/bin
#GSL_INCLUDE = $(INCLUDE_PATH)
GSL_INCLUDE = /opt/sharcnet/gsl/current/include
VPATH = datasets/ sparse/
all: libpetey$(OPT).a libdataset$(OPT).a libsparse$(OPT).a
libdataset$(OPT).a: install_petey
make -C datasets LIB_DIR=$(LIB_PATH) INCLUDE_DIR=$(INCLUDE_PATH) OPT_VER=$(OPT)
libsparse$(OPT).a: install_petey
make -C sparse LIB_PATH=$(LIB_PATH) INCLUDE_PATH=$(INCLUDE_PATH) \
BIN_PATH=$(BIN_PATH) OPT_VER=$(OPT)
allopt:
make OPT=-g all
make OPT=-pg all
make OPT=-O2 all
clean:
rm -f libpetey*.a
rm -f libpetey*.so
rm -f *.o
make -C sparse OPT=$(OPT) clean_all
make -C datasets OPT_VER=$(OPT) clean
make -C datasets clean
make -C datasets OPT_VER=-g clean
make -C datasets OPT_VER=-pg clean
make -C datasets OPT_VER=-O2 clean
install_petey: libpetey$(OPT).a
cp libpetey$(OPT).a $(LIB_PATH)
cp peteys_tmpl_lib.h $(INCLUDE_PATH)
cp time_class.h $(INCLUDE_PATH)
cp string_petey.h $(INCLUDE_PATH)
cp linked.h $(INCLUDE_PATH)
cp tree_tmp.h $(INCLUDE_PATH)
cp bit_array.h $(INCLUDE_PATH)
cp tree_lg.h $(INCLUDE_PATH)
cp tree_lgi.h $(INCLUDE_PATH)
cp kextreme.h $(INCLUDE_PATH)
cp supernewton.h $(INCLUDE_PATH)
cp parse_command_opts.h $(INCLUDE_PATH)
cp error_codes.h $(INCLUDE_PATH)
install: install_petey
make install -C datasets LIB_DIR=$(LIB_PATH) INCLUDE_DIR=$(INCLUDE_PATH) OPT_VER=$(OPT)
make install -C sparse LIB_PATH=$(LIB_PATH) INCLUDE_PATH=$(INCLUDE_PATH) \
BIN_PATH=$(BIN_PATH) OPT_VER=$(OPT)
install_allopt: libpetey-g.a libpetey-O2.a libpetey-pg.a
cp libpetey-g.a $(LIB_PATH)
cp libpetey-O2.a $(LIB_PATH)
cp libpetey-pg.a $(LIB_PATH)
cp peteys_tmpl_lib.h $(INCLUDE_PATH)
cp time_class.h $(INCLUDE_PATH)
cp string_petey.h $(INCLUDE_PATH)
cp linked.h $(INCLUDE_PATH)
cp tree_tmp.h $(INCLUDE_PATH)
cp bit_array.h $(INCLUDE_PATH)
cp tree_lg.h $(INCLUDE_PATH)
cp tree_lgi.h $(INCLUDE_PATH)
cp kextreme.h $(INCLUDE_PATH)
cp supernewton.h $(INCLUDE_PATH)
cp parse_command_opts.h $(INCLUDE_PATH)
make install -C datasets LIB_DIR=$(LIB_PATH) INCLUDE_DIR=$(INCLUDE_PATH) OPT_VER=-g
make install -C sparse LIB_PATH=$(LIB_PATH) INCLUDE_PATH=$(INCLUDE_PATH) \
BIN_PATH=$(BIN_PATH) OPT_VER=-g
make install -C datasets LIB_DIR=$(LIB_PATH) INCLUDE_DIR=$(INCLUDE_PATH) OPT_VER=-O2
make install -C sparse LIB_PATH=$(LIB_PATH) INCLUDE_PATH=$(INCLUDE_PATH) \
BIN_PATH=$(BIN_PATH) OPT_VER=-O2
make install -C datasets LIB_DIR=$(LIB_PATH) INCLUDE_DIR=$(INCLUDE_PATH) OPT_VER=-pg
make install -C sparse LIB_PATH=$(LIB_PATH) INCLUDE_PATH=$(INCLUDE_PATH) \
BIN_PATH=$(BIN_PATH) OPT_VER=-pg
# build the static library:
libpetey$(OPT).a: peteys_tmpl_lib$(OPT).o \
tree_tmp$(OPT).o \
time_class$(OPT).o \
string_petey$(OPT).o \
linked$(OPT).o \
bit_array$(OPT).o \
supernewton$(OPT).o \
kextreme$(OPT).o \
tree_lg$(OPT).o \
tree_lgi$(OPT).o \
parse_command_opts$(OPT).o
ar -rs libpetey$(OPT).a \
peteys_tmpl_lib$(OPT).o \
tree_tmp$(OPT).o \
time_class$(OPT).o \
string_petey$(OPT).o \
linked$(OPT).o \
bit_array$(OPT).o \
supernewton$(OPT).o \
kextreme$(OPT).o \
tree_lg$(OPT).o \
tree_lgi$(OPT).o \
parse_command_opts$(OPT).o
# object file for the templated routines:
peteys_tmpl_lib$(OPT).o: peteys_tmpl_lib.cc bin_search.cc heapsort_tmpl.cc \
rk_dumb_tmpl.cc treesort.cpp
$(CPP) $(CFLAGS) -c peteys_tmpl_lib.cc -o $@
# compile a templated linked list class:
linked$(OPT).o: linked.cc linked.h time_class.h string_petey.h
$(CPP) $(CFLAGS) -c linked.cc -o $@
# compile the time class:
time_class$(OPT).o: time_class.cc time_class.h
$(CPP) $(CFLAGS) -c time_class.cc -o $@
# compile the string class (not well tested--use with caution...)
string_petey$(OPT).o: string_petey.cc string_petey.h
$(CPP) $(CFLAGS) -c string_petey.cc -o $@
# compile the tree class (not well tested--use with caution...)
tree_tmp$(OPT).o: tree_tmp.cpp tree_tmp.h time_class.h string_petey.h
$(CPP) $(CFLAGS) -c tree_tmp.cpp -o $@
# compile bit array class:
bit_array$(OPT).o: bit_array.cc bit_array.h
$(CPP) $(CFLAGS) -c bit_array.cc -o $@
# compile the supernewton root-finding algorithm:
supernewton$(OPT).o: supernewton.cc
# this one requires the GSL library:
$(CPP) $(CFLAGS) -I$(GSL_INCLUDE) -c supernewton.cc -o supernewton$(OPT).o
# compile the k-extreme search algorithm:
kextreme$(OPT).o: kextreme.cc kextreme.h tree_lg.h tree_lgi.h
$(CPP) $(CFLAGS) -c kextreme.cc -o $@
tree_lgi$(OPT).o: tree_lgi.cc tree_lgi.h string_operators.h
$(CPP) $(CFLAGS) -c tree_lgi.cc -o $@
tree_lg$(OPT).o: tree_lg.cc tree_lg.h string_operators.h
$(CPP) $(CFLAGS) -c tree_lg.cc -o $@
parse_command_opts$(OPT).o: parse_command_opts.cc parse_command_opts.h
$(CPP) $(CFLAGS) -c parse_command_opts.cc -o $@