From b1b1f3ded2e0150fbbbd26a6dd9ef3bc41714ecb Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 4 Jun 2016 02:40:04 +0000 Subject: [PATCH] des_tables.c: generation rule * defs/gmake.mk (missing/des_tables.c): move the recipe from common.mk. this is less common. * missing/crypt.c (init_des): if des_tables.c is empty, initialize DES tables at runtime. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- common.mk | 8 -------- defs/gmake.mk | 12 ++++++++++++ missing/crypt.c | 16 ++++++++++++---- missing/des_tables.c | 4 ++++ 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/common.mk b/common.mk index a8732c8196..ff435a0cfd 100644 --- a/common.mk +++ b/common.mk @@ -748,14 +748,6 @@ $(NEWLINE_C): $(srcdir)/enc/trans/newline.trans $(srcdir)/tool/transcode-tblgen. $(Q) $(BASERUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo $@ $(srcdir)/enc/trans/newline.trans enc/trans/newline.$(OBJEXT): $(NEWLINE_C) -{$(VPATH)}missing/des_tables.c: $(srcdir)/missing/crypt.c - @$(ECHO) building make_des_table - $(Q) $(PURIFY) $(CC) $(CPPFLAGS) -DDUMP $(LDFLAGS) $(XLDFLAGS) $(LIBS) $(OUTFLAG)make_des_table $(srcdir)/missing/crypt.c - @$(ECHO) generating $@ - $(Q) $(MAKEDIRS) $(@D) - $(Q) ./make_des_table > $@ - $(Q) $(RMALL) make_des_table* - verconf.h: $(srcdir)/template/verconf.h.tmpl $(srcdir)/tool/generic_erb.rb $(ECHO) creating $@ $(Q) $(BOOTSTRAPRUBY) "$(srcdir)/tool/generic_erb.rb" -o $@ $(srcdir)/template/verconf.h.tmpl diff --git a/defs/gmake.mk b/defs/gmake.mk index b5acb48576..ba68dc19b9 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -77,3 +77,15 @@ sudo-precheck: test install-prereq: sudo-precheck yes-test-all no-test-all: install endif + +$(srcdir)/missing/des_tables.c: $(srcdir)/missing/crypt.c +ifeq ($(if $(CC),$(CROSS_COMPILING),yes),yes) + touch $@ +else + @$(ECHO) building make_des_table + $(Q) $(PURIFY) $(CC) $(CPPFLAGS) -DDUMP $(LDFLAGS) $(XLDFLAGS) $(LIBS) $(OUTFLAG)make_des_table $(srcdir)/missing/crypt.c + @$(ECHO) generating $@ + $(Q) $(MAKEDIRS) $(@D) + $(Q) ./make_des_table > $@ + $(Q) $(RMALL) make_des_table* +endif diff --git a/missing/crypt.c b/missing/crypt.c index 22be52fbf0..f523aa51e6 100644 --- a/missing/crypt.c +++ b/missing/crypt.c @@ -93,6 +93,15 @@ static char sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93"; # define INIT_DES 0 # endif #endif +#if !INIT_DES +# include "des_tables.c" +# ifdef HAVE_DES_TABLES +# define init_des() ((void)0) +# else +# undef INIT_DES +# define INIT_DES 1 +# endif +#endif /* * Convert twenty-four-bit long in host-order @@ -353,10 +362,6 @@ static des_tables_t des_tables[1]; STATIC void init_des(void); STATIC void init_perm(C_block perm[64/CHUNKBITS][1<