4.4BSD/usr/src/contrib/news/inn/MakeLib

#! /bin/sh
##  $Revision: 1.3 $
##  Script to build an easy-to-ship single directory that contains
##  everything needed to build NNTP clientlib emulation on a machine.

##  Optional first argument is the destination architecture, like "sun4"
DIR=nntplib.${1-dist}
if [ -d ${DIR} ] ; then
    echo ${DIR} exists!
    exit 1
fi
mkdir ${DIR}

##  Copy the files.
for I in \
	config/subst.c config/subst.sh config/config.data \
	doc/inn.conf.5 \
	include/clibrary.h include/configdata.h include/libinn.h \
	include/macros.h include/mystring.h include/mymemory.h \
	include/myserver.h include/nntp.h include/paths.h \
	lib/clientlib.c lib/getconfig.c lib/getfqdn.c lib/remopen.c \
	site/inn.conf ; do \
    cp $I ${DIR}
done

##  Write the Makefile.  We duplicate the RCS revision string of the
##  script into the Makefile on purpose.
cat <<\EOF >${DIR}/Makefile
##  $Revision: 1.3 $
SHELL	= /bin/sh
MAKE	= make

##  Configuration dependencies -- edit as appropriate
DEFS	=
CFLAGS	= $(DEFS) -g
LDFLAGS	= -Bstatic
LINTFLAGS=-b -h -u $(DEFS)
RANLIB	= ranlib

##  Manual pages -- install as appropriate for your system
DOC	= inn.conf.5

##  Configuration files -- install in /usr/lib/news
CONF	= inn.conf

##  Program sources
SOURCES = clientlib.c getconfig.c getfqdn.c remopen.c
OBJECTS = clientlib.o getconfig.o getfqdn.o remopen.o
HEADERS	= clibrary.h configdata.h libinn.h macros.h nntp.h paths.h

##  First target, just compile everything.
all:			libinn.a $(DOC) $(CONF)
	date >$@

install:		libinn.a
	-date >$@

clobber clean:
	rm -f foo core tags lint a.out *.o
	rm -f libinn.a
	rm -f all install

libinn.a:		$(OBJECTS)
	ar r $@ $(OBJECTS)
	$(RANLIB) $@

lint:			$(OBJECTS)
	-lint -u $(LINTFLAGS) $(SOURCES) >lint

subst:		subst.c subst.sh
	make c || make sh || { rm -f subst ; echo Failed 1>&2 ; }

config:		subst config.data $(DOC) $(HEADERS) Makefile
	./subst -f config.data $(DOC) $(HEADERS) Makefile
	date >config

c:
	@rm -f subst
	$(CC) -o subst subst.c
sh:
	@rm -f subst
	cp subst.sh subst
	chmod +x subst

##  Dependencies.  Default list, below, is probably good enough.
depend:		Makefile $(SOURCES)
	makedepend $(DEFS) $(SOURCES)

# DO NOT DELETE THIS LINE -- make depend depends on it.
$(OBJECTS):	$(HEADERS)
EOF