diff --git a/ChangeLog b/ChangeLog index 38a75ba49e..331934118a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Wed Mar 20 20:16:44 2002 Nobuyoshi Nakada + + * win32/Makefile.sub: made variables configurable. + + * win32/Makefile.sub (config.h): updates RUBY_PLATFORM from + Makefile. + + * win32/Makefile.sub (config.status): ditto. + + * win32/Makefile.sub (clean): separate ext and local clean up. + + * win32/Makefile.sub (distclean): ditto. + Wed Mar 20 20:12:35 2002 Nobuyoshi Nakada * variable.c (rb_const_list): a temporary table must be freed. diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 44f7840e72..c24b225910 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -23,38 +23,80 @@ icondirs=$(ICONDIRS) !endif !if defined(icondirs) icondirs=$(icondirs:\=/) -iconinc=-I$(icondirs) +iconinc=-I$(icondirs: = -I) !endif ############### VPATH = $(srcdir):$(srcdir)/missing .SUFFIXES: .y +!if !defined(CC) CC = cl +!endif +!if !defined(YACC) YACC = byacc +!endif PURIFY = AUTOCONF = autoconf +!if !defined(PROCESSOR_ARCHITECTURE) || "$(PROCESSOR_ARCHITECTURE)" == "x86" +!if !defined(PROCESSOR_LEVEL) +PROCESSOR_LEVEL = 5 +!endif +PROCESSOR_FLAG = -G$(PROCESSOR_LEVEL) +CPU = i$(PROCESSOR_LEVEL)86 +ARCH = i386 +!else +CPU = $(PROCESSOR_ARCHITECTURE) +ARCH = $(PROCESSOR_ARCHITECTURE) +!endif +!if !defined(DEBUGFLAGS) +DEBUGFLAGS = -Zi +!endif +!if !defined(OPTFLAGS) +OPTFLAGS = -O2b2xg- +!endif +OS = mswin32 +!if !defined(prefix) prefix = /usr -CFLAGS = -nologo -DNT=1 -Zi -MD -O2b2xg- -G5 -CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/missing -DLIBRUBY_SO=\"$(LIBRUBY_SO)\" +!endif +!if !defined(DESTDIR) +DESTDIR = $(prefix) +!endif +!if !defined(CFLAGS) +CFLAGS = -nologo -MD $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) +!endif +!if !defined(CPPFLAGS) +CPPFLAGS = -I. -I$(srcdir) -I$(srcdir)/missing -DLIBRUBY_SO=\"$(LIBRUBY_SO)\" -DNT=1 +!endif +!if !defined(LDFLAGS) LDFLAGS = $(CFLAGS) -Fm +!endif +!if !defined(XLDFLAGS) XLDFLAGS = -#EXTLIBS = +!endif +!if !defined(RFLAGS) +RFLAGS = -r +!endif +!if !defined(EXTLIBS) +EXTLIBS = +!endif LIBS = user32.lib advapi32.lib wsock32.lib $(EXTLIBS) MISSING = crypt.obj win32.obj isinf.obj isnan.obj -LDSHARED = +LDSHARED = $(CC) -LD DLDFLAGS = SOLIBS = -RFLAGS = -r EXEEXT = .exe PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT) WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT) RUBYDEF = $(RUBY_SO_NAME).def +MINIRUBY=miniruby$(EXEEXT) +!if !defined(STACK) STACK = 0x2000000 +!endif ORGLIBPATH = $(LIB) #### End of system configuration section. #### @@ -117,8 +159,96 @@ rubyw: $(WPROGRAM) lib: $(LIBRUBY) dll: $(LIBRUBY_SO) -config.h config.status: $(srcdir)/win32/$$@.in +config: config.h config.status + +config.h: $(srcdir)/win32/$$@.in + @echo Creating config.h @type $(srcdir:/=\)\win32\$@.in > $@ + @echo #undef RUBY_PLATFORM >> $@ + @echo #define RUBY_PLATFORM "$(ARCH)-$(OS)" >> $@ + +config.status: Makefile $(srcdir)/win32/Makefile.sub $(MINIRUBY) + @echo Creating config.status + @echo # Generated automatically by Makefile.sub. > config.tmp + @echo s,@SHELL@,$$(COMSPEC),g >> config.tmp + @echo s,@CFLAGS@,$(CFLAGS),g >> config.tmp + @echo s,@CPPFLAGS@,$(CPPFLAGS),g >> config.tmp + @echo s,@CXXFLAGS@,$(CXXFLAGS),g >> config.tmp + @echo s,@FFLAGS@,$(FFLAGS),g >> config.tmp + @echo s,@LDFLAGS@,$(LDFLAGS),g >> config.tmp + @echo s,@LIBS@,user32.lib advapi32.lib wsock32.lib,g >> config.tmp + @echo s,@exec_prefix@,$${prefix},g >> config.tmp + @echo s,@prefix@,$(prefix),g >> config.tmp + @echo s,@program_transform_name@,s,,,,g >> config.tmp + @echo s,@bindir@,$${exec_prefix}/bin,g >> config.tmp + @echo s,@sbindir@,$${exec_prefix}/sbin,g >> config.tmp + @echo s,@libexecdir@,$${exec_prefix}/libexec,g >> config.tmp + @echo s,@datadir@,$${prefix}/share,g >> config.tmp + @echo s,@sysconfdir@,$${prefix}/etc,g >> config.tmp + @echo s,@sharedstatedir@,/etc,g >> config.tmp + @echo s,@localstatedir@,/var,g >> config.tmp + @echo s,@libdir@,$${exec_prefix}/lib,g >> config.tmp + @echo s,@includedir@,$${prefix}/include,g >> config.tmp + @echo s,@oldincludedir@,/usr/include,g >> config.tmp + @echo s,@infodir@,$${prefix}/info,g >> config.tmp + @echo s,@mandir@,$${prefix}/man,g >> config.tmp + @echo s,@build@,$(CPU)-pc-$(OS),g >> config.tmp + @echo s,@build_alias@,$(CPU)-$(OS),g >> config.tmp + @echo s,@build_cpu@,$(CPU),g >> config.tmp + @echo s,@build_vendor@,pc,g >> config.tmp + @echo s,@build_os@,$(OS),g >> config.tmp + @echo s,@host@,$(CPU)-pc-$(OS),g >> config.tmp + @echo s,@host_alias@,$(CPU)-$(OS),g >> config.tmp + @echo s,@host_cpu@,$(CPU),g >> config.tmp + @echo s,@host_vendor@,pc,g >> config.tmp + @echo s,@host_os@,$(OS),g >> config.tmp + @echo s,@target@,$(ARCH)-pc-$(OS),g >> config.tmp + @echo s,@target_alias@,$(ARCH)-$(OS),g >> config.tmp + @echo s,@target_cpu@,$(ARCH),g >> config.tmp + @echo s,@target_vendor@,pc,g >> config.tmp + @echo s,@target_os@,$(OS),g >> config.tmp + @echo s,@CC@,cl,g >> config.tmp + @echo s,@CPP@,$$(CC) -E,g >> config.tmp + @echo s,@YACC@,$(YACC),g >> config.tmp + @echo s,@RANLIB@,rem,g >> config.tmp + @echo s,@AR@,lib -nologo,g >> config.tmp + @echo s,@LN_S@,$(LN_S),g >> config.tmp + @echo s,@SET_MAKE@,$(SET_MAKE),g >> config.tmp + @echo s,@LIBOBJS@, crypt.obj win32.obj isinf.obj isnan.obj,g >> config.tmp + @echo s,@ALLOCA@,$(ALLOCA),g >> config.tmp + @echo s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),g >> config.tmp + @echo s,@EXEEXT@,.exe,g >> config.tmp + @echo s,@OBJEXT@,obj,g >> config.tmp + @echo s,@XLDFLAGS@,$(XLDFLAGS),g >> config.tmp + @echo s,@DLDFLAGS@,$$(CFLAGS),g >> config.tmp + @echo s,@STATIC@,$(STATIC),g >> config.tmp + @echo s,@CCDLFLAGS@,-DIMPORT,g >> config.tmp + @echo s,@LDSHARED@,$$(CC) -LD,g >> config.tmp + @echo s,@DLEXT@,so,g >> config.tmp + @echo s,@DLEXT2@,dll,g >> config.tmp + @echo s,@STRIP@,$(STRIP),g >> config.tmp + @echo s,@EXTSTATIC@,$(EXTSTATIC),g >> config.tmp + @echo s,@setup@,Setup,g >> config.tmp + @echo s,@LIBRUBY_LDSHARED@,$(LIBRUBY_LDSHARED),g >> config.tmp + @echo s,@LIBRUBY_DLDFLAGS@,$(LIBRUBY_DLDFLAGS),g >> config.tmp + @echo s,@RUBY_INSTALL_NAME@,$(RUBY_INSTALL_NAME),g >> config.tmp + @echo s,@RUBY_SO_NAME@,$(RUBY_SO_NAME),g >> config.tmp + @echo s,@LIBRUBY_A@,lib$$(RUBY_INSTALL_NAME).lib,g >> config.tmp + @echo s,@LIBRUBY_SO@,$$(RUBY_SO_NAME).dll,g >> config.tmp + @echo s,@LIBRUBY_ALIASES@,$(LIBRUBY_ALIASES),g >> config.tmp + @echo s,@LIBRUBY@,$$(RUBY_SO_NAME).lib,g >> config.tmp + @echo s,@LIBRUBYARG@,$$(RUBY_SO_NAME).lib,g >> config.tmp + @echo s,@SOLIBS@,$(SOLIBS),g >> config.tmp + @echo s,@DLDLIBS@,$(DLDLIBS),g >> config.tmp + @echo s,@ENABLE_SHARED@,yes,g >> config.tmp + @echo s,@arch@,$(ARCH)-$(OS),g >> config.tmp + @echo s,@sitedir@,$${prefix}/lib/ruby/site_ruby,g >> config.tmp + @echo s,@configure_args@,--with-make-prog=nmake --enable-shared,g >> config.tmp + @echo s,@configure_input@,$$configure_input,g >> config.tmp + @echo s,@srcdir@,$(srcdir),g >> config.tmp + @echo s,@top_srcdir@,$(srcdir),g >> config.tmp + @$(MINIRUBY) -pe "chomp(' ');~/@CFLAGS@/||$$_['$(CFLAGS)']='$$(CFLAGS)'" config.tmp > $@ + @del config.tmp ext/extmk.rb: $(srcdir)/ext/extmk.rb.in config.status @echo Creating ext/extmk.rb @@ -163,7 +293,9 @@ $(RUBYDEF): $(LIBRUBY_A) miniruby$(EXEEXT) install: rbconfig.rb .\miniruby.exe $(srcdir)/instruby.rb $(DESTDIR) -clean: +clean: clean-ext clean-local + +clean-local: @if exist $(LIBRUBY_A) del $(LIBRUBY_A) @if exist $(MAINOBJ) del $(MAINOBJ) @if exist rbconfig.rb del rbconfig.rb @@ -172,9 +304,13 @@ clean: @if exist ext\vc*.pdb del ext\vc*.pdb @if exist *.obj del *.obj @if exist *.res del *.res + +clean-ext: @-.\miniruby$(EXEEXT) -Cext extmk.rb clean -distclean: clean +distclean: distclean-ext distclean-local + +distclean-local: clean-local @if exist Makefile del Makefile @if exist ext\extmk.rb del ext\extmk.rb @if exist config.h del config.h @@ -204,6 +340,9 @@ distclean: clean @if exist ext\nul if not exist ext\* rmdir ext @if exist miniruby$(EXEEXT) del miniruby$(EXEEXT) +distclean-ext: + @-.\miniruby$(EXEEXT) -Cext extmk.rb distclean + realclean: distclean @if exist parse.c del parse.c @if exist lex.c del lex.c diff --git a/win32/config.h.in b/win32/config.h.in index 22073b0d14..870845b1a6 100644 --- a/win32/config.h.in +++ b/win32/config.h.in @@ -3,7 +3,10 @@ /* #define HAVE_ATTR_NORETURN 1 */ #if _MSC_VER > 1100 && !defined NORETURN #define NORETURN(x) __declspec(noreturn) x +#else +#define NORETURN(x) x #endif +#define TOKEN_PASTE(x,y) x##y #define inline __inline /* #define HAVE_DIRENT_H 1 */ /* #define HAVE_UNISTD_H 1 */ @@ -44,6 +47,7 @@ #define RSHIFT(x,y) ((x)>>y) #define FILE_COUNT _cnt +#define FILE_READPTR _ptr #define DEFAULT_KCODE KCODE_NONE #define DLEXT ".so" #define DLEXT2 ".dll" @@ -51,8 +55,8 @@ #define RUBY_SITE_LIB "/lib/ruby/site_ruby" #define RUBY_SITE_LIB2 "/lib/ruby/site_ruby/1.7" #define RUBY_PLATFORM "i586-mswin32" -#define RUBY_ARCHLIB "/lib/ruby/1.7/i586-mswin32" -#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/i586-mswin32" +#define RUBY_ARCHLIB "/lib/ruby/1.7/" RUBY_PLATFORM +#define RUBY_SITE_ARCHLIB "/lib/ruby/site_ruby/1.7/" RUBY_PLATFORM #define SIZEOF_INT 4 #define SIZEOF_SHORT 2 diff --git a/win32/setup.mak b/win32/setup.mak index 28f89e8c30..0c0acfa1e6 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -9,7 +9,6 @@ srcdir = $(WIN32DIR)/.. !ENDIF OS = mswin32 -all: config.h config.status all: ext all: Makefile all:; @echo type `nmake' to make ruby for mswin32. @@ -19,9 +18,13 @@ Makefile: @echo srcdir = $(srcdir:\=/)>> $@ @echo RUBY_INSTALL_NAME = ruby>> $@ @echo RUBY_SO_NAME = $(OS)-$$(RUBY_INSTALL_NAME)17>> $@ + @echo prefix = /usr>> $@ + @echo CFLAGS = -nologo -MD $$(DEBUGFLAGS) $$(OPTFLAGS) $$(PROCESSOR_FLAG)>> $@ + @echo CPPFLAGS = -I. -I$$(srcdir) -I$$(srcdir)/missing -DLIBRUBY_SO=\"$$(LIBRUBY_SO)\" -DNT=1>> $@ + @echo LDFLAGS = $$(CFLAGS) -Fm>> $@ + @echo XLDFLAGS = >> $@ + @echo RFLAGS = -r>> $@ + @echo EXTLIBS =>> $@ @echo !INCLUDE $$(srcdir)/win32/Makefile.sub>> $@ -config.h config.status: $(srcdir)/win32/$$@.in - @type $(srcdir:/=\)\win32\$@.in > $@ - ext:; @if not exist $@\* mkdir $@