# Time-stamp: <2005-05-15 12:28:57 rsmith>
# This is the Makefile for lamprop

# Define the C compiler to be used, usually gcc.
#CC = gcc

# Package name and version: BASENAME-VMAJOR.VMINOR.VPATCH.tar.gz
BASENAME = lamprop
VMAJOR   = 1
VMINOR   = 3
VPATCH   = 1

# Add appropriate CFLAGS and LFLAGS
CFLAGS ?= -O -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes
CFLAGS += -fno-unit-at-a-time    -DNDEBUG
LFLAGS += -s  

# Other libraries to link against
LIBS += -lm

# Base directory
PREFIX ?= /usr/local

# Location where the binary will be installed.
BINDIR = $(PREFIX)/bin

# Location where the manual-page will be installed.
MANDIR = $(PREFIX)/man

# Location where the documentatiion will be installed.
DOCSDIR = $(PREFIX)/share/doc/$(BASENAME)

# Standard files that need to be included in the distribution
DISTFILES = README INSTALL LICENSE NEWS Makefile $(BASENAME).1 depend

# Source files.
SRCS = calc.c license.c html_out.c latex_out.c list.c main.c matrix.c parse.c \
text_out.c utils.c

# Extra stuff to add into the distribution.
XTRA_DIST= $(BASENAME).5
TEST_DIST = hyer.lam hyer.txt

##### No editing necessary beyond this point
# Object files.
OBJS = $(SRCS:.c=.o)

# Predefined directory/file names
PKGDIR  = $(BASENAME)-$(VMAJOR).$(VMINOR).$(VPATCH)
TARFILE = $(PKGDIR).tar.gz

# Version number
VERSION = -DVERSION=\"$(VMAJOR).$(VMINOR).$(VPATCH)\"
# Program name
PACKAGE = -DPACKAGE=\"$(BASENAME)\"
# Add to CFLAGS
CFLAGS += $(VERSION) $(PACKAGE)

.PHONY: clean install uninstall dist backup all winbin

all: $(BASENAME) $(BASENAME).1 $(BASENAME).5 README INSTALL

# builds a binary.
$(BASENAME): $(OBJS)
	$(CC) $(LFLAGS) $(LDIRS) -o $(BASENAME) $(OBJS) $(LIBS)

# Remove all generated files.
clean:;
	rm -f $(OBJS) $(BASENAME) *~ core gmon.out $(TARFILE)* \
	$(BACKUP) $(LOG)


# Install the program and manual page. You should be root to do this.
install: $(BASENAME) $(BASENAME).1 $(BASENAME).5 LICENSE README NEWS
	@if [ `id -u` != 0 ]; then \
		echo "You must be root to install the program!"; \
		exit 1; \
	fi
	install -d $(BINDIR)
	install -m 755 $(BASENAME) $(BINDIR)
	install -d $(MANDIR)/man1
	install -m 644 $(BASENAME).1 $(MANDIR)/man1
	gzip -f $(MANDIR)/man1/$(BASENAME).1
	install -d $(MANDIR)/man5
	install -m 644 $(BASENAME).5 $(MANDIR)/man5
	gzip -f $(MANDIR)/man5/$(BASENAME).5
.if !defined(NOPORTDOCS)
	install -d $(DOCSDIR)
	install -m 644 LICENSE README NEWS $(DOCSDIR)
.endif

uninstall::
	@if [ `id -u` != 0 ]; then \
		echo "You must be root to uninstall the program!"; \
		exit 1; \
	fi
	rm -f $(BINDIR)/$(BASENAME)
	rm -f $(MANDIR)/man1/$(BASENAME).1*
	rm -f $(MANDIR)/man5/$(BASENAME).5*
	rm -rf $(DOCSDIR)

# Dependencies after this line.
include depend


syntax highlighted by Code2HTML, v. 0.9.1