
CC=gcc
CFLAGS=-O
XCFLAGS=
XLIBPATH=/usr/local/X11R5/lib  
XINCL=
XNO=
XLIB= -lXt -lX11 

# sets up an arc dependant subdirectory under DQS/ARCS
# ans builds the default distribution

default	:
	UTIL/make_arcs make -f Makefile

#******************************************************
# dirs - Make Install Directories

dirs:
	-mkdir -p $(INSTALL_DIR) $(ARC_DIR) $(BIN_DIR)
	-mkdir -p $(DOC_DIR) $(LIB_DIR) $(MAN1_DIR) $(MAN3_DIR)
	-mkdir -p $(CONF_DIR)
	-chmod 755 $(CONF_DIR)

#******************************************************
# config - Configure DQS

config:
	cd CONFIG;make clean;make;./config;cd ..

#******************************************************
# config - Configure DQS

host_ck:
	$(CC) -o CONFIG/host_ck CONFIG/host_ck.c;CONFIG/host_ck

#******************************************************
# unconfig - Unconfigure DQS

unconfig:
	cd CONFIG;make clean;make;./config -u;cd ..

#******************************************************
# sets up an arc dependant subdirectory under DQS/ARCS
# and builds the DQS checpointing library

ckpt:
	UTIL/make_arcs make -f Makefile $@

#******************************************************
# install the default distribution

installbin: dirs
	UTIL/make_arcs make -f Makefile $@ \
	BIN_DIR=$(BIN_DIR) DQS_ROOT=$(DQS_ROOT) \
	DQS_SYSGRP=$(DQS_SYSGRP)

#******************************************************
# install the sample conf files

installconf: dirs
	UTIL/install -o $(DQS_ROOT) -g $(DQS_SYSGRP) \
	-m 744 SRC/conf_file $(CONF_DIR)/conf_file
	UTIL/install -o $(DQS_ROOT) -g $(DQS_SYSGRP) \
	-m 744 SRC/resolve_file $(CONF_DIR)/resolve_file
	UTIL/install -o $(DQS_ROOT) -g $(DQS_SYSGRP) \
	-m 700 SRC/key_file $(CONF_DIR)/key_file
#******************************************************
#installdocs: dirs
	cp DOCS/user_guide/*.GIF $(DOC_DIR)
	cp DOCS/user_guide/*.doc $(DOC_DIR)
	cp DOCS/user_guide/*.htm $(DOC_DIR)
	cp DOCS/user_guide/*.ps  $(DOC_DIR)

#******************************************************
# installall

installall: installbin installconf


#******************************************************
realclean:
	rm -r -f ARCS
	cd CONFIG;	make -f Makefile clean
	cd MAN;         make -f Makefile clean
	cd SRC;         make -f Makefile clean
	cd UTIL;        make -f Makefile clean
	cd UTIL/TEST;   make -f Makefile clean
	cd DOC;         make -f Makefile clean
	rm -f *~ manifest *.out Part* *.tar *.Z *.gz OUT core typescript
	rm -f CVS.tar.gz

######################################################
#******************************************************
clean:
	cd CONFIG;	make -f Makefile clean
	cd MAN;         make -f Makefile clean
	cd SRC;         make -f Makefile clean


######################################################
######################################################
######################################################
# multi-architecture makes 

#******************************************************
# pall - Parrallel Make
# uses "rsh" to make binaries for multiple arcs concurrently
# see .PMakefile
# output from all makes placed in the file OUT
# ex:
# make pall
# make pdirs
# make pinstallbin
# make pinstallall

pall:
	@$(MAKE) -f Makefile rdist
	@cd UTIL;$(MAKE) -f Makefile pmake
	UTIL/pmake .PMakefile OUT

#******************************************************
# pdirs - Parallel Make Dirs

pdirs:
	@cd UTIL;$(MAKE) -f Makefile pmake
	UTIL/pmake .PMakefile OUT dirs

#******************************************************
#pinstallbin - Parallel Install Bin

pinstallbin:
	@cd UTIL;$(MAKE) -f Makefile pmake
	UTIL/pmake .PMakefile OUT installbin

#******************************************************
# pinstallall - Parallel Installal

pinstallall:
	@cd UTIL;$(MAKE) -f Makefile pmake
	UTIL/pmake .PMakefile OUT installall

######################################################
######################################################
######################################################
# the rest of these are for development only
# read the disclaimers before using them!

#******************************************************
# builds the user_interface and design docs.
# also builds a set of DQS function man pages
# and reference docs.
# DON'T DO THIS UNLESS YOU HAVE LATEX and DVIPS!
# otherwise you will trash the preformatted docs!

doc:
	cd SRC; make -f Makefile $@

#******************************************************
# make the readme file(already done for distribution)
# DON'T DO THIS UNLESS YOU HAVE LATEX and DVIPS!
# otherwise you will trash the preformatted docs!

readme:
	cd DOC/readme; make -f Makefile $@

#******************************************************
# this is really just for development
# DON'T DO THIS UNLESS YOU HAVE LATEX and DVIPS!
# otherwise you will trash the preformatted docs!

everything:	dqs ckpt installbin	\
		installlib installman1	\
		installman3 installdoc

#******************************************************
# this is really just for development
# DON'T DO THIS UNLESS YOU HAVE LATEX and DVIPS!
# otherwise you will trash the preformatted docs!

distribution:   readme doc clean

#******************************************************

backup:	gzip
	cp DQS.tar.gz /ds9/a/users/queuing/DQS.tar.gz.`date +%m.%d.%y.%H:%M`

#******************************************************

backupcvs:
	cd /margit/c/users/dqs;tar -cvf CVS.tar CVS; \
	rm -f CVS.tar.gz; /usr/local/bin/gzip CVS.tar; \
	cp CVS.tar.gz /ds9/a/users/queuing/CVS.tar.gz.`date +%m.%d.%y.%H:%M`

#******************************************************

rdist:	clean
	cd .. ;/usr/ucb/rdist -f DQS/.distfile

#******************************************************

manifest: clean
	cd ..;/usr/local/bin/findsrc -dy -oDQS/manifest DQS;

#******************************************************

tar:	manifest
	cd ..;tar -cvf DQS.tar DQS; mv DQS.tar DQS; \
	cd DQS;compress DQS.tar

#******************************************************

gzip:	manifest
	cd ..;tar -cvf DQS.tar DQS; mv DQS.tar DQS; \
	cd DQS;/usr/local/bin/gzip DQS.tar

#******************************************************

fd0:	gzip
	gnutar -cvMf /dev/fd0 DQS.tar.gz

#******************************************************

fd1:	gzip
	gnutar -cvMf /dev/fd1 DQS.tar.gz

#******************************************************

cvsfd0:
	rm -f CVS.tar.gz
	gnutar -czvf CVS.tar.gz /margit/c/users/dqs/CVS 
	gnutar -cvMf /dev/fd0 CVS.tar.gz

