# RCSID $Id: Makefile,v 1.4 1996/07/02 06:28:53 ae59 Exp ae59 $
######################################################################
#|Readme
#|------
#|Release ID  : 1-16
#|
# This file   : This is the makefile for building pmake.
#
#|Description : pmake generates a 'makefile' for Pascal-XSC programs.
#|              With this makefile 'make' envokes the Pascal-XSC compiler
#|              in order to compile all programs in the right order and
#|              if necessary. The default output of pmake is to stdout;
#|              redirect its output if you like.
#|
#|Note :        You will need of course having an installed Pascal-XSC 
#|              compiler running!
#|
#|Availability: This package is available at:
#|              http://www.uni-karlsruhe.de/~ae59/pmake1-16.Z
#|              ftp iamk4515.mathematik.uni-karlsruhe.de
#|                  get archive from /pub/pascal-xsc/contrib/
#|
#|Author:       Heinrich Berlejung
#|              Institut fuer Angewandte Mathematik
#|              Universitaet Karlsruhe
#|              Email:Heiner.Berlejung@math.uni-karlsruhe.de
#|
#|Disclaimer:   Neither the Institut fuer Angewandte Mathematik nor
#|              any other facility are responsible for this software
#|              and nobody has approved it.
#|              This software does not grant for anything and you can't make
#|              the autor responsible for any possible damages or errors!
#|
#|Copyright:    This package is proprietary of the author. It may be 
#|              freely distributed but must not be changed or used for 
#|              commercial purposes without permission of the author.
#|
#|Tests :       It was tested on :
#|              Sun Solaris 2.3 with gcc 2.6.7, Sun Sparc 4.1.x
#|              HPUX , Linux PC, EMX OS2/DOS.
#|              
#|              I tested pmake on Pascal-XSC standard modules
#|              and Toolbox programs.
#|              It will only works on a UNIX system and most PCs.
#|              The generated Makefile is suitable for GNU make and
#|              most UNIX makes I know of.
#|
#|Usage and building:        
#|              make pmake # should build pmake on UNIX
#|              make EXE=.exe pmake # should build pmake on PCs
#|              pmake *.p > P.mak # generates a Makefile P.mak for *.p
#|              make -f P.mak     # compiles the Pascal-XSC files
#|
#|Future Development:
#|              - correction of many many errors 
#|              - documentation
#|              - a graphical environment (tk based) which already works, 
#|                but can't be given away  at the moment.
#|Comments:
#|              - Any comments are appreciated, send them to the author.
#|              - I am willing to add all meaningfull extensions that
#|                might be proposed from potential users.
#|
#| Files:
#| Makefile  
#| pmake.c      - the makefile generator
#| pmake.1      - man file for pmake
#| readme       - readme file
#|
#| Start:       1994-01-26
#|
######################################################################
CC=cc
EXE=
BIN=/usr/bin
MAN=/usr/man/man1
COPTS=
OBJECTS = pmake.o
RELEASE=`grep '/.*Id' pmake.c| sed -e 's/^.*,v //g' -e 's/ ....\/.*//g' \
-e 's/\./-/g'`
zname="pmake$(RELEASE).Z"

.SUFFIXES: .c .o

#
all:		pmake$(EXE)

pmake$(EXE):	$(OBJECTS)
		$(CC) $(COPTS) -o pmake$(EXE) $(OBJECTS) 
.c.o :
		$(CC) -c $(COPTS) $*.c


install:	pmake.$(EXE) pmake.1
	if [ -d "$(BIN)" ] ; then cp pmake$(EXE) $(BIN)/ ; \
		     chmod 755 $(BIN)/pmake$(EXE) ; fi
	if [ -d "$(MAN)" ] ; then cp pmake.1 $(MAN)/ ; \
		     chmod 544 $(MAN)/pmake.1 ; fi
		
clean:
	rm -f *.o readme

tar: 
	@$(MAKE) doc
	@tar cf - pmake.1 pmake.c Makefile readme | compress  >pmake$(RELEASE).Z

doc:
	@sed -e "/^#|[ ]*http:/s/pmake.*\.Z/$(zname)/g" \
	-e "/^#|[ ]*Release ID/s/: .*/: $(RELEASE)/g" Makefile >Makefile.new
	@grep '^#|' Makefile.new | sed "s/^#|//g" > readme
	@mv Makefile.new Makefile

help:
	@grep '^#|' Makefile | sed "s/^#|//g" 

