Skip to content

Commit

Permalink
* configure.in (XCFLAGS): CFLAGS to comile ruby itself.
Browse files Browse the repository at this point in the history
* configure.in (LIBEXT): suffix for static libraries.

* configure.in (LIBPATHFLAG): switch template to specify library
  path.

* configure.in (LINK_SO): command to link shared objects.

* configure.in (DEFFILE, ARCHFILE): miscellaneous system dependent
  files.

* configure.in (EXPORT_PREFIX): prefix to exported symbols on
  Windows.

* configure.in (COMMON_LIBS, COMMON_MACROS, COMMON_HEADERS):
  libraries, macros and headers used in common.

* configure.in (RUBYW_INSTALL_NAME, rubyw_install_name): GUI mode
  excutable name.

* Makefile.in (CFLAGS): append XCFLAGS.

* Makefile.in (PREP): miscellaneous system dependent files.

* Makefile.in (ruby.imp, ext/extinit.o): moved from ext/extmk.rb.

* Makefile.in (fake.rb): CROSS_COMPILING keeps building platform.

* Makefile.in (MAKEFILES): depend on *.in and config.status.

* Makefile.in (parse.c): replace "y.tab.c" with actual name for
  byacc.

* ext/extmk.rb, lib/mkmf.rb: integrated.

* ext/extmk.rb: propagate MFLAGS.

* ext/extmk.rb (extmake): make dummy Makefile to clean even if no
  Makefile is made.

* lib/mkmf.rb (older): accept multiple file names and Time
  objects.

* lib/mkmf.rb (xsystem): split and qoute.

* lib/mkmf.rb (cpp_include): make include directives.

* lib/mkmf.rb (try_func): try wheather specified function is
  available.

* lib/mkmf.rb (install_files): default to site-install.

* lib/mkmf.rb (checking_for): added.

* lib/mkmf.rb (find_executable0): just find executable file with
  no message.

* lib/mkmf.rb (create_header): output header file is variable.

* lib/mkmf.rb (create_makefile): separate sections.

* lib/mkmf.rb (init_mkmf): initialize global variables.

* win32/Makefile.sub, bcc32/Makefile.sub (CPP, AR): added.

* bcc32/Makefile.sub (ARCH): fixed to i386.

* win32/Makefile.sub, bcc32/Makefile.sub (miniruby): should not
  link EXTOBJS.

* ext/dl/extconf.rb: use try_cpp to cross compile.

* ext/dl/extconf.rb: not modify files in source directory.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Oct 21, 2002
1 parent 76e8a9e commit e7ce523
Show file tree
Hide file tree
Showing 9 changed files with 877 additions and 1,127 deletions.
149 changes: 83 additions & 66 deletions bcc32/Makefile.sub
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
SHELL = $(COMSPEC)

#### Start of system configuration section. ####
OS = bccwin32
RT = $(OS)

## variables may be overridden by $(compile_dir)/Makefile
!ifndef srcdir
Expand All @@ -18,7 +20,7 @@ RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME:ruby=rubyw)
RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME)w
!endif
!ifndef RUBY_SO_NAME
RUBY_SO_NAME = rubybcc
RUBY_SO_NAME = $(RT)-$(RUBY_INSTALL_NAME)17
!endif
!ifndef icondirs
!ifdef ICONDIRS
Expand All @@ -37,16 +39,27 @@ VPATH = $(srcdir):$(srcdir)/missing
!ifndef CC
CC = bcc32
!endif
!ifndef CPP
CPP = cpp32
!endif
!ifndef RC
RC = brcc32
!endif
!ifndef YACC
YACC = byacc
!endif
!ifndef AR
AR = tlib
!endif

PURIFY =
AUTOCONF = autoconf

!if !defined(PROCESSOR_ARCHITECTURE) || "$(PROCESSOR_ARCHITECTURE)" == "x86"
!if !defined(PROCESSOR_ARCHITECTURE)
PROCESSOR_ARCHITECTURE = x86
!endif
MACHINE = $(PROCESSOR_ARCHITECTURE)
!if "$(PROCESSOR_ARCHITECTURE)" == "x86"
!ifndef PROCESSOR_LEVEL
PROCESSOR_LEVEL = 5
!endif
Expand All @@ -55,7 +68,7 @@ PROCESSOR_LEVEL = 6
!endif
PROCESSOR_FLAG = -$(PROCESSOR_LEVEL)
CPU = i$(PROCESSOR_LEVEL)86
ARCH = i$(PROCESSOR_LEVEL)86
ARCH = i386
!else
CPU = $(PROCESSOR_ARCHITECTURE)
ARCH = $(PROCESSOR_ARCHITECTURE)
Expand All @@ -66,7 +79,6 @@ DEBUGFLAGS =
!ifndef OPTFLAGS
OPTFLAGS = -O
!endif
OS = bccwin32

!ifndef prefix
prefix = /usr
Expand All @@ -75,44 +87,46 @@ prefix = /usr
DESTDIR = $(prefix)
!endif
!ifndef CFLAGS
CFLAGS = -DNT=1 $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w-aus -w-par -w-pro
CFLAGS = -q -DNT=1 $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w-
!endif
!ifndef CPPFLAGS
CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)missing -DLIBRUBY_SO=\"$(LIBRUBY_SO)\"
!endif
!ifndef LDFLAGS
LDFLAGS = $(CFLAGS)
!endif
!ifndef XLDFLAGS
XLDFLAGS =
LDFLAGS = -S:$(STACK)
!endif
!ifndef RFLAGS
RFLAGS = -r
RFLAGS = $(iconinc)
!endif
!ifndef EXTLIBS
EXTLIBS = # cw32.lib
EXTLIBS =
!endif
LIBS = $(EXTLIBS)
LIBS = cw32.lib import32.lib ws2_32.lib $(EXTLIBS)
MISSING = acosh.obj crypt.obj win32.obj

!ifndef STACK
STACK = 0x2000000
!endif

LDSHARED = ilink32.exe -S:$(STACK)
LINK = $(LDSHARED) -Tpe C0X32.OBJ
LINK_W = $(LDSHARED) -Tpe C0W32.OBJ
LINK_SO = $(LDSHARED) -Tpd C0D32.OBJ
LDOBJECTS = CW32.LIB IMPORT32.LIB $(MAINOBJ)
XCFLAGS = -DRUBY_EXPORT

ARFLAGS = /a
LD = ilink32 -q -Gn
LDSHARED = $(LD)
XLDFLAGS = -Tpe c0x32.obj
WLDFLAGS = -Tpe c0w32.obj
DLDFLAGS = -Tpd c0d32.obj
LIBRUBY_LDSHARED = $(LDSHARED)
LIBRUBY_DLDFLAGS = -Gi $(DLDFLAGS) $(EXTLDFLAGS)
LDOBJECTS = $(MAINOBJ)

DLDFLAGS =
SOLIBS =

EXEEXT = .exe
PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT)
RUBYDEF = $(RUBY_SO_NAME).def
MINIRUBY=miniruby$(EXEEXT)
MINIRUBY = .\miniruby$(EXEEXT)

ORGLIBPATH = $(LIB)

Expand Down Expand Up @@ -168,7 +182,7 @@ OBJS = array.obj \

all: miniruby$(EXEEXT) rbconfig.rb \
$(LIBRUBY) $(MISCLIBS)
@.\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb
@.\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb $(EXTSTATIC) $(MAKE) -$(MFLAGS)$(MAKEFLAGS)

ruby: $(PROGRAM)
rubyw: $(WPROGRAM)
Expand All @@ -178,8 +192,8 @@ dll: $(LIBRUBY_SO)
config: config.h config.status

config.h: Makefile $(srcdir)bcc32/Makefile.sub
@echo Creating config.h
type > $@ &&|
@echo Creating $(@:.\=)
@type > $@ &&|
\#define HAVE_PROTOTYPES 1
\#define HAVE_STDARG_PROTOTYPES 1
/* \#define HAVE_ATTR_NORETURN 1 */
Expand All @@ -198,7 +212,7 @@ config.h: Makefile $(srcdir)bcc32/Makefile.sub
/* \#define HAVE_SYS_PARAM_H 1 */
/* \#define HAVE_SYS_WAIT_H 1 */
\#define HAVE_STRING_H 1
/* \#define HAVE_UTIME_H 1 */
\#define HAVE_UTIME_H 1
\#define HAVE_MEMORY_H 1
/* \#define HAVE_ST_BLKSIZE 1 */
\#define HAVE_ST_RDEV 1
Expand Down Expand Up @@ -262,17 +276,17 @@ config.h: Makefile $(srcdir)bcc32/Makefile.sub
\#define HAVE_STRTOUL 1
|

config.status: Makefile $(srcdir)bcc32/Makefile.sub $(MINIRUBY)
@echo Creating config.status
@$(MINIRUBY) -pe "~/@CFLAGS@/||$$_.sub!(/'$(CFLAGS)'/, '$$(CFLAGS)')" > $@ &&|
config.status: Makefile $(srcdir)bcc32/Makefile.sub
@echo Creating $@
@type > $@ &&|
# Generated automatically by Makefile.sub.
s,@SHELL@,$$(COMSPEC),;t t
s,@CFLAGS@,$(CFLAGS),;t t
s,@CPPFLAGS@,$(CPPFLAGS),;t t
s,@CXXFLAGS@,$(CXXFLAGS),;t t
s,@FFLAGS@,$(FFLAGS),;t t
s,@LDFLAGS@,$(LDFLAGS),;t t
s,@LIBS@,,;t t
s,@LIBS@,$(LIBS),;t t
s,@exec_prefix@,$${prefix},;t t
s,@prefix@,,;t t
s,@program_transform_name@,s,,,,;t t
Expand Down Expand Up @@ -307,7 +321,8 @@ s,@CC@,$(CC),;t t
s,@CPP@,cpp32,;t t
s,@YACC@,$(YACC),;t t
s,@RANLIB@,rem,;t t
s,@AR@,tlib -nologo,;t t
s,@AR@,$(AR),;t t
s,@ARFLAGS@,$(ARFLAGS),;t t
s,@LN_S@,$(LN_S),;t t
s,@SET_MAKE@,$(SET_MAKE),;t t
s,@LIBOBJS@, acosh.obj crypt.obj win32.obj,;t t
Expand All @@ -316,19 +331,22 @@ s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t
s,@EXEEXT@,.exe,;t t
s,@OBJEXT@,obj,;t t
s,@XLDFLAGS@,$(XLDFLAGS),;t t
s,@DLDFLAGS@,$$(CFLAGS),;t t
s,@DLDFLAGS@,$(DLDFLAGS),;t t
s,@STATIC@,$(STATIC),;t t
s,@CCDLFLAGS@,-DIMPORT,;t t
s,@LDSHARED@,ilink32 -S:$(STACK) -Tpd,;t t
s,@CCDLFLAGS@,,;t t
s,@LDSHARED@,$(LDSHARED),;t t
s,@DLEXT@,so,;t t
s,@DLEXT2@,dll,;t t
s,@LIBEXT@,lib,;t t
s,@STRIP@,$(STRIP),;t t
s,@EXTSTATIC@,$(EXTSTATIC),;t t
s,@setup@,Setup,;t t
s,@MINIRUBY@,$(MINIRUBY),;t t
s,@LIBRUBY_LDSHARED@,$(LIBRUBY_LDSHARED),;t t
s,@LIBRUBY_DLDFLAGS@,$(LIBRUBY_DLDFLAGS),;t t
s,@LIBRUBY_LDSHARED@,$$(LDSHARED),;t t
s,@LIBRUBY_DLDFLAGS@,-Gi $$(DLDFLAGS),;t t
s,@RUBY_INSTALL_NAME@,$(RUBY_INSTALL_NAME),;t t
s,@rubyw_install_name@,$(RUBYW_INSTALL_NAME),;t t
s,@RUBYW_INSTALL_NAME@,$(RUBYW_INSTALL_NAME),;t t
s,@RUBY_SO_NAME@,$(RUBY_SO_NAME),;t t
s,@LIBRUBY_A@,lib$$(RUBY_INSTALL_NAME).lib,;t t
s,@LIBRUBY_SO@,$$(RUBY_SO_NAME).dll,;t t
Expand All @@ -340,6 +358,16 @@ s,@DLDLIBS@,$(DLDLIBS),;t t
s,@ENABLE_SHARED@,yes,;t t
s,@OUTFLAG@,-o,;t t
s,@CPPOUTFILE@,,;t t
s,@LIBPATHFLAG@, -L%s,;t t
s,@LIBARG@,%s.lib,;t t
s,@LINK_SO@,$$(LDSHARED) $$(DLDFLAGS) $$(LIBPATH) $$(OBJS), $$@, nul, $$(LIBS) $$(LOCAL_LIBS), $$(DEFFILE), $$(RESFILE),;t t
s,@COMPILE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -c $$(<:/=\),;t t
s,@COMPILE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -P -c $$(<:/=\),;t t
s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: .%s.%s:,;t t
s,@COMMON_LIBS@,m,;t t
s,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN;t t
s,@COMMON_HEADERS@,winsock2.h windows.h,;t t
s,@EXPORT_PREFIX@,_,;t t
s,@arch@,$(ARCH)-$(OS),;t t
s,@sitearch@,$(ARCH)-$(OS),;t t
s,@sitedir@,$${prefix}/lib/ruby/site_ruby,;t t
Expand All @@ -349,43 +377,33 @@ s,@srcdir@,$(srcdir),;t t
s,@top_srcdir@,$(srcdir),;t t
|

#ext/extmk.rb: $(srcdir)ext/extmk.rb.in config.status
# @echo Creating ext/extmk.rb
# @.\miniruby$(EXEEXT) $(srcdir)ext/configsub.rb \
# -srcdir=$(srcdir) \
# -install_name=$(RUBY_INSTALL_NAME) \
# -so_name=$(RUBY_SO_NAME) \
# -output=$@ $(srcdir)ext/extmk.rb.in

miniruby$(EXEEXT): $(OBJS) $(MAINOBJ) $(EXTOBJS)
@echo $(EXTOBJS)
miniruby$(EXEEXT): $(LIBRUBY_A) $(MAINOBJ) dmyext.obj
@echo $(LIBS)
$(LINK) $(LDOBJECTS) $(EXTOBJS) $(OBJS) $(LIBS),$@
$(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) dmyext.obj,$@,nul,$(LIBRUBY_A) $(LIBS)

$(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(RUBY_INSTALL_NAME).res
$(LINK) $(LDOBJECTS),$@,,$(LIBRUBYARG),,$(RUBY_INSTALL_NAME).res
$(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBY_INSTALL_NAME).res

$(WPROGRAM): $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_SO) $(RUBYW_INSTALL_NAME).res
$(LINK_W) $(LDOBJECTS) $(WINMAINOBJ),$@,,$(LIBRUBYARG),,$(RUBYW_INSTALL_NAME).res
$(LD) $(LDFLAGS) $(WLDFLAGS) $(MAINOBJ) $(WINMAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBYW_INSTALL_NAME).res

$(LIBRUBY_A): $(OBJS) dmyext.obj
$(LIBRUBY_A): $(OBJS)
@-if exist $@ del $@
tlib $@ /a @&&|
$(OBJS) dmyext.obj
|

$(LIBRUBY): $(LIBRUBY_SO)
implib $@ $(LIBRUBY_SO)
$(AR) $(ARFLAGS)$@ $(OBJS)

$(LIBRUBY_SO): $(LIBRUBY_A) $(EXTOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
$(LINK_SO) $(LDOBJECTS) $(EXTOBJS) $(LIBS),$@,,$(LIBRUBY_A),$(RUBYDEF), $(RUBY_SO_NAME).res
# $(LIBRUBY): $(LIBRUBY_SO)
# implib $@ $(LIBRUBY_SO)

$(LIBRUBY_SO) $(LIBRUBY): $(LIBRUBY_A) dmyext.obj $(EXTOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
@echo $(EXTOBJS)
$(LIBRUBY_LDSHARED) $(LIBRUBY_DLDFLAGS) dmyext.obj,$(LIBRUBY_SO),nul,$(LIBRUBY_A) $(LIBS),$(RUBYDEF),$(RUBY_SO_NAME).res

$(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT)
.\miniruby$(EXEEXT) $(srcdir)bcc32/mkexports.rb -output=$@ $(LIBRUBY_A)
$(MINIRUBY) $(srcdir)bcc32/mkexports.rb -output=$@ $(LIBRUBY_A)

install: rbconfig.rb
.\miniruby$(EXEEXT) $(srcdir)instruby.rb $(DESTDIR)
$(MINIRUBY) $(srcdir)instruby.rb $(DESTDIR)
$(MINIRUBY) $(srcdir)ext/extmk.rb $(MAKE) -$(MFLAGS)$(MAKEFLAGS) DESTDIR=$(DESTDIR) install

clean: clean-ext clean-local

Expand All @@ -402,7 +420,7 @@ clean-local:
@if exist *.il? del *.il?

clean-ext:
@-.\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb clean
@-$(MINIRUBY) $(srcdir)ext/extmk.rb $(MAKE) -$(MFLAGS)$(MAKEFLAGS) clean

distclean: distclean-ext distclean-local

Expand All @@ -425,7 +443,6 @@ distclean-local: clean-local
@if exist *.ilk del *.ilk
@if exist *.exp del *.exp
@if exist $(RUBYDEF) del $(RUBYDEF)
@if exist pub.def del pub.def
@if exist $(RUBY_INSTALL_NAME).rc del $(RUBY_INSTALL_NAME).rc
@if exist $(RUBYW_INSTALL_NAME).rc del $(RUBYW_INSTALL_NAME).rc
@if exist $(RUBY_SO_NAME).rc del $(RUBY_SO_NAME).rc
Expand All @@ -437,26 +454,26 @@ distclean-local: clean-local
@if exist miniruby$(EXEEXT) del miniruby$(EXEEXT)

distclean-ext:
@-.\miniruby$(EXEEXT) $(srcdir)ext/extmk.rb distclean
@-$(MINIRUBY) $(srcdir)ext/extmk.rb $(MAKE) -$(MFLAGS)$(MAKEFLAGS) distclean

realclean: distclean
@if exist parse.c del parse.c
@if exist lex.c del lex.c

test: miniruby$(EXEEXT)
@.\miniruby$(EXEEXT) $(srcdir)rubytest.rb
@$(MINIRUBY) $(srcdir)rubytest.rb

rbconfig.rb: miniruby$(EXEEXT) config.status
@.\miniruby$(EXEEXT) $(srcdir)mkconfig.rb -srcdir=$(srcdir) \
@$(MINIRUBY) $(srcdir)mkconfig.rb -srcdir=$(srcdir) \
-install_name=$(RUBY_INSTALL_NAME) \
-so_name=$(RUBY_SO_NAME) rbconfig.rb

$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
@.\miniruby$(EXEEXT) $(srcdir)win32/resource.rb \
@$(MINIRUBY) $(srcdir)win32/resource.rb \
-ruby_name=$(RUBY_INSTALL_NAME) \
-rubyw_name=$(RUBYW_INSTALL_NAME) \
-so_name=$(RUBY_SO_NAME) \
. $(icondirs) $(srcdir)/win32
. $(icondirs) $(srcdir)win32

#config.status: $(srcdir)configure
# $(SHELL) .config.status --recheck
Expand All @@ -466,10 +483,10 @@ $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb
.path.y = $(srcdir)

.c.obj:
$(CC) $(CFLAGS) -I. $(CPPFLAGS) -c $(<:/=\)
$(CC) $(CFLAGS) $(XCFLAGS) -I. $(CPPFLAGS) -c $(<:/=\)

.rc.res:
$(RC) -I. -I$(<D) $(iconinc) -I$(srcdir)win32 $(RFLAGS) -fo$@ $(<:/=\)
$(RC) $(RFLAGS) -I. -I$(<D) $(iconinc) -I$(srcdir)win32 $(RFLAGS) -fo$@ $(<:/=\)

.y.c:
$(YACC) $(YFLAGS) $(<:\=/)
Expand Down
25 changes: 23 additions & 2 deletions bcc32/configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@
echo> ~tmp~.mak ####
echo>> ~tmp~.mak conf = %0
echo>> ~tmp~.mak $(conf:\=/): nul
echo>> ~tmp~.mak @del ~tmp~.mak
echo>> ~tmp~.mak make -Dbcc32dir="$(@D)" -f$(@D)/setup.mak %1
echo>> ~tmp~.mak @del ~tmp~.mak
echo>> ~tmp~.mak @-$(MAKE) -l$(MAKEFLAGS) -f $(@D)setup.mak \
:loop
if "%1" == "" goto :end
if "%1" == "--srcdir" goto :srcdir
if "%1" == "srcdir" goto :srcdir
if "%1" == "--target" goto :target
if "%1" == "target" goto :target
echo>> ~tmp~.mak "%1" \
shift
goto :loop
:srcdir
echo>> ~tmp~.mak "srcdir=%2" \
shift
shift
goto :loop
:target
echo>> ~tmp~.mak "%2" \
shift
shift
goto :loop
:end
echo>> ~tmp~.mak bcc32dir="$(@D)"
make -s -f ~tmp~.mak
Loading

0 comments on commit e7ce523

Please sign in to comment.