diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 2b495e9a5..c94a3a15e 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -489,7 +489,7 @@ generate: generate_apps generate_crypto_bn generate_crypto_objects lint: lint -DLINT $(INCLUDES) $(SRCS) -generate_apps: $(SRCDIR)/apps/openssl-vms.cnf +generate_apps: $(SRCDIR)/apps/openssl-vms.cnf $(SRCDIR)/apps/progs.h generate_crypto_bn: $(SRCDIR)/crypto/bn/bn_prime.h @@ -583,6 +583,17 @@ $(SRCDIR)/apps/openssl-vms.cnf: $(SRCDIR)/apps/openssl.cnf $(PERL) $(SRCDIR)/VMS/VMSify-conf.pl \ < $(SRCDIR)/apps/openssl.cnf > $(SRCDIR)/apps/openssl-vms.cnf +{- # because the program apps/openssl has object files as sources, and + # they then have the corresponding C files as source, we need to chain + # the lookups in %unified_info + my $apps_openssl = catfile("apps","openssl"); + our @openssl_source = map { @{$unified_info{sources}->{$_}} } + @{$unified_info{sources}->{$apps_openssl}}; + ""; -} +$(SRCDIR)/apps/progs.h: + $(RM) $@ + $(PERL) $(SRCDIR)/apps/progs.pl {- join(" ", @openssl_source) -} > $@ + $(SRCDIR)/crypto/bn/bn_prime.h: $(SRCDIR)/crypto/bn/bn_prime.pl $(PERL) $(SRCDIR)/crypto/bn/bn_prime.pl > $(SRCDIR)/crypto/bn/bn_prime.h diff --git a/apps/Makefile.in b/apps/Makefile.in index 966868489..e3f485d90 100644 --- a/apps/Makefile.in +++ b/apps/Makefile.in @@ -50,7 +50,7 @@ SRC = \ genpkey.c genrsa.c nseq.c ocsp.c passwd.c pkcs12.c pkcs7.c pkcs8.c \ pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c rsa.c rsautl.c \ s_client.c s_server.c s_time.c sess_id.c smime.c speed.c spkac.c \ - srp.c ts.c verify.c version.c x509.c + srp.c ts.c verify.c version.c x509.c rehash.c EXE_OBJ = openssl.o $(OBJ) $(EXTRA_OBJ) $(RAND_OBJ) EXE_SRC = openssl.c $(SRC) $(EXTRA_SRC) $(RAND_SRC) @@ -108,7 +108,7 @@ uninstall: done $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf -generate: openssl-vms.cnf +generate: openssl-vms.cnf progs.h depend: $(TOP)/util/domd $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(EXE_SRC) @@ -123,7 +123,7 @@ $(DLIBSSL): $(DLIBCRYPTO): (cd ..; $(MAKE) build_libcrypto) -$(EXE): progs.h $(EXE_OBJ) $(DLIBCRYPTO) $(DLIBSSL) +$(EXE): $(EXE_OBJ) $(DLIBCRYPTO) $(DLIBSSL) $(RM) $(EXE) shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \ shlib_target="$(SHLIB_TARGET)"; \ @@ -135,10 +135,9 @@ $(EXE): progs.h $(EXE_OBJ) $(DLIBCRYPTO) $(DLIBSSL) LIBDEPS="$(PLIB_LDFLAG) $$LIBRARIES $(EX_LIBS)" \ link_app.$${shlib_target} -progs.h: progs.pl Makefile +progs.h: progs.pl Makefile.in $(RM) progs.h - $(PERL) progs.pl $(COMMANDS) >progs.h - $(RM) openssl.o + $(PERL) progs.pl $(EXE_SRC) > progs.h CA.pl: CA.pl.in $(PERL) -I$(TOP) -Mconfigdata $(TOP)/util/dofile.pl -oapps/Makefile CA.pl.in > CA.pl.new diff --git a/apps/build.info b/apps/build.info index 173f1bc0e..a7dcee6e1 100644 --- a/apps/build.info +++ b/apps/build.info @@ -16,9 +16,3 @@ DEPEND[openssl]=../libssl SCRIPTS=CA.pl SOURCE[CA.pl]=CA.pl.in - -BEGINRAW[Makefile] -{- $builddir -}/progs.h: {- $sourcedir -}/progs.pl {- $builddir -}/../Makefile - $(RM) {- $builddir -}/progs.h - $(PERL) {- $sourcedir -}/progs.pl $(COMMANDS) >{- $builddir -}/progs.h -ENDRAW[Makefile] diff --git a/apps/progs.pl b/apps/progs.pl index 40053a730..b87aef610 100644 --- a/apps/progs.pl +++ b/apps/progs.pl @@ -1,5 +1,23 @@ -#!/usr/local/bin/perl -# Generate progs.h file from list of "programs" passed on the command line. +#!/usr/bin/perl +# Generate progs.h file by looking for command mains in list of C files +# passed on the command line. + +use strict; +use warnings; + +my %commands = (); +my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/; + +foreach my $filename (@ARGV) { + open F, $filename or die "Coudn't open $_: $!\n"; + foreach (grep /$cmdre/, ) { + my @foo = /$cmdre/; + $commands{$1} = 1; + } + close F; +} + +@ARGV = sort keys %commands; print <<'EOF'; /* @@ -24,13 +42,6 @@ DEFINE_LHASH_OF(FUNCTION); EOF -grep(s/\.o//, @ARGV); -grep(s/^asn1pars$/asn1parse/, @ARGV); -grep(s/^crl2p7$/crl2pkcs7/, @ARGV); -push @ARGV, 'list'; -push @ARGV, 'help'; -push @ARGV, 'exit'; - foreach (@ARGV) { printf "extern int %s_main(int argc, char *argv[]);\n", $_; } @@ -43,7 +54,7 @@ foreach (@ARGV) { print "\n#ifdef INCLUDE_FUNCTION_TABLE\n"; print "static FUNCTION functions[] = {\n"; foreach (@ARGV) { - $str=" { FT_general, \"$_\", ${_}_main, ${_}_options },\n"; + my $str=" { FT_general, \"$_\", ${_}_main, ${_}_options },\n"; if (/^s_/ || /^ciphers$/) { print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n"; } elsif (/^engine$/) { @@ -101,7 +112,7 @@ foreach ( "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb", "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb" ) { - $str=" { FT_cipher, \"$_\", enc_main, enc_options },\n"; + my $str=" { FT_cipher, \"$_\", enc_main, enc_options },\n"; if (/des/) { printf "#ifndef OPENSSL_NO_DES\n${str}#endif\n"; } elsif (/aes/) {