home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gnat-2.06-src.tgz / tar.out / fsf / gnat / ada / Make-lang.in < prev    next >
Text File  |  1996-09-28  |  10KB  |  329 lines

  1. # Top level makefile fragment for GNU Ada (GNAT).
  2. #   Copyright (C) 1994 Free Software Foundation, Inc.
  3.  
  4. #This file is part of GNU CC.
  5.  
  6. #GNU CC 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, or (at your option)
  9. #any later version.
  10.  
  11. #GNU CC 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
  14. #GNU General Public License for more details.
  15.  
  16. #You should have received a copy of the GNU General Public License
  17. #along with GNU CC; see the file COPYING.  If not, write to
  18. #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # This file provides the language dependent support in the main Makefile.
  21. # Each language makefile fragment must provide the following targets:
  22. #
  23. # foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
  24. # foo.info, foo.dvi,
  25. # foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
  26. # foo.uninstall, foo.distdir,
  27. # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
  28. # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
  29. #
  30. # where `foo' is the name of the language.
  31. #
  32. # It should also provide rules for:
  33. #
  34. # - making any compiler driver (eg: g++)
  35. # - the compiler proper (eg: cc1plus)
  36. # - define the names for selecting the language in LANGUAGES.
  37.  
  38. # Extra flags to pass to recursive makes.
  39. BOOT_ADAFLAGS= $(ADAFLAGS)
  40. ADAFLAGS= -gnatpg -gnata
  41. GNATBIND= gnatbind
  42. GNATLIBFLAGS= -gnatpg
  43. ADA_FLAGS_TO_PASS = \
  44.     "ADA_FOR_BUILD=$(ADA_FOR_BUILD)" \
  45.     "ADAFLAGS=$(ADAFLAGS)" \
  46.     "ADA_FOR_TARGET=$(ADA_FOR_TARGET)" \
  47.     "GNATBIND=$(GNATBIND)" \
  48.     "INSTALL_DATA=$(INSTALL_DATA)"
  49.  
  50. # Define the names for selecting Ada in LANGUAGES.
  51. Ada ada: gnat1 gnatbind
  52.  
  53. # There are too many Ada sources to check against here.  Let's
  54. # always force the recursive make.
  55. gnat1: $(LIBDEPS) stamp-objlist force
  56.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ../gnat1
  57.  
  58. gnatbind: force
  59.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ../gnatbind
  60.  
  61. gnatf: force
  62.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ../gnatf
  63.  
  64. gnatk8: force
  65.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ../gnatk8
  66.  
  67. gnatmake: force
  68.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ../gnatmake
  69.  
  70. gnatchp: force
  71.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ../gnatchp
  72.  
  73. gnatbl: force
  74.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ../gnatbl
  75.  
  76. # use host-gcc
  77. gnattools: force
  78.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
  79.         GNATLIBFLAGS=$(GNATLIBFLAGS) \
  80.         ../gnatf ../gnatk8 ../gnatmake ../gnatchp ../gnatbl
  81.  
  82. # use cross-gcc
  83. gnatlib: force
  84.     cd ada; $(MAKE) GNATLIBFLAGS=$(GNATLIBFLAGS) gnatlib
  85.  
  86. # use cross-gcc
  87. gnatgthreads: force
  88.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
  89.         GNATLIBFLAGS=$(GNATLIBFLAGS) gnatgthreads
  90.  
  91. # use only for native compiler
  92. gnatlib_and_tools: force
  93.     cd ada; \
  94.     $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS)\
  95.         CC="../xgcc -B../" GNATBIND="../gnatbind"\
  96.         ../gnatf ../gnatk8 ../gnatmake ../gnatchp ../gnatbl; \
  97.     $(MAKE) GNATLIBFLAGS=$(GNATLIBFLAGS) gnatlib
  98.       
  99.  
  100. gnat-cross: force
  101.     cd ada; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
  102.         GNATLIBFLAGS=$(GNATLIBFLAGS) gnat-cross
  103.  
  104. # Build hooks:
  105.  
  106. ada.all.build: 
  107. ada.all.cross: gnat1 gnattools
  108.     cp gnat1     gnat1-cross
  109.     cp gnatbind  gnatbind-cross
  110.     cp gnatf     gnatf-cross
  111.     cp gnatk8    gnatk8-cross
  112.     cp gnatmake  gnatmake-cross
  113.     cp gnatchp   gnatchp-cross
  114.     cp gnatbl    gnatbl-cross
  115.  
  116. ada.start.encap:
  117. ada.rest.encap:
  118. ada.info:
  119. ada.dvi:
  120.  
  121. # Install hooks:
  122. # gnat1 is installed elsewhere as part of $(COMPILERS).
  123.  
  124. ada.install-normal:
  125.  
  126. # Install the binder program as $(target)-gnatbind
  127. # and also as either gnatbind (if native) or $(tooldir)/bin/gnatbind
  128. # likewise for gnatf, gnatchp, and gnatk8, gnatmake gnatbl.
  129. ada.install-common:
  130.     -if [ -f gnat1 ] ; then \
  131.       if [ -f gnatbind-cross ] ; then \
  132.         rm -f $(bindir)/$(target)-gnatbind; \
  133.         $(INSTALL_PROGRAM) gnatbind-cross $(bindir)/$(target)-gnatbind; \
  134.         chmod a+x $(bindir)/$(target)-gnatbind; \
  135.       else \
  136.         rm -f $(bindir)/gnatbind; \
  137.         $(INSTALL_PROGRAM) gnatbind $(bindir)/gnatbind; \
  138.         chmod a+x $(bindir)/gnatbind; \
  139.       fi ; \
  140.     fi
  141.     -if [ -f gnat1 ] ; then \
  142.       if [ -f gnatf-cross ] ; then \
  143.         rm -f $(bindir)/$(target)-gnatf; \
  144.         $(INSTALL_PROGRAM) gnatf-cross $(bindir)/$(target)-gnatf; \
  145.         chmod a+x $(bindir)/$(target)-gnatf; \
  146.       else \
  147.         rm -f $(bindir)/gnatf; \
  148.         $(INSTALL_PROGRAM) gnatf $(bindir)/gnatf; \
  149.         chmod a+x $(bindir)/gnatf; \
  150.       fi ; \
  151.     fi
  152.     -if [ -f gnat1 ] ; then \
  153.       if [ -f gnatk8-cross ] ; then \
  154.         rm -f $(bindir)/$(target)-gnatk8; \
  155.         $(INSTALL_PROGRAM) gnatk8-cross $(bindir)/$(target)-gnatk8; \
  156.         chmod a+x $(bindir)/$(target)-gnatk8; \
  157.       else \
  158.         rm -f $(bindir)/gnatk8; \
  159.         $(INSTALL_PROGRAM) gnatk8 $(bindir)/gnatk8; \
  160.         chmod a+x $(bindir)/gnatk8; \
  161.       fi ; \
  162.     fi
  163.     -if [ -f gnat1 ] ; then \
  164.       if [ -f gcc-cross ] ; then \
  165.         rm -f $(bindir)/$(target)-gnatmake; \
  166.         $(INSTALL_PROGRAM) gnatmake-cross $(bindir)/$(target)-gnatmake; \
  167.         chmod a+x $(bindir)/$(target)-gnatmake; \
  168.       else \
  169.         rm -f $(bindir)/gnatmake; \
  170.         $(INSTALL_PROGRAM) gnatmake $(bindir)/gnatmake; \
  171.         chmod a+x $(bindir)/gnatmake; \
  172.       fi ; \
  173.     fi
  174.     -if [ -f gnat1 ] ; then \
  175.       if [ -f gnatchp-cross ] ; then \
  176.         rm -f $(bindir)/$(target)-gnatchp; \
  177.         $(INSTALL_PROGRAM) gnatchp-cross $(bindir)/$(target)-gnatchp; \
  178.         chmod a+x $(bindir)/$(target)-gnatchp; \
  179.       else \
  180.         rm -f $(bindir)/gnatchp; \
  181.         $(INSTALL_PROGRAM) gnatchp $(bindir)/gnatchp; \
  182.         chmod a+x $(bindir)/gnatchp; \
  183.       fi ; \
  184.     fi
  185.     -if [ -f gnat1 ] ; then \
  186.       if [ -f gnatchop-cross ] ; then \
  187.         rm -f $(bindir)/$(target)-gnatchop; \
  188.         $(INSTALL_PROGRAM) gnatchop-cross $(bindir)/$(target)-gnatchop; \
  189.         chmod a+x $(bindir)/$(target)-gnatchop; \
  190.       else \
  191.         rm -f $(bindir)/gnatchop; \
  192.         $(INSTALL_PROGRAM) $(srcdir)/ada/gnatchop $(bindir)/gnatchop; \
  193.         chmod a+x $(bindir)/gnatchop; \
  194.       fi ; \
  195.     fi
  196.     -if [ -f gnat1 ] ; then \
  197.       if [ -f gnatbl-cross ] ; then \
  198.         rm -f $(bindir)/$(target)-gnatbl; \
  199.         $(INSTALL_PROGRAM) gnatbl-cross $(bindir)/$(target)-gnatbl; \
  200.         chmod a+x $(bindir)/$(target)-gnatbl; \
  201.       else \
  202.         rm -f $(bindir)/gnatbl; \
  203.         $(INSTALL_PROGRAM) gnatbl $(bindir)/gnatbl; \
  204.         chmod a+x $(bindir)/gnatbl; \
  205.       fi ; \
  206.     fi
  207.     -if [ -f gnat1 ] ; then \
  208.       $(MAKE) INSTALL_DATA="$(INSTALL_DATA)" install-gnatlib; \
  209.     fi
  210.  
  211. install-gnatlib:
  212.     (cd ada; \
  213.      $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) install-gnatlib);
  214.  
  215. ada.install-info:
  216. ada.install-man:
  217.  
  218. ada.uninstall:
  219.     -rm -rf $(bindir)/gnatbind $(bindir)/gnatf
  220.     -rm -rf $(bindir)/$(target)-gnatbind $(bindir)/$(target)-gnatf
  221.  
  222. # Clean hooks:
  223. # A lot of the ancillary files are deleted by the main makefile.
  224. # We just have to delete files specific to us.
  225.  
  226. ada.mostlyclean:
  227.     -rm -f ada/*.o ada/*.ali ada/b_*.c ada/sdefault.adb ada/ttypef.ads
  228.     -rm -f ada/stamp-sdefault
  229. ada.clean:
  230. ada.distclean:
  231.     -rm -f ada/config.status ada/Makefile
  232. ada.extraclean:
  233. ada.maintainer-clean:
  234.     -rm -f ada/a-[se]info.h
  235.     -rm -f ada/nmake.ad[bs]
  236.     -rm -f ada/treeprs.ads
  237.     -rm -f cp/parse.c cp/parse.h
  238.  
  239. # Stage hooks:
  240. # The main makefile has already created stage?/ada
  241.  
  242. ada.stage1:
  243.     -mv ada/*.o ada/*.ali ada/mkttypef ada/b_*.c stage1/ada
  244.     -mv ada/stamp-* stage1/ada
  245. ada.stage2:
  246.     -mv ada/*.o ada/*.ali ada/mkttypef ada/b_*.c stage2/ada
  247.     -mv ada/stamp-* stage2/ada
  248. ada.stage3:
  249.     -mv ada/*.o ada/*.ali ada/mkttypef ada/b_*.c stage3/ada
  250.     -mv ada/stamp-* stage3/ada
  251. ada.stage4:
  252.     -mv ada/*.o ada/*.ali ada/mkttypef ada/b_*.c stage4/ada
  253.     -mv ada/stamp-* stage4/ada
  254.  
  255. # Maintenance hooks:
  256.  
  257. # This target creates the files that can be rebuilt, but go in the
  258. # distribution anyway.  It then copies the files to the distdir directory.
  259. ada.distdir:
  260.     mdkdir tmp/ada
  261.     cd ada ; $(MAKE) $(FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) ada_extra_files
  262.     cd ada; \
  263.     for file in *[0-9a-zA-Z+]; do \
  264.       ln $$file ../tmp/ada >/dev/null 2>&1 || cp $$file ../tmp/ada; \
  265.     done
  266.  
  267. # Bootstrapping targets for just GNAT - use the same stage directories
  268. gnatboot: force
  269.     $(MAKE) gnat1 gnatbind CC="$(CC)" CFLAGS="$(CFLAGS)"
  270.     $(MAKE) gnatstage1
  271.     $(MAKE) gnatboot2 BOOT_CFLAGS="$(BOOT_CFLAGS)" \
  272.                       BOOT_ADAFLAGS="$(BOOT_ADAFLAGS)" \
  273.                       LDFLAGS="$(BOOT_LDFLAGS)"
  274.  
  275. gnatboot2: force
  276.     $(MAKE) gnat1 gnatbind  CC="gcc -B../stage1/"\
  277.                 CFLAGS="$(BOOT_CFLAGS)" \
  278.                     ADAFLAGS="$(BOOT_ADAFLAGS)"\
  279.                 LDFLAGS="$(BOOT_LDFLAGS)" \
  280.                 GNATBIND=../stage1/gnatbind 
  281.     -rm -f stamp-cmp-failed
  282.     for file in ada/*.o ; do \
  283.       tail +16c ./$$file > tmp-foo1 ; \
  284.       tail +16c ./stage1/$$file > tmp-foo2 2>/dev/null && \
  285.       (cmp tmp-foo1 tmp-foo2>/dev/null \
  286.            || (touch stamp-cmp-failed \
  287.                 && echo ./$$file ./stage1/$$file differs \
  288.             && true)) ; \
  289.     done
  290.     -rm -f tmp-foo* 
  291.     @if [ ! -f stamp-cmp-failed ] ; then \
  292.       echo Bootstrap succeded after Stage1; \
  293.      else \
  294.       $(MAKE) gnatstage2 ; \
  295.       $(MAKE) gnatboot3 BOOT_CFLAGS="$(BOOT_CFLAGS)" \
  296.                 BOOT_ADAFLAGS="$(BOOT_ADAFLAGS)" \
  297.                 LDFLAGS="$(BOOT_LDFLAGS)"; \
  298.      fi
  299.  
  300. gnatboot3: force
  301.     $(MAKE) gnat1 gnatbind  CC="gcc -B../stage2/"\
  302.                 CFLAGS="$(BOOT_CFLAGS)" \
  303.                     ADAFLAGS="$(BOOT_ADAFLAGS)"\
  304.                 LDFLAGS="$(BOOT_LDFLAGS)" \
  305.                 GNATBIND=../stage2/gnatbind 
  306.     $(MAKE) gnatcompare;
  307.  
  308. gnatcompare: force
  309.     for file in ada/*.o; do \
  310.       tail +16c $$file > tmp-foo1; \
  311.       tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
  312.         && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
  313.     done
  314.     -rm -f tmp-foo* 
  315.  
  316. gnatstage1: force
  317.     -mkdir stage1
  318.     -mkdir stage1/ada
  319.     -mv -f gnat1 gnatbind stage1
  320.     -mv -f ada/*.o ada/*.ali ada/mkttypef stage1/ada
  321.     -mv ada/stamp-* stage1/ada
  322.  
  323. gnatstage2: force
  324.     -mkdir stage2
  325.     -mkdir stage2/ada
  326.     -mv -f gnat1 gnatbind stage2
  327.     -mv -f ada/*.o ada/*.ali ada/mkttypef stage2/ada
  328.     -mv ada/stamp-* stage2/ada
  329.