# makefile, empirical
CXX = g++ 
CXXFLAGS = -I.
LN  = g++ 
LNFLAGS = 
## the paths where the algoritms include file and library are installed
#INCDIR = $(HOME)/include
#LIBDIR = $(HOME)/lib
HXX_FILES   = date.h dated.h dated_util.h dated_obs.h \
              security_price_history.h stock_price_history.h 
CXX_FILES   = date.cc dated_obs.cc dated_obs_fin.cc \
              security_price_history.cc stock_price_history.cc stock_price_history_util.cc 
TST_FILES   = tst.cc tst_date.cc tst_dated.cc tst_dated_util.cc \
              tst_dobs.cc \
              tst_security_price_history.cc tst_stock_price_history.cc

LIBOBJS = date.o  \
          dated_obs.o \
          dated_obs_fin.o \
          security_price_history.o \
          stock_price_history.o \
          stock_price_history_util.o 
LIB = libempir.a
tst: tst.o $(LIB)
	$(LN)  tst.o -L. -lempir -lm -o tst $(LNFLAGS) 
$(LIB): $(LIBOBJS) 
	ar ur $(LIB) $(LIBOBJS)
	ranlib $(LIB) 
tst.o: $(TSTFILES)
ALLFILES = $(CXX_FILES) $(TST_FILES) $(HXX_FILES)
empirical_progs.zip: $(ALLFILES)
	zip -u empirical_progs.zip makefile $(ALLFILES)
empirical_progs.tar.gz: $(ALLFILES)
	tar -cf empirical_progs.tar makefile $(ALLFILES)
	gzip empirical_progs.tar
##### ignore below ###########################

#INCDIR = $(ROOT)/include
WWWOBJS = empirical_progs.zip empirical_progs.tar.gz
WWWDIR = $(ROOT)/public_html/gcc_prog
empirical_sources.zip:  makefile tst.cc readme 
	zip -u empirical_sources.zip makefile readme tst.cc 
install: install-www
install-h: 
install-www: $(WWWOBJS)
	cp  $(WWWOBJS) $(WWWDIR)
install-lib:
install-doc:
install-src:
pack:  empirical_sources.zip 
clean:
	rm -f  lib*.a tst *.o *~ $(WWWOBJS)
realclean: clean
	rm -f  lib*.a tst *.o 
unpack:
	unzip -u -o empirical_sources 
crunch: realclean empirical_sources.zip 
	zip -um empirical_sources.zip readme
	zip -um empirical_sources.zip tst.cc
	zip -um empirical_progs.zip $(ALLFILES)
	rm -f empirical_progs.zip
run: tst
	./tst
