Changeset 1429


Ignore:
Timestamp:
Jun 7, 2004, 9:58:21 AM (16 years ago)
Author:
orlov
Message:
  • Improved makefiles.
Location:
to-imperative/trunk
Files:
6 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/Makefile

    r1425 r1429  
    1 ifeq ($(shell uname | tr A-Z a-z | sed 's/cygwin.*/cygwin/'), cygwin)
    2 SUBDIRS = libstdc++-stub cygwin bootstrap
     1#
     2# $Id$
     3#
     4
     5include rules.mk
     6include version.mk
     7
     8ifeq ($(TARGET), cygwin)
     9SUBDIRS = cygwin bootstrap compiler
     10all : override SUBDIRS = cygwin bootstrap
     11install : override SUBDIRS = cygwin bootstrap
    312else
    4 SUBDIRS = libstdc++-stub compiler libp++ runtime library bootstrap samples
    5 all : override SUBDIRS = \
    6         libstdc++-stub libp++ runtime library bootstrap
     13SUBDIRS = libp++ runtime library bootstrap samples compiler
     14all : override SUBDIRS = libp++ runtime library bootstrap
     15install : override SUBDIRS = libp++ runtime library bootstrap
    716endif
    817
    918INSTALL_SUBDIRS = $(SUBDIRS)
    1019
    11 include rules.mk
    12 include version.mk
    13 
    14 DISTFILES = Makefile config.functions config.mk rules.mk config.guess
     20DISTFILES = Makefile config.functions rules.mk config.guess
    1521DISTFILES += version.mk spec.in
    1622DISTFILES += ChangeLog createlog
  • to-imperative/trunk/bootstrap/Makefile

    r1425 r1429  
    88bootstrap: compare
    99
    10 stage1: Makefile
     10stage1: Makefile $(CONFIG) all
     11        rm -rf stage1
    1112        mkdir -p stage1
    1213        cp -a ../compiler/*.rf stage1/
    1314        cp -a ../compiler/*.rfi stage1/
    14         cp -a ../compiler/gendeps.sh stage1/
     15#       cp -a ../compiler/gendeps.sh stage1/
    1516        cp -a ../compiler/Makefile stage1/
    16         ( cd stage1; ../compiler/rfpc -hh *.rfi )
    1717        $(MAKE) -C stage1 all \
    1818          TOPDIR=$(TOPDIR)/.. INSTALL_DIR=$(INSTALL_DIR) \
    19           CURRENTDIR=$(CURRENTDIR)/bootstrap DISTNAME="$(DISTNAME)" \
    20 #         RFPC="../rfpc.sh" \
    21           CPPFLAGS+="-I../../runtime -I../../libp++ -I../../library/include" \
    22           LDFLAGS+="-L../../library -L../../runtime" \
    23           LDFLAGS+="-L../../libp++ -L../../libstdc++-stub" \
    24           LDLIBS+="-lrf -lrfrt -lp++ -lsupc++ -lgmp" \
    25           RFP="$(CXX)"
     19          CURRENTDIR=$(CURRENTDIR)/bootstrap DISTNAME="$(DISTNAME)"
    2620
    27 stage2: stage1
    28         mkdir -p stage2
    29         cp -a ../compiler/*.rf stage2/
    30         cp -a ../compiler/*.rfi stage2/
    31         cp -a ../compiler/gendeps.sh stage2/
    32         cp -a ../compiler/Makefile stage2/
    33         ( cd stage2; ../stage1/rfpc -hh *.rfi )
    34         $(MAKE) -C stage2 all \
    35           TOPDIR=$(TOPDIR)/.. INSTALL_DIR=$(INSTALL_DIR) \
    36           CURRENTDIR=$(CURRENTDIR)/bootstrap DISTNAME="$(DISTNAME)" \
    37           RFPC="../stage1/rfpc" \
    38 #         CPPFLAGS+="-I../../runtime -I../../libp++ -I../../library/include" \
    39           LDFLAGS+="-L../../library -L../../runtime" \
    40           LDFLAGS+="-L../../libp++ -L../../libstdc++-stub" \
    41           LDLIBS+="-lrf -lrfrt -lp++ -lsupc++ -lgmp" \
    42           RFP="$(CXX)"
    43 
    44 compare: stage2
     21compare: stage1
    4522        rm -rf src1 src2
    4623        mkdir -p src1
    4724        mkdir -p src2
    48         cp -a stage2/*.hh src1
    49         cp -a stage2/*.cc src1
    50         cp -a stage2/*.rf src1
    51         cp -a stage2/*.rfi src1
     25        cp -a stage1/*.hh src1
     26        cp -a stage1/*.cc src1
     27        cp -a stage1/*.rf src1
     28        cp -a stage1/*.rfi src1
    5229        cp -a ../compiler/*.rf src2
    5330        cp -a ../compiler/*.rfi src2
    54         ( cd src2 ; ../stage2/rfpc -hh *.rfi ; ../stage2/rfpc -cc *.rf )
     31        ( cd src2 ; \
     32          ../stage1/rfpc -I ../../library/include/refal-plus -hh *.rfi ; \
     33          ../stage1/rfpc -I ../../library/include/refal-plus -cc *.rf )
    5534        diff -ur src1 src2
    5635
    5736clean::
    58         rm -rf stage1 stage2 src1 src2
     37        rm -rf stage1 src1 src2
    5938
    6039
    61 
  • to-imperative/trunk/bootstrap/compiler/Makefile

    r1417 r1429  
    4545DISTFILES += $(ALL_SOURCES) $(ALL_INCLUDES)
    4646
     47CPPFLAGS += $(RFRTLIB_CFLAGS) $(RFLIB_CFLAGS)
    4748
    48 rfpc: $(RFPC_SOURCES) $(LIBRF) $(LIBRFRT) $(LIBPXX)
    49         $(RFP) -o $@ $^
     49rfpc.cc: Makefile $(CONFIG)
     50        sed 's?\(.*RFP_m_Default_m_Include_m_Path =\).*?\1 (Char::create_expr ("$(INSTALL_DIR)/include/refal-plus")) ();?' \
     51        $@ > $@.tmp
     52        mv $@.tmp $@
    5053
    51 rfp-filt: $(FILT_SOURCES) $(LIBRF) $(LIBRFRT) $(LIBPXX)
    52         $(RFP) -o $@ $^
     54rfpc: $(RFPC_OBJECTS) $(LIBRF) $(LIBRFRT) $(LIBPXX)
     55
     56rfp-filt: $(FILT_OBJECTS) $(LIBRF) $(LIBRFRT) $(LIBPXX)
    5357
    5458clean::
    5559        rm -f $(PROGRAMS_EXE) *.o *.s *.dep
    5660
     61install:: all
     62        mkdir -p -m 0755 $(INSTALL_DIR)/bin
     63        install -m 0755 $(PROGRAMS_EXE) $(INSTALL_DIR)/bin/
     64
    5765#-include $(DEPS)
  • to-imperative/trunk/compiler/Makefile

    r1425 r1429  
    3434RFPC_SOURCES = $(RFPC_MODULES:=.rf)
    3535RFPC_OBJECTS = $(RFPC_MODULES:=.o)
     36RFPC_CC_SOURCES = $(RFPC_MODULES:=.cc)
     37RFPC_HH_SOURCES = $(RFPC_MODULES:=.hh)
    3638FILT_SOURCES = $(FILT_MODULES:=.rf)
    3739FILT_OBJECTS = $(FILT_MODULES:=.o)
     40FILT_CC_SOURCES = $(FILT_MODULES:=.cc)
     41FILT_HH_SOURCES = $(FILT_MODULES:=.hh)
    3842
    3943PROGRAMS_EXE = $(PROGRAMS:=$(EXE_SUFFIX))
     
    4852DEPS = $(ALL_SOURCES:.rf=.dep)
    4953
    50 ifndef NODEPS
     54#ifndef NODEPS
     55#
     56#%.dep: %.rf
     57#       @echo Generating dependencies for $<
     58#       @./gendeps.sh $<
     59#
     60#endif
     61#
     62#ifeq ($(RFP),rfp)
     63#LDFLAGS=
     64#LDLIBS=
     65#endif
    5166
    52 %.dep: %.rf
    53         @echo Generating dependencies for $<
    54         @./gendeps.sh $<
     67CPPFLAGS += $(RFRTLIB_CFLAGS) $(RFLIB_CFLAGS)
    5568
    56 endif
     69$(RFPC_CC_SOURCES): $(RFPC_HH_SOURCES)
     70$(FILT_CC_SOURCES): $(FILT_HH_SOURCES)
    5771
    58 ifeq ($(RFP),rfp)
    59 LDFLAGS=
    60 LDLIBS=
    61 endif
     72rfpc: $(RFPC_OBJECTS) $(LIBRF) $(LIBRFRT) $(LIBPXX)
    6273
    63 CPPFLAGS = $(RFRTLIB_CFLAGS) $(RFLIB_CFLAGS)
    64 
    65 %.hh: %.rfi
    66         $(RFPC) -hh $<
    67 
    68 %.cc: %.rf $(RFPC_MODULES:=.hh) Makefile $(TOPDIR)/config.mk
    69         $(RFPC) -cc $<
    70 
    71 $(RFPC_OBJECTS): %.o : %.cc # $(RFPC_MODULES:=.cc)
    72         $(CXX) -c -g $(CPPFLAGS) $<
    73 
    74 rfpc: $(RFPC_OBJECTS)
    75         $(RFP) -o $@ $^
    76 
    77 rfp-filt: $(FILT_SOURCES)
    78         $(RFP) -o $@ $^
     74rfp-filt: $(FILT_OBJECTS) $(LIBRF) $(LIBRFRT) $(LIBPXX)
    7975
    8076clean::
    81         rm -f $(PROGRAMS_EXE) *.o *.s *.dep
     77        rm -f $(PROGRAMS_EXE) $(RFPC_CC_SOURCES) $(RFPC_HH_SOURCES) \
     78              $(FILT_CC_SOURCES) $(FILT_HH_SOURCES) *.o *.s *.dep
    8279
    8380-include $(DEPS)
  • to-imperative/trunk/configure

    r22 r1429  
    11#!/bin/sh
     2#
     3# $Id$
     4#
    25
    36package=rfpc
     
    912install_dir=/usr/local
    1013
     14test "$CXX" && cxx="$CXX" || cxx=g++
     15
     16wflags="-W -Wall"
     17dflags="-g -DDEBUG -DPARANOIA"
     18oflags="-O0"
     19
    1120help () {
    1221  cat <<EOF
     
    1423
    1524Possible options are:
    16   -prefix <dir>         install directory (default /usr/local)
     25  -prefix <dir>         install directory [$install_dir]
     26  -cxx <path>           path to C++ compiler [$cxx]
     27  -gmp_inc <dir>        directory containing GNU MP headers
     28  -gmp_lib <dir>        directory containing GNU MP library
     29  -wflags <flags>       C++ compiler warning options [$wflags]
     30  -dflags <flags>       debugging options [$dflags]
     31  -oflags <flags>       C++ compiler optimization options [$oflags]
    1732  -name                 shows package name
    1833  -version              shows package version
     
    2944    install_dir="$1"
    3045    ;;
     46  -cxx)
     47    shift
     48    if [ -z "$1" ]; then help; fi
     49    cxx="$1"
     50    ;;
     51  -gmp_inc)
     52    shift
     53    if [ -z "$1" ]; then help; fi
     54    gmp_inc="-I$1"
     55    ;;
     56  -gmp_lib)
     57    shift
     58    if [ -z "$1" ]; then help; fi
     59    gmp_lib="-L$1"
     60    ;;
     61  -wflags)
     62    shift
     63    if [ -z "$1" ]; then help; fi
     64    wflags="$1"
     65    ;;
     66  -dflags)
     67    shift
     68    if [ -z "$1" ]; then help; fi
     69    dflags="$1"
     70    ;;
     71  -oflags)
     72    shift
     73    if [ -z "$1" ]; then help; fi
     74    oflags="$1"
     75    ;;
    3176  -name)
    3277    echo $package
     
    4792
    4893config_mk=config.mk
    49 subdirs_mk=subdirs.mk
     94#subdirs_mk=subdirs.mk
    5095
    5196if [ -e "$config_mk" ] ; then
     
    5398fi
    5499
    55 if [ -e "$subdirs_mk" ] ; then
    56   rm $subdirs_mk
    57 fi
    58 
    59 if [ -z "$RFP" ]; then RFP="rfp" ; fi
    60 if [ -z "$RFPC" ]; then RFPC="rfpc" ; fi
    61 
    62 echon "Checking for working Refal+ compiler... "
    63 cat <<EOF >cfgtest.rf
    64 Main = ;
    65 EOF
    66 if $RFP -o cfgtest cfgtest.rf >/dev/null 2>&1; then
    67   echo "found"
    68   rm -f cfgtest cfgtest.rf
    69 else
    70   echo "not found"
    71   rm -f cfgtest cfgtest.rf
     100
     101case "$install_dir" in
     102  /*) ;;
     103  *) install_dir="`pwd`/$install_dir"
     104esac
     105while [ "$tmp_dir" != "$install_dir" ]; do
     106  tmp_dir="$install_dir"
     107  install_dir="`echo $install_dir | sed 's@/\.\?/@/@g'`"
     108done
     109tmp_dir=""
     110while [ "$tmp_dir" != "$install_dir" ]; do
     111  tmp_dir="$install_dir"
     112  install_dir="`echo $install_dir | sed 's@\(.*\)/.*/\.\.\(.*\)@\1\2@'`"
     113done
     114
     115
     116echon "Checking for operating system... "
     117os="`(uname | tr A-Z a-z) 2>/dev/null`"
     118echo "$os"
     119case "$os" in
     120  linux)
     121    main_dir='$(TOPDIR)'
     122    rfpc='$(TOPDIR)/bootstrap/compiler/rfpc'
     123    rfp='$(TOPDIR)/rfp.sh'
     124    exe_suffix=''
     125    ;;
     126  cygwin*)
     127    os='cygwin'
     128    main_dir='$(TOPDIR)/cygwin/'
     129    rfpc='$(TOPDIR)/bootstrap/compiler/rfpc.exe'
     130    rfp='ldflags=-Wl,--stack,0x800000 $(TOPDIR)/rfp.sh'
     131    exe_suffix='.exe'
     132    ;;
     133  *)
     134    echo "***"
     135    echo "*** Fatal error - your OS is not supported yet."
     136    echo "*** Please contact developers at refal-devel@botik.ru"
     137    echo "***"
     138    exit 1
     139    ;;
     140esac
     141
     142
     143echon "Checking for working C++ compiler... "
     144cat >cfgtest.cc <<EOF
     145class C;
     146int main(void) { return 0; }
     147EOF
     148$cxx -o cfgtest cfgtest.cc >/dev/null 2>&1
     149./cfgtest >/dev/null 2>&1
     150if [ $? != 0 ]; then
     151  echo
     152  echo "***"
     153  echo "*** Fatal error - $cxx is not working C++ compiler."
     154  echo "*** Specify other one with -cxx option."
     155  echo "***"
    72156  exit 1
    73157fi
    74  
     158echo $cxx
     159rm -f cfgtest*
     160
     161
     162echon "Checking for gmp library... "
     163cat >cfgtest.cc <<EOF
     164#include <stdio.h>
     165#include <gmp.h>
     166int main(void) { printf("%d\n", __GNU_MP_VERSION); }
     167EOF
     168$cxx $gmp_inc $gmp_lib -o cfgtest cfgtest.cc -lgmp >/dev/null 2>&1
     169./cfgtest >/dev/null 2>&1
     170if [ $? != 0 ]; then
     171  echo
     172  echo "***"
     173  echo "*** Fatal error - GNU MP not found, see http://swox.com/gmp"
     174  echo "*** If it has been installed to a non-standard location"
     175  echo "*** then use -gmp_inc and -gmp_lib options."
     176  echo "***"
     177  exit 1
     178fi
     179echo OK
     180rm -f cfgtest*
     181
     182
    75183cat >>$config_mk <<EOF
    76 RFP=$RFP
    77 RFPC=$RFPC
    78 EOF
    79 
    80 cat >>$subdirs_mk <<EOF
    81 SUBDIRS+=src
    82 EOF
    83 
     184TARGET = $os
     185INSTALL_DIR = $install_dir
     186
     187EXE_SUFFIX = $exe_suffix
     188
     189CXX = $cxx
     190CC  = $cxx
     191CPPFLAGS += $wflags
     192CPPFLAGS += $dflags
     193CPPFLAGS += -DALL_INLINE
     194CFLAGS += $oflags
     195LDLIBS += -static-libgcc
     196
     197RFPC = $rfpc
     198RFLAGS += -I ${main_dir}/library/include/refal-plus
     199
     200CPPFALGS += $gmp_inc
     201RFRTLIB_CFLAGS = -I${main_dir}/runtime -I${main_dir}/libp++
     202RFLIB_CFLAGS = -I${main_dir}/library/include
     203
     204LIBRF = ${main_dir}/library/librf.a
     205LIBRFRT = ${main_dir}/runtime/librfrt.a
     206LIBPXX = ${main_dir}/libp++/libp++.a
     207
     208LDFLAGS += $gmp_lib
     209#RF_LDFLAGS += -L${main_dir}/library -L${main_dir}/runtime
     210#RF_LDFLAGS += -L${main_dir}/libp++
     211#RF_LDLIBS += -lrf -lrfrt -lp++ -lsupc++ -lgmp
     212LDLIBS += -lsupc++ -lgmp
     213EOF
     214
  • to-imperative/trunk/libp++/Makefile

    r520 r1429  
    5252
    5353install:: all
    54         mkdir -p -m 0755 $(INSTALL_DIR)/lib \
     54        mkdir -p -m 0755 $(INSTALL_DIR)/lib
    5555        install -m 0644 $(LIBPXX) $(INSTALL_DIR)/lib/
    5656
  • to-imperative/trunk/library/Makefile

    r1290 r1429  
    3232        rm -rf $(LIBRF)
    3333
     34install:: all
     35        mkdir -p -m 0755 $(INSTALL_DIR)/lib
     36        install -m 0644 $(LIBRF) $(INSTALL_DIR)/lib/
     37        mkdir -p -m 0755 $(INSTALL_DIR)/include/refal-plus
     38        install -m 0644 include/refal-plus/*.rfi $(INSTALL_DIR)/include/refal-plus/
     39
  • to-imperative/trunk/rules.mk

    r1425 r1429  
    22CURRENTDIR ?= .
    33DISTLIST ?= dist.list
    4 
    5 ifeq ($(shell uname | tr A-Z a-z | sed 's/cygwin.*/cygwin/'), cygwin)
    6         CONFIG = $(TOPDIR)/cygwin/config.mk
    7 else
    8         CONFIG = $(TOPDIR)/config.mk
    9 endif
     4CONFIG = $(TOPDIR)/config.mk
    105
    116-include $(CONFIG)
     
    2722endif
    2823
    29 #%.o: %.rf Makefile $(CONFIG)
    30 #       $(RFPC) $<
     24%.hh: %.rfi Makefile $(CONFIG)
     25        $(RFPC) $(RFLAGS) -hh $<
     26
     27%.cc: %.rf Makefile $(CONFIG)
     28        $(RFPC) $(RFLAGS) -cc $<
    3129
    3230%.o: %.c Makefile $(CONFIG)
  • to-imperative/trunk/runtime/Makefile

    r1381 r1429  
    5252
    5353install:: all
    54         mkdir -p -m 0755 $(INSTALL_DIR)/lib \
     54        mkdir -p -m 0755 $(INSTALL_DIR)/lib
    5555        install -m 0644 $(LIBRFRT) $(INSTALL_DIR)/lib/
    5656
  • to-imperative/trunk/samples/Box/Makefile

    r1412 r1429  
    1010
    1111box1.cc: box2.hh
    12 box1: box2.o box1.o $(LIBRF) $(LIBRFRT) $(LIBPXX)
    13         $(CXX) -o $@ box1.o box2.o $(RF_LDFLAGS) $(RF_LDLIBS)
     12box1: box1.o box2.o $(LIBRF) $(LIBRFRT) $(LIBPXX)
     13        $(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS)
    1414
    1515CFLAGS+=-O0
  • to-imperative/trunk/samples/Convert/Makefile

    r1286 r1429  
    1414  to_int3 \
    1515  to_int_inval \
    16   to_int.bug1 \
    17   to_int.bug2 \
    18   to_int.bug3 \
    19   to_int.bug4 \
    20   to_int.bug5 \
    21   to_int.bug6 \
    22   to_int.bug7 \
    23   to_int.bug8 \
    24   to_int.bug9 \
    25   to_int.bug10 \
    26   to_int.bug11 \
    27   to_int.bug12 \
     16  to_int_bug1 \
     17  to_int_bug2 \
     18  to_int_bug3 \
     19  to_int_bug4 \
     20  to_int_bug5 \
     21  to_int_bug6 \
     22  to_int_bug7 \
     23  to_int_bug8 \
     24  to_int_bug9 \
     25  to_int_bug10 \
     26  to_int_bug11 \
     27  to_int_bug12 \
    2828  to_word
    2929
  • to-imperative/trunk/samples/samples.mk

    r1414 r1429  
    1 CPPFLAGS += $(RFRTLIB_CFLAGS) $(RFLIB_CFLAGS)
    2 #CPPFLAGS += -DALL_INLINE #-DRFRT_DISABLE_TAIL_RECURSION
    3 #CFLAGS += -finline-limit=10000 -march=pentium3
    4 
    51SAMPLES_SOURCES  = $(SAMPLES:=.cc)
    62SAMPLES_SOURCES += $(SAMPLES:=.rf)
     
    128DISTFILES += $(SAMPLES_SOURCES)
    139
    14 #$(SAMPLES): $(LIBRFRT)
    15 
    16 %.cc: %.rf $(RFPC)
    17         $(RFPC) -cc $<
    18 
    19 %.hh: %.rfi
    20         $(RFPC) $<
    21 
    22 %.o: %.cc %.rf
    23 #       $(RFPC) -cc $<
    24         $(CXX) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(<:.rf=.cc)
     10CPPFLAGS += $(RFRTLIB_CFLAGS) $(RFLIB_CFLAGS)
    2511
    2612$(SAMPLES): %: %.o $(LIBRF) $(LIBRFRT) $(LIBPXX)
    27         $(CXX) -o $@ $< $(RF_LDFLAGS) $(RF_LDLIBS)
    2813
    2914$(TESTS): %: %.o $(LIBRF) $(LIBRFRT) $(LIBPXX)
    30         $(CXX) -o $@ $< $(RF_LDFLAGS) $(RF_LDLIBS)
    3115
    3216clean::
    33         rm -f $(SAMPLES_EXE) $(TESTS_EXE) *.o *.dep
     17        rm -f $(SAMPLES_EXE) $(SAMPLES:=.cc) \
     18              $(TESTS_EXE) $(TESTS:=.cc) *.o *.dep
    3419
    3520check:: $(TESTS)
Note: See TracChangeset for help on using the changeset viewer.