home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / libg++-2.7.1-base.tgz / libg++-2.7.1-src.tar / fsf / libg++ / libiberty / Makefile.in < prev    next >
Makefile  |  1995-11-05  |  9KB  |  316 lines

  1. #
  2. # Makefile
  3. #   Copyright (C) 1990, 1991, 1992, 1995 Free Software Foundation
  4. #
  5. # This file is part of the libiberty library.
  6. # Libiberty is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2 of the License, or (at your option) any later version.
  10. #
  11. # Libiberty is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with libiberty; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. # Boston, MA 02111-1307, USA.
  20. #
  21.  
  22. # This file was written, and is maintained by K. Richard Pixley
  23. # <rich@cygnus.com>.
  24.  
  25. #
  26. # Makefile for libiberty directory
  27. #
  28.  
  29. srcdir = .
  30.  
  31. prefix = /usr/local
  32.  
  33. exec_prefix = $(prefix)
  34. bindir = $(exec_prefix)/bin
  35. libdir = $(exec_prefix)/lib
  36.  
  37. datadir = $(prefix)/lib
  38.  
  39. mandir = $(prefix)/man
  40. man1dir = $(mandir)/man1
  41. man2dir = $(mandir)/man2
  42. man3dir = $(mandir)/man3
  43. man4dir = $(mandir)/man4
  44. man5dir = $(mandir)/man5
  45. man6dir = $(mandir)/man6
  46. man7dir = $(mandir)/man7
  47. man8dir = $(mandir)/man8
  48. man9dir = $(mandir)/man9
  49. infodir = $(prefix)/info
  50. includedir = $(prefix)/include
  51. oldincludedir =
  52. docdir = $(datadir)/doc
  53.  
  54. SHELL = /bin/sh
  55.  
  56. # Multilib support variables.
  57. MULTITOP = .
  58. MULTIDIRS =
  59. MULTISUBDIR =
  60. MULTIDO = true
  61. MULTICLEAN = true
  62.  
  63. INSTALL = install -c
  64. INSTALL_PROGRAM = $(INSTALL)
  65. INSTALL_DATA = $(INSTALL)
  66.  
  67. AR = ar
  68. AR_FLAGS = rc
  69.  
  70. ERRORS_CC = $(CC)
  71. CC = cc
  72. CFLAGS = -g
  73. LIBCFLAGS = $(CFLAGS)
  74. MAKEINFO = makeinfo
  75. RANLIB = ranlib
  76.  
  77. PICFLAG =
  78.  
  79. MAKEOVERRIDES =
  80.  
  81. TARGETLIB = libiberty.a
  82.  
  83. CONFIG_H = lconfig.h
  84. NEEDED_LIST = lneeded-list
  85.  
  86. # HOST_OFILES contains the list of objects that should be in the
  87. # library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
  88. # A configuration may override this with a fixed list a object files
  89. # names (hard to maintain), or some other way to generate a list.
  90. HOST_OFILES=`cat needed-list`
  91.  
  92. # Extra targets that the top-level target depends on.
  93. # Specifically, what needs to be made before HOST_OFILES can be used.
  94. # Can be empty if HOST_OFILES is just a list of file names.
  95. DO_ALSO = needed-list
  96.  
  97. # A configuration can specify extra .o files that should be included,
  98. # even if they are in libc. (Perhaps the libc version is buggy.)
  99. EXTRA_OFILES = 
  100.  
  101. # Flags to pass to a recursive make.
  102. FLAGS_TO_PASS = \
  103.     "AR=$(AR)" \
  104.     "AR_FLAGS=$(AR_FLAGS)" \
  105.     "CC=$(CC)" \
  106.     "CFLAGS=$(CFLAGS)" \
  107.     "LIBCFLAGS=$(LIBCFLAGS)" \
  108.     "EXTRA_OFILES=$(EXTRA_OFILES)" \
  109.     "HDEFINES=$(HDEFINES)" \
  110.     "INCDIR=$(INCDIR)" \
  111.     "LDFLAGS=$(LDFLAGS)" \
  112.     "LOADLIBES=$(LOADLIBES)" \
  113.     "PICFLAG=$(PICFLAG)" \
  114.     "RANLIB=$(RANLIB)" \
  115.     "SHELL=$(SHELL)"
  116.  
  117. all: stamp-picdir $(TARGETLIB)
  118.     @if [ "$(RULE1)" != "not-used" ]; then \
  119.       $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \
  120.     else true; \
  121.     fi
  122.  
  123. .PHONY: check installcheck
  124. check installcheck:
  125.  
  126.  
  127. #### Host, target, and site specific Makefile fragments come in here.
  128. ###
  129.  
  130. INCDIR=$(srcdir)/../include
  131.  
  132. COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
  133. .c.o:
  134.     [ -z "$(PICFLAG)" ] || \
  135.       $(COMPILE.c) $(PICFLAG) $< -o pic/$@
  136.     $(COMPILE.c) $<
  137.  
  138. # The default target just invokes make recursively.
  139. # However, the automatic configuration (in config/mh_default).
  140. # first causes it to figure out the objects missing in libc.
  141. info install-info clean-info dvi:
  142.  
  143. # Include files that are in this directory.
  144. HFILES =
  145.  
  146. # NOTE: If you add new files to the library, add them to this list
  147. # (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
  148. CFILES = alloca.c argv.c basename.c bcmp.c bcopy.c bzero.c \
  149.      clock.c concat.c cplus-dem.c fdmatch.c \
  150.      getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
  151.          floatformat.c hex.c index.c insque.c \
  152.      memchr.c memcmp.c memcpy.c memmove.c memset.c \
  153.          obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \
  154.      strcasecmp.c strncasecmp.c \
  155.          strchr.c strdup.c strerror.c strrchr.c strsignal.c \
  156.          strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
  157.      vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \
  158.      xatexit.c xexit.c xmalloc.c xstrerror.c
  159. # These are always included in the library.
  160. REQUIRED_OFILES = argv.o basename.o concat.o cplus-dem.o fdmatch.o \
  161.   getopt.o getopt1.o getruntime.o hex.o \
  162.   floatformat.o obstack.o spaces.o strerror.o strsignal.o \
  163.   vasprintf.o xatexit.o xexit.o xmalloc.o xstrerror.o
  164.  
  165. # Do we want/need any config overrides?
  166. #     
  167.  
  168. STAGESTUFF = $(TARGETLIB) *.o
  169.  
  170. INSTALL_DEST = libdir
  171. install: install_to_$(INSTALL_DEST)
  172.  
  173. install_to_libdir: all
  174.     $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
  175.     ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
  176.     mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  177.  
  178. install_to_tooldir: all
  179.     $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n
  180.     ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n )
  181.     mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
  182.     @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
  183.  
  184. # The default configuration adds to libiberty all those functions that are
  185. # missing in libc.  More precisely, it includes whatever $(CC) fails to find.
  186. # Then a sed+awk combination translates the ld error messages into
  187. # a list of .o files.
  188.  
  189. needed-list: stamp-picdir $(NEEDED_LIST)
  190.     cp $(NEEDED_LIST) needed-list
  191.  
  192. lneeded-list: $(EXTRA_OFILES) needed.awk errors
  193.     rm -f lneeded-list
  194.     f=""; \
  195.     for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
  196.       case " $$f " in \
  197.         *" $$i "*) ;; \
  198.         *) f="$$f $$i" ;; \
  199.       esac ; \
  200.     done ; \
  201.     echo $$f >>lneeded-list
  202.  
  203. # Generate an awk script that looks for functions in functions.def
  204.  
  205. needed.awk: $(srcdir)/functions.def Makefile
  206.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  207.       "- DO NOT EDIT!" >needed.awk
  208.     grep '^DEF(' < $(srcdir)/functions.def \
  209.         | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
  210.         >>needed.awk
  211.  
  212. config.h: $(CONFIG_H)
  213.     cp $(CONFIG_H) config.h
  214.  
  215. lconfig.h: needed2.awk errors
  216.     echo "/* !Automatically generated from $(srcdir)/functions.def"\
  217.       "- DO NOT EDIT! */" >lconfig.h
  218.     awk -f needed2.awk <errors >>lconfig.h
  219.  
  220. # Generate an awk script that looks for variables in functions.def
  221.  
  222. needed2.awk: $(srcdir)/functions.def Makefile
  223.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  224.       "- DO NOT EDIT!" >needed2.awk
  225.     grep '^DEFVAR(' < $(srcdir)/functions.def \
  226.      | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  227.      >>needed2.awk
  228.     grep '^DEFFUNC(' < $(srcdir)/functions.def \
  229.      | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  230.      >>needed2.awk
  231.  
  232. dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
  233.     $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null
  234.  
  235. errors: dummy.o $(EXTRA_OFILES)
  236.     -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
  237.  
  238. $(HOST_OFILES) $(REQUIRED_OFILES) : config.h
  239.  
  240. RULE1 = $(TARGETLIB)
  241. $(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
  242.     @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
  243.         "HOST_OFILES=$(HOST_OFILES)"
  244.  
  245. # Rule invoked by recursive make in $(RULE1).
  246. RULE2 = not-used
  247. $(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
  248.     rm -rf $(TARGETLIB)
  249.     $(AR) $(AR_FLAGS) $(TARGETLIB) \
  250.       $(REQUIRED_OFILES) $(HOST_OFILES)
  251.     $(RANLIB) $(TARGETLIB)
  252.  
  253. stamp-picdir:
  254.     if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
  255.       mkdir pic; \
  256.     else true; fi
  257.     touch stamp-picdir
  258.  
  259. .always.:
  260. # Do nothing.
  261.  
  262. .PHONY: all etags tags ls clean stage1 stage2 .always.
  263.  
  264. etags tags: TAGS
  265.  
  266. TAGS: $(CFILES) $(HFILES)
  267.     etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
  268.  
  269. # The standalone demangler (c++filt) has been moved to binutils.
  270. demangle:
  271.     @echo "The standalone demangler, now named c++filt, is now"
  272.     @echo "a part of binutils."
  273.     @false
  274.  
  275. ls:
  276.     @echo Makefile $(HFILES) $(CFILES)
  277.  
  278. # Need to deal with profiled libraries, too.
  279.  
  280. mostlyclean:
  281.     rm -rf *.o pic core errs \#* *.E a.out
  282.     rm -f needed.awk needed2.awk errors dummy needed-list config.h
  283.     rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
  284.     @$(MULTICLEAN) multi-clean DO=mostlyclean
  285. clean: mostlyclean
  286.     rm -f *.a
  287.     @$(MULTICLEAN) multi-clean DO=clean
  288. distclean: clean
  289.     rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS
  290.     @$(MULTICLEAN) multi-clean DO=distclean
  291. maintainer-clean realclean: distclean
  292.  
  293. force:
  294.  
  295. Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
  296.     $(SHELL) ./config.status
  297.  
  298. argv.o: $(INCDIR)/libiberty.h
  299. basename.o: $(INCDIR)/libiberty.h
  300. concat.o: $(INCDIR)/libiberty.h
  301. cplus-dem.o: $(INCDIR)/demangle.h
  302. fdmatch.o: $(INCDIR)/libiberty.h
  303. getopt.o: $(INCDIR)/getopt.h
  304. getopt1.o: $(INCDIR)/getopt.h
  305. getruntime.o: $(INCDIR)/libiberty.h
  306. hex.o: $(INCDIR)/libiberty.h
  307. floatformat.o: $(INCDIR)/floatformat.h
  308. obstack.o: $(INCDIR)/obstack.h
  309. spaces.o: $(INCDIR)/libiberty.h
  310. strerror.o: $(INCDIR)/libiberty.h
  311. strsignal.o: $(INCDIR)/libiberty.h
  312. xatexit.o: $(INCDIR)/libiberty.h
  313. xexit.o: $(INCDIR)/libiberty.h
  314. xmalloc.o: $(INCDIR)/libiberty.h
  315. xstrerror.o: $(INCDIR)/libiberty.h
  316.