5 kx case $CONFIG in
5 kx '')
5 kx if test ! -f config.sh; then
5 kx ln ../config.sh . || \
5 kx ln ../../config.sh . || \
5 kx ln ../../../config.sh . || \
5 kx (echo "Can't find config.sh."; exit 1)
5 kx fi 2>/dev/null
5 kx . ./config.sh
5 kx ;;
5 kx esac
5 kx : This forces SH files to create target in same directory as SH file.
5 kx : This is so that make depend always knows where to find SH derivatives.
5 kx case "$0" in
5 kx */*) cd `expr X$0 : 'X\(.*\)/'` ;;
5 kx esac
5 kx echo "Extracting Makefile (with variable substitutions)"
5 kx : This section of the file will have variable substitutions done on it.
5 kx : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
5 kx : Protect any dollar signs and backticks that you do not want interpreted
5 kx : by putting a backslash in front. You may delete these comments.
5 kx $spitshell >Makefile <<!GROK!THIS!
5 kx # $Id: Makefile.SH,v 2.0.1.32 2000/02/25 02:20:39 greyham Exp greyham $
5 kx #
5 kx # UNIX makefile for manual page generator
5 kx # Note: any changes made here will be lost next time Configure is run!.
5 kx
5 kx CC=$cc $optimize
5 kx YACC=$yacc $yaccflags
5 kx LEX=$lex $lexflags
5 kx SED=$sed
5 kx CAT=$cat
5 kx RM=$rm
5 kx MV=$mv
5 kx CP=$cp
5 kx ECHO=$echo
5 kx MKDEP=$mkdep
5 kx
5 kx # where we get installed
5 kx bin=$binexp
5 kx privlib=$installprivlib
5 kx
5 kx mansrc=$mansrc
5 kx manext=$manext
5 kx CFLAGS=$ccflags
5 kx WARNFLAGS=$warnflags
5 kx LDFLAGS=$ldflags
5 kx LIBS=$libs $liblex $libyacc
5 kx !GROK!THIS!
5 kx
5 kx : In the following dollars and backticks do not need the extra backslash.
5 kx $spitshell >>Makefile <<'!NO!SUBS!'
5 kx
5 kx # As Larry said, "Grrrr"
5 kx SHELL=/bin/sh
5 kx
5 kx OSOURCES = config.h c2man.h semantic.h symbol.h strconcat.h \
5 kx strappend.h manpage.h enum.h output.h lex.l grammar.y
5 kx DCSOURCES = c2man.c semantic.c string.c symbol.c strconcat.c \
5 kx strappend.c manpage.c enum.c nroff.c texinfo.c latex.c html.c \
5 kx autodoc.c ascii.c
5 kx SOURCES = $(OSOURCES) $(DCSOURCES)
5 kx CSOURCES = $(DCSOURCES) y.tab.c
5 kx OBJECTS = c2man.o semantic.o string.o symbol.o y.tab.o strconcat.o \
5 kx strappend.o manpage.o enum.o nroff.o texinfo.o latex.o html.o \
5 kx autodoc.o ascii.o
5 kx GENERATED = c2man example.inc ctype_ex.inc y.tab.c lex.yy.c y.output \
5 kx fixexamp.sed flatten.sed
5 kx
5 kx
5 kx all: c2man c2man.1
5 kx
5 kx install: all
5 kx -mkdir -p $(DESTDIR)$(bin)
5 kx -mkdir -p $(DESTDIR)$(mansrc)
5 kx $(CP) c2man $(DESTDIR)$(bin)
5 kx $(CP) c2man.1 $(DESTDIR)$(mansrc)/c2man.$(manext)
5 kx -mkdir -p $(DESTDIR)$(privlib)
5 kx chmod 755 $(DESTDIR)$(privlib)
5 kx -mkdir -p $(DESTDIR)$(privlib)/eg
5 kx chmod 755 $(DESTDIR)$(privlib)/eg
5 kx $(CP) eg/*.[chly] $(DESTDIR)$(privlib)/eg
5 kx chmod 755 $(DESTDIR)$(privlib)/eg/*
5 kx
5 kx uninstall:
5 kx $(RM) -f $(DESTDIR)$(bin)/c2man $(DESTDIR)$(mansrc)/c2man.$(manext)
5 kx $(RM) -f $(DESTDIR)$(privlib)/eg/*
5 kx rmdir $(DESTDIR)$(privlib)/eg
5 kx rmdir $(DESTDIR)$(privlib)
5 kx
5 kx c2man: $(OBJECTS)
5 kx $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
5 kx
5 kx c2man.1: c2man.man c2man example.inc ctype_ex.inc flatten.sed
5 kx $(SED) -f flatten.sed < c2man.man > c2man.1
5 kx
5 kx .c.o:
5 kx $(CC) $(CFLAGS) $(WARNFLAGS) -c $<
5 kx
5 kx y.tab.c: grammar.y
5 kx @$(ECHO) Expect 61 shift/reduce conflicts.
5 kx $(YACC) grammar.y
5 kx
5 kx # don't compile y.tab.c with all warnings; yacc/bison are not up to it.
5 kx y.tab.o: y.tab.c lex.yy.c
5 kx $(CC) $(CFLAGS) -c y.tab.c
5 kx
5 kx lex.yy.c: lex.l
5 kx $(LEX) -n lex.l
5 kx
5 kx example.inc: c2man example.h fixexamp.sed
5 kx c2man -o- example.h | $(SED) -f fixexamp.sed >example.inc
5 kx
5 kx ctype_ex.inc: c2man ctype_ex.h fixexamp.sed
5 kx c2man -o- -g ctype_ex.h | $(SED) -f fixexamp.sed >ctype_ex.inc
5 kx
5 kx fixexamp.sed: fixexamp.in
5 kx $(SED) -e '/^#/d' fixexamp.in > fixexamp.sed
5 kx
5 kx flatten.sed: flatten.SH config.sh
5 kx sh flatten.SH
5 kx
5 kx Makefile: Makefile.SH config.sh
5 kx sh Makefile.SH
5 kx
5 kx config.h: config_h.SH config.sh
5 kx sh config_h.SH
5 kx
5 kx TAGS: $(SOURCES)
5 kx etags -t $(SOURCES)
5 kx
5 kx clean:
5 kx $(RM) -f *.o *.s *.bak *~ *.log $(GENERATED) core
5 kx
5 kx distclean realclean: clean
5 kx $(RM) -f Makefile config.sh mkdep c2man.kit?
5 kx
5 kx lint:
5 kx lint -b $(CFLAGS) $(CSOURCES)
5 kx
5 kx print:
5 kx cpr $(SOURCES) | lpr -J'c2man'
5 kx
5 kx test: c2man
5 kx @echo "Running c2man over the examples..." 1>&2
5 kx @for file in eg/*.[chly]; do ./c2man -v -o- $$file; done
5 kx @echo "Running c2man over its own source code..." 1>&2
5 kx @for file in $(DCSOURCES); do ./c2man -v -o- $$file; done
5 kx @echo "Running c2man over the tests..." 1>&2
5 kx @for file in test/*.[chly]; do ./c2man -v -o- $$file; done
5 kx @echo "Hmmm, test seemed to go OK." 1>&2
5 kx
5 kx depend:
5 kx $(SED) -e '1,/^# DO NOT/!d' < Makefile > Makefile.new
5 kx $(MKDEP) $(DCSOURCES) >> Makefile.new
5 kx - test ! -f y.tab.c -o ! -f lex.yy.c || $(MKDEP) y.tab.c >> Makefile.new
5 kx $(MV) -f Makefile.new Makefile
5 kx
5 kx # y.tab.c dependancies updated manually since it won't exist yet when make
5 kx # depend is first run.
5 kx y.tab.o: c2man.h
5 kx y.tab.o: config.h
5 kx y.tab.o: confmagic.h
5 kx y.tab.o: enum.h
5 kx y.tab.o: manpage.h
5 kx y.tab.o: semantic.h
5 kx y.tab.o: strappend.h
5 kx y.tab.o: strconcat.h
5 kx y.tab.o: symbol.h
5 kx
5 kx # DO NOT DELETE THIS LINE! make depend DEPENDS ON IT!
5 kx c2man.o:
5 kx @echo "You must run a make depend first."; exit 1
5 kx !NO!SUBS!
5 kx chmod 755 Makefile
5 kx $eunicefix Makefile