home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnuawk.zip / Makefile.in < prev    next >
Makefile  |  1997-05-13  |  7KB  |  282 lines

  1. # Makefile for GNU Awk.
  2. #
  3. # Copyright (C) 1986, 1988-1997 the Free Software Foundation, Inc.
  4. # This file is part of GAWK, the GNU implementation of the
  5. # AWK Programming Language.
  6. # GAWK is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. # GAWK is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  17.  
  18. @SET_MAKE@
  19.  
  20. MAKEINFO = makeinfo --no-split
  21.  
  22. srcdir = @srcdir@
  23. VPATH = @srcdir@
  24.  
  25. CC = @CC@
  26. YACC = @YACC@
  27.  
  28. INSTALL = @INSTALL@
  29. INSTALL_PROGRAM = @INSTALL_PROGRAM@
  30. INSTALL_DATA = @INSTALL_DATA@
  31.  
  32. LIBS = @LIBS@
  33.  
  34. ALLOCA = @ALLOCA@
  35.  
  36. LN = ln
  37. LN_S = @LN_S@
  38.  
  39. exec_prefix = @exec_prefix@
  40. prefix = @prefix@
  41. binprefix =
  42. manprefix =
  43.  
  44. bindir = @bindir@
  45. libdir = @libdir@
  46. manexta = 1
  47. mandir = @mandir@/man$(manexta)
  48. manext = .$(manexta)
  49. infodir = @infodir@
  50. datadir = @datadir@/awk
  51. libexecdir = @libexecdir@/awk
  52.  
  53. DEFPATH = ".:$(datadir)"
  54.  
  55. SHELL = /bin/sh
  56. CFLAGS = @CFLAGS@
  57. COMPFLAGS = -DGAWK -I. -I$(srcdir) @DEFS@ $(CFLAGS)
  58.  
  59. # object files
  60. AWKOBJS = array.o builtin.o eval.o field.o gawkmisc.o io.o main.o \
  61.     missing.o msg.o node.o re.o version.o
  62.  
  63. ALLOBJS = $(AWKOBJS) awktab.o
  64.  
  65. # LIBOBJS
  66. #    GNU and other stuff that gawk uses as library routines.
  67. LIBOBJS= getopt.o getopt1.o regex.o dfa.o random.o $(ALLOCA)
  68.  
  69. # source and documentation files
  70. SRC = array.c builtin.c eval.c field.c gawkmisc.c io.c main.c \
  71.     missing.c msg.c node.c re.c version.c
  72.  
  73. ALLSRC= $(SRC) awktab.c
  74.  
  75. AWKSRC= awk.h awk.y custom.h $(ALLSRC) patchlevel.h protos.h random.h
  76.  
  77. LIBSRC = alloca.c dfa.c dfa.h regex.c regex.h getopt.h getopt.c getopt1.c random.c
  78.  
  79. COPIES = missing/system.c missing/tzset.c \
  80.     missing/memcmp.c missing/memcpy.c missing/memset.c \
  81.     missing/strncasecmp.c missing/strchr.c \
  82.     missing/strerror.c missing/strtod.c \
  83.     missing/strftime.c missing/strftime.3 
  84.  
  85. DOCS= doc/gawk.1 doc/gawk.texi doc/texinfo.tex
  86.  
  87. TEXFILES= doc/gawk.aux doc/gawk.cp doc/gawk.cps doc/gawk.fn doc/gawk.fns \
  88.       doc/gawk.ky doc/gawk.kys doc/gawk.pg doc/gawk.pgs doc/gawk.toc \
  89.       doc/gawk.tp doc/gawk.tps doc/gawk.vr doc/gawk.vrs
  90.  
  91. MISC =    NEWS COPYING FUTURES Makefile.in PROBLEMS README PORTS POSIX.STD \
  92.     configure configure.in acconfig.h configh.in ACKNOWLEDGMENT \
  93.     ChangeLog INSTALL LIMITATIONS install-sh mkinstalldirs aclocal.m4 \
  94.     stamp-h.in
  95.  
  96. OTHERS= doc pc atari vms README_d posix awklib
  97.  
  98. ALLDOC= doc/gawk.dvi $(TEXFILES) doc/gawk.info*
  99.  
  100. MAKEFILEIN = Makefile.in awklib/Makefile.in doc/Makefile.in test/Makefile.in
  101.  
  102. # Release of gawk.  There can be no leading or trailing white space here!
  103. REL=3.0
  104.  
  105. # clear out suffixes list
  106. .SUFFIXES:
  107. .SUFFIXES: .c .o
  108.  
  109. .c.o:
  110.     $(CC) -c $(COMPFLAGS) $<
  111.  
  112. # rules to build gawk
  113. all:    gawk awklib/all doc/all
  114.  
  115. # stuff to make sure that configure has been run.
  116. $(srcdir)/configure:    configure.in aclocal.m4
  117.     cd $(srcdir) && autoconf
  118.  
  119. # autoheader might not change confh.in, so touch a stamp file
  120. $(srcdir)/configh.in:    stamp-h.in
  121. $(srcdir)/stamp-h.in:    configure.in aclocal.m4 acconfig.h
  122.     cd $(srcdir) && autoheader
  123.     date > $(srcdir)/stamp-h.in
  124.  
  125. config.h:    stamp-h
  126. stamp-h:    configh.in config.status
  127.     $(SHELL) ./config.status
  128.  
  129. Makefile:    $(MAKEFILEIN) config.status
  130.     $(SHELL) ./config.status
  131.  
  132. config.status:    configure
  133.     $(SHELL) ./config.status --recheck
  134.  
  135. # Note: if you need something at both compile time and link time, like -pg,
  136. # you will have to edit the Makefile manually to set LDFLAGS.
  137. gawk:    $(ALLOBJS) $(LIBOBJS) $(REOBJS)
  138.     $(CC) -o gawk $(LDFLAGS) $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(LIBS)
  139.  
  140. $(ALLOBJS):    awk.h dfa.h regex.h config.h custom.h
  141.  
  142. $(LIBOBJS):    config.h custom.h
  143.  
  144. # SunOS make's (at least) VPATH doesn't do subdirectories...
  145. # Solaris make doesn't allow $< in the actual rule
  146. gawkmisc.o:    $(srcdir)/atari/gawkmisc.atr \
  147.         $(srcdir)/pc/gawkmisc.pc $(srcdir)/posix/gawkmisc.c \
  148.         $(srcdir)/vms/gawkmisc.vms
  149.     $(CC) -c $(COMPFLAGS) -DDEFPATH='$(DEFPATH)' $(srcdir)/gawkmisc.c
  150.  
  151. getopt.o:    getopt.h
  152.  
  153. getopt1.o:    getopt.h
  154.  
  155. builtin.o: random.h
  156.  
  157. main.o:    patchlevel.h
  158.  
  159. awktab.c:    awk.y
  160.     $(YACC) -v $(srcdir)/awk.y && \
  161.     if test -f y.tab.c ; then mv y.tab.c ytab.c ; else true ; fi && \
  162.     sed '/^extern char .malloc(), .realloc();$$/d' ytab.c >awktab.c && \
  163.     rm ytab.c
  164.  
  165. # VMS POSIX make won't apply the default .c.o rule to awktab.o for some reason
  166. awktab.o:    awktab.c awk.h
  167.     $(CC) -c $(COMPFLAGS) $(srcdir)/awktab.c
  168.  
  169. alloca.o:    alloca.c
  170.  
  171. install:    gawk info installdirs
  172.     -rm -f $(bindir)/gawk
  173.     fullname=gawk-$(REL).`./gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
  174.     $(INSTALL_PROGRAM) gawk $(bindir)/$$fullname ; \
  175.     (cd $(bindir); $(LN) $$fullname gawk)
  176.     (cd $(bindir); \
  177.     if [ ! -f awk ]; \
  178.     then    $(LN_S) gawk awk; \
  179.     fi; exit 0)
  180.     cd doc && $(MAKE) install
  181.     cd awklib && $(MAKE) install
  182.  
  183. installdirs: mkinstalldirs
  184.     $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
  185.         $(libdir) $(infodir) $(mandir) $(libexecdir)
  186.  
  187. uninstall:
  188.     (cd $(bindir); \
  189.     if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi)
  190.     (fullname=gawk-$(REL).`gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
  191.     cd $(bindir); \
  192.     if cmp gawk $$fullname; then rm -f gawk; fi ; \
  193.     rm -f $(bindir)/$$fullname)
  194.     cd doc && $(MAKE) uninstall
  195.     cd awklib && $(MAKE) uninstall
  196.     -rmdir $(datadir) $(libexecdir)
  197.  
  198. # auxiliary rules for release maintenance
  199. lint:    $(ALLSRC)
  200.     lint -hcbax $(COMPFLAGS) $(ALLSRC)
  201.  
  202. xref:
  203.     cxref -c $(COMPFLAGS) $(ALLSRC) | grep -v '    /' >xref
  204.  
  205. mostlyclean:
  206.     : mostly clean does nothing for gawk
  207.     : use "make clean" to really clean things out
  208.  
  209. clean:
  210.     rm -rf gawk *.o core y.output
  211.     cd doc && $(MAKE) clean
  212.     cd test && $(MAKE) clean
  213.     cd awklib && $(MAKE) clean
  214.  
  215. local-distclean:
  216.     rm -f Makefile *.orig *.rej */*.orig */*.rej awk.output \
  217.         gmon.out make.out config.h config.status config.cache \
  218.         config.log stamp-h tags TAGS *~
  219.  
  220. distclean: clean local-distclean
  221.     cd doc && $(MAKE) distclean
  222.     cd awklib && $(MAKE) distclean
  223.     cd test && $(MAKE) distclean
  224.  
  225. maintainer-clean: clean local-distclean
  226.     @echo "This command is intended for maintainers to use; it"
  227.     @echo "deletes files that may require special tools to rebuild."
  228.     rm -f awktab.c
  229.     cd doc && $(MAKE) maintainer-clean
  230.     cd test && $(MAKE) maintainer-clean
  231.     cd awklib && $(MAKE) maintainer-clean
  232.  
  233. clobber:    maintainer-clean
  234.  
  235. TAGS:
  236.     etags $(AWKSRC)
  237.  
  238. tags:
  239.     ctags $(AWKSRC)
  240.  
  241. dvi:    $(srcdir)/doc/gawk.texi
  242.     cd doc && $(MAKE) dvi
  243.  
  244. info:    $(srcdir)/doc/gawk.texi
  245.     cd doc && $(MAKE) info
  246.  
  247. doc/all:
  248.     cd doc && $(MAKE) all
  249.  
  250. awklib/all: gawk
  251.     cd awklib && $(MAKE) all
  252.  
  253. dist:    $(AWKSRC) $(LIBSRC) $(DOCS) $(MISC) $(COPIES) awklib/stamp-eg info distclean
  254.     -rm -rf gawk-$(REL)*
  255.     dir=gawk-$(REL).`gawk '{print $$3}' patchlevel.h` && \
  256.     mkdir $$dir && \
  257.     cp -pr $(AWKSRC) $(LIBSRC) $(MISC) $$dir && \
  258.     mkdir $$dir/missing && \
  259.     cp -p $(COPIES) $$dir/missing && \
  260.     for i in $(OTHERS); \
  261.     do \
  262.         cp -pr $$i $$dir ; \
  263.     done && \
  264.     cp -pr test $$dir && \
  265.     find $$dir -type d -exec chmod 777 {} ';' && \
  266.     find $$dir -print | doschk && \
  267.     tar -cf - $$dir | gzip > $$dir.tar.gz && \
  268.     rm -fr $$dir
  269.  
  270. awklib/stamp-eg:
  271.     cd awklib ; $(MAKE) stamp-eg
  272.  
  273. check:    gawk
  274.     cd test; $(MAKE) -k
  275.  
  276. test:    check
  277.  
  278.