# $Id: Makefile,v 3.0.1.8 94/04/25 19:09:07 sadinoff Exp Locker: sadinoff $
# Copyright(c) 1994  Danny Sadinoff
# See section COPYING for conditions for redistribution

#The CITY macro should be set to one of the following:
#ATLANTA AUSTIN BERLIN BOGOTA BOSTON BUENOS_AIRES BUFFALO CHICAGO
#CINCINNATI CLEVELAND DALLAS DENVER DETROIT HAWAII HOUSTON JERUSALEM
#JOHANNESBURG LONDON LOS_ANGELES MIAMI MEXICO_CITY NEW_YORK OMAHA
#PHILADELPHIA PHOENIX PITTSBURGH SAINT_LOUIS SAN_FRANCISCO SEATTLE
#TORONTO VANCOUVER WASHINGTON_DC

##  This sets the default latitude, longitude and timezone.
##  See the README file for more information
CITY = BOSTON

#These are the environment variables queried by hebcal.  
#Make sure that the double-quotes around the name survive whatever
#shell you're using.  
ENV_CITY = '"CITY"'
ENV_OPTS = '"HEBCAL_OPTS"'

#if you run into compilation problems, try changing the cc to gcc
CC = gcc

#there is no need to change anything below this line
#-----------------------------------------------------------------

CFLAGS =  -O2
LDFLAGS = -lm

OBJ = start.o hebcal.o greg.o error.o danlib.o mygetopt.o rise.o \
      common.o holidays.o sedra.o gnu.o

CFILES = common.c danlib.c error.c mygetopt.c greg.c hebcal.c\
         holidays.c rise.c sedra.c start.c gnu.c

HFILES = common.h danlib.h error.h mygetopt.h\
        greg.h hebcal.h mymath.h mystring.h mytime.h\
	rise.h sedra.h proto.h

FILES = $(CFILES) $(HFILES) COPYING CHANGES README hebcal.man


hebcal:  $(OBJ) hebcal.1 
	 $(CC) $(OBJ) -o hebcal $(CFLAGS) $(LDFLAGS)

# This hack gets the environment variable from the makefile to the
# manpage.  I sure hope everyone has m4.
hebcal.1:	 hebcal.man Makefile
	 cat hebcal.man | \
	 m4 -DENV_CITY=$(ENV_CITY) -DENV_OPTS=$(ENV_OPTS) - > hebcal.1

MANUAL:	 hebcal.1
	 nroff -man hebcal.1 | sed 's/_[^A-Za-z0-9 ]//g' > MANUAL

rise.c:	rise.h 

hebcal.o:	hebcal.h common.h danlib.h error.h rise.h greg.h\
                   proto.h sedra.h hebcal.c

sedra.o:	 sedra.h hebcal.h sedra.c

gnu.o:		 gnu.c

greg.o:		 greg.h error.h proto.h greg.c mytime.h mystring.h

error.o:	 error.h proto.h error.c

danlib.o:	 danlib.h proto.h error.h  danlib.c

mygetopt.o:	 mygetopt.h mygetopt.c

common.o:	 common.h greg.h hebcal.h proto.h error.h common.c

start.o:	 start.c hebcal.h common.h mygetopt.h danlib.h greg.h error.h\
                   proto.h mystring.h mymath.h Makefile
	 $(CC) $(CFLAGS) -c -D$(CITY) \
	 -DENV_OPTS=$(ENV_OPTS) -DENV_CITY=$(ENV_CITY)\
	 start.c -o start.o 

print:	$(FILES) hebcal.1 MANUAL
	enscript -G2r -pprintout1.ps $? MANUAL
	ptroff -t -man hebcal.1 > printout2.ps
	touch print
	can MANUAL

DIRECTORY = hebcal_dist
shar:	$(FILES)  Makefile.dist SHARTOP
	create $(DIRECTORY)
	/bin/rm -f $(DIRECTORY)/*
	/bin/rm -f hebcal.dist
	cp $(FILES) $(DIRECTORY)
	cp Makefile.dist $(DIRECTORY)/Makefile
	cp SHARTOP hebcal.dist
	chmod u+w hebcal.dist
	shar -vpX $(DIRECTORY) >> hebcal.shar
	/bin/rm -f $(DIRECTORY)/*
	rmdir $(DIRECTORY)
	

clean:
	rm -f *.o *~ core hebcal.1 MANUAL
	du

touch:	
	touch $(CFILES)       

lint:	$(CFILES) $(HFILES)
	$(LINT) -cxp $(CFILES)

