#++++++++++++++++-I.
#.IDENTIFICATION Makefile.src
#.LANGUAGE       Make (makefile script)
#.AUTHOR         Francois Ochsenbein [CDS]
#.ENVIRONMENT    Unix
#.KEYWORDS       
#.VERSION  1.0   03-Oct-1991
#.PURPOSE        Template Makefile for Portable Packages
#.COMMENTS      
#	The "install" option in the Makefile copies the executables and 
#	man pages to public directories. Just edit the Makefile, and modify 
#	the definitions according to your installation.
#	Some alternatives are proposed as comments.
#	
#	Please sent your comments, questions, etc.. to the author
#	=====================================================================
#	Internet:  francois@simbad.u-strasbg.fr        SPAN: SIMBAD::FRANCOIS
#	Phone:  +33 88 35 84 11                      Fax: +33 88 25 01 60
#	Post:  Observatoire Astronomique
#	11, rue de l'Universite
#	67000 STRASBOURG, France
#	=====================================================================
#----------------

# DIRECTORIES	--------------------------------
D_INC = .
D_BIN = /usr/local/bin
D_SHS = /usr/local/bin
D_LIB = /usr/local/lib
D_MAN = /usr/local/man
#D_MAN = /usr/man/manl

# PROGRAMS	--------------------------------
# The definitions of COPY and MLINK are used at CDS.
#	 Possible alternatives are commented out.
CC     = cc 
STRIP  = strip
COPY   = cpo	# cpo preserves the Ownership & Dates, etc...
#COPY  = cp 	# Standard copy
RM     = rm
MLINK  = $(D_MAN)/linkman # Program to Link Man pages
#MLINK = ls -l		  # This is a possible alternative
TEXMAN = texroff	  # Transform .tex into Roff

# C options	--------------------------------
DEBUG = 
C_OPT = -O
SYS =
CFLAGS = $(C_OPT) $(DEBUG) $(SYS) -I.

# FILES		--------------------------------
BIN = gsc gsc-server
OBJ = decode_c.o dispos.o dtos.o find_reg.o get_head.o \
	prtgsc.o tab2rec.o to_d.o 
OBJS = decode_c.o dispos.o dtos.o get_head.o \
	tab2rec.o 
SHS = myScript
MAN = myManPages.1

# RULES		--------------------------------
.SUFFIXES: .o .c 
.c.o:
	$(CC) $(CFLAGS) -c $<
.SUFFIXES: .tex .1 .3
.tex.1:
	$(TEXMAN) $<
.tex.3:
	$(TEXMAN) $<

# DEPENDENCIES	--------------------------------

all: ../bin/gsc ../bin/gsc-server load

../bin/gsc: gsc.o gsc.h $(OBJ)
	$(CC) gsc.o $(OBJ) -lm -o $@
	$(STRIP) $@

../bin/gsc-server: gsc-server.c gsc.h $(OBJS)
	$(CC) $(CFLAGS) gsc-server.c $(OBJS) -lm -o $@
	$(STRIP) $@

load: ../bin/gsc_dec ../bin/encode ../bin/decode ../bin/tr_regions ../bin/r_region ../bin/genreg ../bin/newheader

../bin/encode: encode.o 
	$(CC) encode.o -lm -o $@

../bin/decode: decode.o get_head.o decode_c.o gsc.h
	$(CC) decode.o get_head.o decode_c.o -lm -o $@

 ../bin/gsc_dec: gsc_dec.o get_head.o decode_c.o find_reg.o gsc.h
	$(CC) gsc_dec.o get_head.o decode_c.o find_reg.o -lm -o $@

../bin/tr_regions: tr_regions.o tod.o 
	$(CC) tr_regions.o tod.o -lm -o $@

../bin/r_region: r_region.o
	$(CC) r_region.o -lm -o $@

../bin/genreg: genreg.o get_head.o find_reg.o gsc.h
	$(CC) genreg.o get_head.o find_reg.o -lm -o $@

../bin/newheader: newheader.o get_head.o gsc.h
	$(CC) newheader.o get_head.o -lm -o $@

decode: decode.o get_head.o decode_c.o gsc.h
	$(CC) decode.o get_head.o decode_c.o -lm -o $@

clean:
	rm -f *.o
	rm -f $(BIN)
	rm -f *.log
	rm -f core



