home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / gcc / Makefile < prev    next >
Encoding:
Makefile  |  1994-11-12  |  6.2 KB  |  218 lines

  1. #
  2. # This is Makefile for libgcc.a
  3. #
  4.  
  5. override STATIC=false
  6. override DEBUG=false
  7. override PROFILE=false
  8. #override CHECKER=false
  9.  
  10. JUMP_LIB=libgcc
  11.  
  12. TOPDIR=..
  13.  
  14. include $(TOPDIR)/Makeconfig
  15. include $(TOPDIR)/Makerules
  16.  
  17. srcdir=.
  18.  
  19. ifeq ($(CHECKER),true)
  20. LIBGCC=$(CHECKER_DIR)/libgcc/libgcc3.a
  21. else
  22. LIBGCC=$(SHARED_DIR)/libgcc/libgcc3.a
  23. endif
  24.  
  25. LIBGCC1=#libgcc1.a
  26. LIBGCC2=libgcc2.a
  27.  
  28. CFLAGS = $(WFLAGS) $(OPT_CFLAGS) $(INC_CFLAGS) $(XCFLAGS)
  29.  
  30. INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
  31. INC_CFLAGS=$(INCLUDES)
  32.  
  33. CCLIBFLAGS= $(OPT_CFLAGS)
  34. LIBGCC2_CFLAGS=$(OPT_CFLAGS) $(DEBUGFLAGS)
  35.  
  36. DIRS=
  37.  
  38. ifeq ($(STATIC_SHARED),true)
  39. SHARED=true
  40. endif
  41.  
  42. ifeq ($(SHARED),true)
  43.  
  44. SHARED=FALSE
  45.  
  46. include $(TOPDIR)/Maketargets
  47.  
  48. LIB2FUNCS = _eprintf __main _exit _ctors _op_new _op_delete \
  49.          _new_handler
  50. # _muldi3 _udivdi3 _umoddi3 _udivmoddi4
  51.  
  52. LIBGCCALIASES=$(SHARED_DIR)/$(SUBDIR)/aliases.o
  53.  
  54. LIBGCC2_CFLAGS=$(BASE_OPTFLAGS) $(DEBUGFLAGS) -B$(JUMPAS)
  55.  
  56. lib::
  57.     @if [ -d $(SHARED_DIR)/$(SUBDIR) ]; then \
  58.       true; else \
  59.       $(RM) -f $(SHARED_DIR)/$(SUBDIR); \
  60.       $(MKDIR) $(SHARED_DIR)/$(SUBDIR); \
  61.     fi
  62.     $(RM) -f libgcc1.a    # safer (it can be the checkered one)
  63.  
  64. lib all:: libgcc
  65.  
  66. else
  67.  
  68. ifeq ($(CHECKER),true)
  69.  
  70. include $(TOPDIR)/Maketargets
  71.  
  72. LIB2FUNCS = _eprintf __main _exit _ctors _op_new _op_delete \
  73.          _new_handler _muldi3 _udivdi3 _umoddi3 _udivmoddi4
  74.  
  75. LIBGCCALIASES=$(CHECKER_DIR)/$(SUBDIR)/aliases.o
  76.  
  77. LIBGCC2_CFLAGS=$(BASE_OPTFLAGS) $(DEBUGFLAGS) $(CHECKER_OPT_CFLAGS)
  78.  
  79. lib::
  80.     @if [ -d $(CHECKER_DIR)/$(SUBDIR) ]; then \
  81.       true; else \
  82.       $(RM) -f $(CHECKER_DIR)/$(SUBDIR); \
  83.       $(MKDIR) $(CHECKER_DIR)/$(SUBDIR); \
  84.     fi
  85.     $(RM) -f libgcc1.a    # safer (it can be the static one)
  86.  
  87. lib all:: libgcc
  88.  
  89. else
  90.  
  91. lib all:
  92.     @true
  93.  
  94. endif
  95. endif
  96.  
  97. libgcc1.a: libgcc1.c
  98.     -$(RM) -fr tmplibgcc1.a tmpcopy
  99. # Actually build it in tmplibgcc1.a, then rename at end,
  100. # so that libgcc1.a itself remains nonexistent if compilation is aborted.
  101. # -e causes any failing command to make this rule fail.
  102. # -e doesn't work in certain shells, so we test $$? as well.
  103.     -set -e; \
  104.     mkdir tmpcopy; \
  105.     for name in .. $(LIB1FUNCS); \
  106.     do \
  107.       if [ x$${name} != x.. ]; then \
  108.         echo $${name}; \
  109.         $(CC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} \
  110.             $(srcdir)/libgcc1.c -o ./tmpcopy/$${name}.o; \
  111.         if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
  112.       else true; fi; \
  113.     done
  114.     (cd ./tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc1.a *.o)
  115.     $(RM) -rf ./tmpcopy
  116. # Some shells crash when a loop has no items.
  117. # So make sure there is always at least one--`..'.
  118. # Then ignore it.
  119. # We don't use -e here because there are if statements
  120. # that should not make the command give up when the if condition is false.
  121. # Instead, we test for failure after each command where it matters.
  122.     -for file in .. $(LIB1FUNCS_EXTRA); \
  123.     do \
  124.       if [ x$${file} != x.. ]; then \
  125.         name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
  126.         echo $${name}; \
  127.         if [ $${name}.asm = $${file} ]; then \
  128.           cp $${file} $${name}.s || exit 1; file=$${name}.s; \
  129.         else true; fi; \
  130.         $(CC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
  131.         if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
  132.         $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}.o; \
  133.         if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
  134.         rm -f $${name}.[so]; \
  135.       else true; \
  136.       fi; \
  137.     done
  138.     if [ -f tmplibgcc1.a ]; then \
  139.       mv tmplibgcc1.a libgcc1.a; \
  140.     else true; fi
  141.  
  142. # Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
  143. # But recompiling cc1 should not force recompilation of libgcc2.a.
  144. # If you want to force recompilation, delete libgcc2.a.
  145. # Depend on install-cross-tools to make sure we set up properly 
  146. # to run the assembler before we try compiling anything.
  147. # install-cross-tools does nothing if not cross compiling.
  148. libgcc2.ready: $(GCC_PASSES) $(CROSS_TOOLS)
  149.     -if [ -f libgcc2.ready ] ; then \
  150.         true; \
  151.     else \
  152.         touch libgcc2.ready; \
  153.     fi
  154.  
  155. libgcc2.a: libgcc2.c
  156. #libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
  157. #   machmode.h longlong.h gbl-ctors.h config.status
  158. # Actually build it in tmplibgcc2.a, then rename at end,
  159. # so that libgcc2.a itself remains nonexistent if compilation is aborted.
  160.     -$(RM) -fr tmplibgcc2.a tmpcopy
  161. # -e causes any failing command to make this rule fail.
  162. # -e doesn't work in certain shells, so we test $$? as well.
  163.     set -e; \
  164.     mkdir tmpcopy; \
  165.     for name in $(LIB2FUNCS); \
  166.     do \
  167.       echo $${name}; \
  168.       $(CC) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
  169.           $(srcdir)/libgcc2.c -o ./tmpcopy/$${name}.o; \
  170.       if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
  171.     done
  172.     (cd ./tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc2.a *.o)
  173.     $(RM) -rf ./tmpcopy
  174. # Some shells crash when a loop has no items.
  175. # So make sure there is always at least one--`..'.
  176. # Then ignore it.
  177. # We don't use -e here because there are if statements
  178. # that should not make the command give up when the if condition is false.
  179. # Instead, we test for failure after each command where it matters.
  180.     -for file in .. $(LIB2FUNCS_EXTRA); \
  181.     do \
  182.       if [ x$${file} != x.. ]; then \
  183.         name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
  184.         echo $${name}; \
  185.         if [ $${name}.asm = $${file} ]; then \
  186.           cp $${file} $${name}.s || exit 1; file=$${name}.s; \
  187.         else true; fi; \
  188.         $(CC) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
  189.         if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
  190.         $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
  191.         rm -f $${name}.[so]; \
  192.       else true; \
  193.       fi; \
  194.     done
  195.     mv tmplibgcc2.a libgcc2.a
  196. # These lines were deleted from above the mv command
  197. # because ranlibing libgcc.a itself should suffice.
  198. #    -if [ x${HPUX_GAS} = x ] ; then \
  199. #      if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi \
  200. #    else true; fi
  201.  
  202. # Combine the various libraries into a single library, libgcc.a.
  203. libgcc: $(LIBGCC1) $(LIBGCC2) $(LIBGCCALIASES)
  204.     -$(RM) -rf tmplibgcc.a $(LIBGCC) tmpcopy
  205.     mkdir tmpcopy
  206.     -if [ x$(LIBGCC1) != x ];            \
  207.     then (cd tmpcopy; $(AR) x ../$(LIBGCC1));    \
  208.     else true;                    \
  209.     fi
  210.     (cd tmpcopy; $(AR) x ../$(LIBGCC2))
  211.     (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
  212.     $(RM) -rf tmpcopy $(LIBGCC2)
  213. # Actually build it in tmplibgcc.a, then rename at end,
  214. # so that libgcc.a itself remains nonexistent if compilation is aborted.
  215.     $(AR) $(AR_FLAGS) tmplibgcc.a $(LIBGCCALIASES)
  216.     $(REALRANLIB) tmplibgcc.a
  217.     mv tmplibgcc.a $(LIBGCC)
  218.