# DO NOT MODIFY THIS MAKEFILE.
# It was generated automatically by fixmake
# from input file makefile.gen and writing to makefile.
#
# Makefile for mkproto -- a program for generating for C language prototypes.
# Original version by Eric R. Smith
# Modifications made by Robert E. Bruccoleri, Bristol-Myers Squibb
# Pharmaceutical Research Institute
# Makefile macros for a Linux machine running gfortran and gcc.

# Flags -- note that common flags go on the binary definitions

CFLAGS        = -g
COPTFLAGS     = -g -O2 
CSPECOPTFLAGS = -g -O0
CPPFLAGS      = -DLANGUAGE_C -Dlinux -Dunix
FFLAGS        = -g
FOPTFLAGS     = -g -O2 
FSPECOPTFLAGS = -g -O0
FCPPFLAGS     = -Dlinux -Dunix 
ARFLAGS       = qs
LDFLAGS       = 
MAXPROCS      = 20

# Binaries

CC            = gcc44 -ffloat-store -pthread
CPP	      = gcc44 -E
FC            = gfortran44 -std=gnu -fno-second-underscore -fno-f2c -ffloat-store -pthread -fdump-core -fbacktrace 
FLECS         = $(CGBIN)/flecs
FCPP          = $(CGBIN)/fcpp -F
YACC          = $(CGBIN)/myacc
LEX           = flex
INSTALL	      = $(CGBIN)/install
MKPROTO	      = $(CGBIN)/mkproto
SHELL	      = /bin/sh


BIN = $(CGBIN)
MAN = $(CGD)/cat1
PSMAN = $(CGD)

SHELL = /bin/sh

SOURCES = mkproto.c mkproto.h mkproto.1 descrip.mms makefile.gen test.h \
	  README README2 INSTALL MANIFEST

DOCS = mkproto.man mkproto.ps

all: mkproto $(DOCS)

mkproto : mkproto.c mkproto.h
	$(CC) $(CFLAGS) $(CPPFLAGS) -o mkproto mkproto.c $(LDFLAGS)

install: all
	- $(INSTALL) -c -m 555 mkproto $(BIN)
	- $(INSTALL) -c -m 555 mkproto.man $(MAN)
	- $(INSTALL) -c -m 555 mkproto.ps $(PSMAN)

prepare clean:
	rm -f mkproto test.dif
	touch mkproto.1

makefile: makefile.gen $(CG)/$(CGPLATFORM).make
	$(CGBIN)/fixmake $(CG)/$(CGPLATFORM) makefile.gen makefile

mkproto.man: mkproto.1
	-nroff -man mkproto.1 | col >mkproto.man

mkproto.ps: mkproto.1
	-groff -T ps -man mkproto.1 >mkproto.ps

test:	test.dif

test.dif: mkproto test.h
	./mkproto -p mkproto.c | diff - test.h >test.dif

test.h: 
	./mkproto -p mkproto.c >test.h

tovax:	tovax.time

tovax.time: $(SOURCES)
	for f in $? ; do \
	    lcf=`echo $${f} | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` ; \
	    cp $${f} dino/$${lcf} ; \
	    chmod u+w dino/$${lcf} ; \
 	done
	touch tovax.time

# Get all pieces into a shar file.
mkproto.shar: mkproto01

mkproto01: all $(SOURCES)
	( set +e; \
	  makes=`cd $(CG); /bin/ls *.make`; \
	  defdir=`pwd`; \
	  (cd $(CG); cp $$makes $$defdir); \
	  makekit -n mkproto -o MANIFEST $(SOURCES) $$makes mkproto.ps ; \
	  rm -f $$makes )

# Get all pieces into a tar file.
mkproto.tar: all $(SOURCES)
	( set +e; \
	  makes=`cd $(CG); /bin/ls *.make`; \
	  defdir=`pwd`; \
	  (cd $(CG); cp $$makes $$defdir); \
	  tar cvf mkproto.tar \
	       $(SOURCES) $$makes $(DOCS) ; \
	  rm -f $$makes )

.DEFAULT:
	co $<

