head	0.2;
access;
symbols;
locks; strict;
comment	@# @;


0.2
date	97.11.16.16.46.11;	author rsmit06;	state Exp;
branches;
next	0.1;

0.1
date	97.11.16.15.03.43;	author rsmit06;	state Exp;
branches;
next	;


desc
@Makefile
@


0.2
log
@Added manual page to tar-file.
@
text
@# $Id: Makefile,v 0.1 1997/11/16 15:03:43 rsmit06 Exp rsmit06 $
# Makefile for a library on Linux with gcc.
#
# $Log: Makefile,v $
# Revision 0.1  1997/11/16 15:03:43  rsmit06
# Initial release
#
#

# compilation flags
CFLAGS		  = -O2 -Wall -pedantic -Wstrict-prototypes -m486\
				-fomit-frame-pointer -fPIC

# extra libraries to be linked
LIBS		  = 


# where to install the library and header file.
# THESE SHOULD BE CHECKED AND CHANGED IF NECESSARY!
LDEST		  = /usr/local/lib
HDEST		  = /usr/local/include

# name of the library header
HDR			  = fsm.h
# 'lib' wil be prepended automagically to the basename.
# for libfoo.so.0.1 the basename is foo, version_major is 0 and
# version_minor is 1.
BASENAME	  = fsm
VERSION_MAJOR = 0
VERSION_MINOR = 1
# directory in which this library is built
BUILDDIR      = fsm

# list of object files
OBJS		  = fsm.o

# these don't have to be present, but they will be included in the
# distribution file if they are. These should be in the form
# $(BUILDDIR)/file
README            = $(BUILDDIR)/README
LICENSE           = $(BUILDDIR)/LICENSE
MANPAGE           = $(BUILDDIR)/libfsm.3

##### No editing necessary beyond this point
.PHONY:	clean help all shared static \
install_shared install_static install uninstall tar

SHARED		  = lib$(BASENAME).so.$(VERSION_MAJOR).$(VERSION_MINOR)
STATIC		  = lib$(BASENAME)_s.a
TARFILE		  = lib$(BASENAME)-$(VERSION_MAJOR).$(VERSION_MINOR).tar.gz

CC			  = gcc
INSTALL		  = cp

help:;	@@echo "Use one of the following invocations:";\
		echo "  \"make shared\"         to build the shared library";\
		echo "  \"make static\"         to build a static library";\
		echo "  \"make all\"            to build both libraries";\
		echo "  \"make install_shared\" to install the shared library";\
		echo "                          NOTE: you must be root do do this!";\
		echo "  \"make install_static\" to install the static library";\
		echo "                          NOTE: you must be root do do this!";\
		echo "  \"make install\"        to install both libraries";\
		echo "                          NOTE: you must be root do do this!";\
		echo "  \"make uninstall\"      to remove the installed libraries";\
		echo "                          NOTE: you must be root do do this!";\
		echo "  \"make depend\"         to update the dependancies";\
		echo "  \"make clean\"          to remove all generated files";\
		echo "";\
		echo "The usual invocation would be to do \"make all\",";\
		echo "login as root, and than do a \"make install\".";\
		echo ""


shared:		depend $(SHARED)
static:		depend $(STATIC)
all:		depend $(SHARED) $(STATIC)

# if the file depend doesn't exist, run 'make depend' first.
depend:	$(OBJS:.o=.c)
	gcc -MM $(OBJS:.o=.c) >depend

# build the shared library
$(SHARED):	$(OBJS)
	gcc -shared -Wl,-soname,lib$(BASENAME).so.$(VERSION_MAJOR) \
	-o $(SHARED) $(OBJS) $(LIBS)
	strip -g --strip-unneeded $(SHARED)

# builds a static- (archive) instead of a shared library.
$(STATIC): $(OBJS)
	ar crus $(STATIC) $(OBJS)
	strip -g $(STATIC)

# remove all files that can be created by this makefile
clean:;		-rm -f $(OBJS) core *~ $(SHARED) $(STATIC) $(TARFILE)

# install the shared library. Must be run as root.
install_shared:	$(SHARED)
	@@if [ `id -u` != 0 ]; then \
		echo "You must be root to install the library!"; \
		exit 1; \
	fi
	@@if [ $(LDEST) = . -o $(HDEST) = . ]; then \
		echo "Can't install in current directory!";\
		exit 1; \
	fi
	rm -f $(LDEST)/$(SHARED)
	rm -f $(LDEST)/lib$(BASENAME).so.$(VERSION_MAJOR)
	rm -f $(LDEST)/lib$(BASENAME).so
	$(INSTALL) $(SHARED) $(LDEST) ; cd $(LDEST) ;\
	ln -s $(SHARED) lib$(BASENAME).so.$(VERSION_MAJOR) ;\
	ln -s $(SHARED) lib$(BASENAME).so 
	rm -f $(HDEST)/$(HDR)
	$(INSTALL) $(HDR) $(HDEST)

# install the static library. Must be run as root.
install_static:	$(STATIC)
	@@if [ `id -u` != 0 ]; then \
		echo "You must be root to install the library!"; \
		exit 1; \
	fi
	@@if [ $(LDEST) = . -o $(HDEST) = . ]; then \
		echo "Can't install in current directory!";\
		exit 1; \
	fi
	rm -f $(LDEST)/$(STATIC)
	$(INSTALL) $(STATIC) $(LDEST)
	rm -f $(HDEST)/$(HDR)
	$(INSTALL) $(HDR) $(HDEST)

#installs both libraries
inastall: install_shared install_static

# remove the installed libraries. Must be run as root.
uninstall:;
	@@if [ `id -u` != 0 ]; then \
		echo "You must be root to uninstall the library!"; \
		exit 1; \
	fi
	rm -f $(LDEST)/$(SHARED)
	rm -f $(LDEST)/$(STATIC)
	rm -f $(LDEST)/lib$(BASENAME).so.$(VERSION_MAJOR)
	rm -f $(LDEST)/lib$(BASENAME).so
	rm -f $(HDEST)/$(HDR)

# make a source distribution file.
tar:;
	cd ..; tar -czf $(BUILDDIR)/$(TARFILE)\
	$(README) $(LICENSE) $(MANPAGE)\
	$(BUILDDIR)/Makefile $(BUILDDIR)/depend\
	$(BUILDDIR)/*.h $(BUILDDIR)/*.c $(BUILDDIR)/RCS/* 

# DO NOT DELETE THIS LINE 
include depend

@


0.1
log
@Initial release
@
text
@d1 1
a1 1
# $Id$
d4 4
a7 1
# $Log$
d40 1
a40 1
#README            = $(BUILDDIR)/README
d42 1
a42 1
#MANPAGE           = $(BUILDDIR)/lib$(BASENAME).3
@
