# *********************************
# * Makefile for Debian Par 1.41  *
# * Par 1.41 Copyright 1993       *
# * by Adam M. Costello           *
# *********************************


#####
##### Instructions
#####

# If you have no make command (or equivalent), you can easily tell by
# looking at this file what make would do.  It would compile each .c file
# into a .o file, then link all the .o files into the executable par.  You
# can do this manually.  Then you should go look for a version of make for
# your system, since it will come in handy in the future.

# If you do have make, you can either copy this file to Makefile, edit the
# definitions of CC, LINK1, LINK2, RM, and JUNK, and then run make; or,
# better yet, create a short script which looks something like:
#
# #!/bin/sh
# make -f protoMakefile CC="cc -c" LINK1="cc" LINK2="-o" RM="rm" JUNK="" $*
#
# (Alter this to use commands and values appropriate for your compiler
# and shell).  The advantage of the second method is that the script will
# probably work on the next release of Par.

#####
##### Configuration
#####

# Define CC so that the command
#
# $(CC) foo.c
#
# compiles the ANSI C source file "foo.c" into the object file "foo.o".  You
# may assume that foo.c uses no floating point math.
#
# If your operating system or your compiler's exit() function automatically
# frees all memory allocated by malloc() when a process terminates, then you
# can choose to trade away space efficiency for time efficiency by defining
# DONTFREE.
#
# Example (for Solaris 2.2):
# CC = cc -c -O -s -Xc -DDONTFREE

CC = gcc -c -O2 

# Define LINK1 and LINK2 so that the command
#
# $(LINK1) foo1.o foo2.o foo3.o $(LINK2) foo
#
# links the object files "foo1.o", "foo2.o", "foo3.o" into the executable
# file "foo".  You may assume that none of the .o files use floating point
# math.
#
# Example (for Solaris 2.2):
# LINK1 = cc -s
# LINK2 = -o

LINK1 = gcc -s
LINK2 = -o

# Define RM so that the command
#
# $(RM) foo1 foo2 foo3
#
# removes the files "foo1", "foo2", and "foo3", and preferrably doesn't
# complain if they don't exist.
#
# Example (for Solaris 2.2):
# RM = rm -f

RM = rm -f

# Define JUNK to be a list of additional files, other than par and $(OBJS),
# that you want to be removed by "make clean".

JUNK =


BIN=/usr/bin
DOC=/usr/doc/par

#####
##### Guts (you shouldn't need to touch this part)
#####

OBJS = buffer.o charset.o errmsg.o par.o reformat.o

.c.o:
	$(CC) $<

par: $(OBJS)
	$(LINK1) $(OBJS) $(LINK2) par

buffer.o: buffer.c buffer.h errmsg.h

charset.o: charset.c charset.h errmsg.h buffer.h

errmsg.o: errmsg.c errmsg.h

par.o: par.c charset.h errmsg.h buffer.h reformat.h

reformat.o: reformat.c reformat.h errmsg.h buffer.h

clean:
	$(RM) par $(OBJS) $(JUNK)

install: par par.doc
	install -o root -g root -m 0755 par $(BIN)/par
	install -d $(DOC) -o root -g root -m 0755
	install  -o root -g root -m 0644 par.doc $(DOC)

