Commit graph

170 commits

Author SHA1 Message Date
Richard Levitte
1e3d16b0a6 Don't make a difference between building test programs and other programs
This adds a new target 'build_programs' and makes 'build_apps' and
'build_tests' aliases for it, for backward compatibility.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-18 20:49:54 +02:00
Richard Levitte
0f01b7bc85 Adapt the build files to the new "install" hash table
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-18 20:49:54 +02:00
Richard Levitte
b1837abd67 Small fixes in unix-Makefile.tmpl
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-14 21:14:26 +02:00
Richard Levitte
24c4f73690 Install applink.c with the public header files.
This is only done for the platforms where 'OPENSSL_USE_APPLINK' is defined.

Also, change the docs of OPENSSL_Applink to say where to find applink.c
in the installation directory.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-14 21:13:37 +02:00
Richard Levitte
3503549ee8 Unix: Set the execute permission on installed shared libraries
Some Unix variants require shared libraries to have the execute
permissions set, or they won't be loadable or executable when loaded.
Among others, cygwin has this requirement.

Reviewed-by: Matt Caswell <matt@openssl.org>
2016-07-08 15:04:30 +02:00
Richard Levitte
b2de11c58b Versioning engines default location: the Unix case
OpenSSL engines are tied to the OpenSSL shared library versions,
starting with OpenSSL 1.1.  We therefore need to install them in
directories which have the shared library version in it's name, to
easily allow multiple OpenSSL versions to be installed at the same
time.

For Unix, the default installation directory is changed from
$PREFIX/lib/engines to $PREFIX/lib/engines-${major}_${minor} (mingw)
or $PREFIX/lib/engines-${major}.${minor} (all but mingw)

($PREFIX is the directory given for the configuration option --prefix,
and ${major} and ${minor} are the major and minor shared library
version numbers)

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-07 15:07:32 +02:00
Richard Levitte
8478a70333 Make 'build_libs' build shared libraries as well
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-07-06 14:38:13 +02:00
Ben Laurie
27c40a9317 Ensure that global dependencies are built first, even for parallell builds
Also, make sure that per-file deps are included in the build, even if previous
builds have failed.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-07-02 13:57:07 +01:00
Richard Levitte
15a1f19e62 Deal with pod2html issues, in this case the lack of .html suffix in links
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-07-01 19:06:37 +02:00
Richard Levitte
850000aa41 Build files: don't generate empty action lines in generatedir()
Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-06-28 14:02:44 +02:00
Roumen Petrov
57ade5711b Use include paths to our source before any other cflags
This is just in case someone passed an inclusion path with the
configuration, and there are OpenSSL headers from another version
in there.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-06-27 23:52:40 +02:00
Andy Polyakov
dbbb6a87a7 unix-Makefile.tmpl: omit lib<rary>.a updates from directory targets.
Since corresponding rule was removed from windows-makefile.tmpl out
of necessity, question popped if it's appropriate to harmonize even
unix-Makefile.tmpl. Note that as long as you work on single directory
'make lib<rary>.a' is effectively equivalent to 'make <dir/ectory>'
prior this modification.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-06-27 23:28:07 +02:00
Richard Levitte
4813ad2d24 Harmonise the different build files
- User targets are now the same and generally do the same things
- configdata.pm depends on exactly the same files on all platforms
- VMS production of shared libraries is simplified
- VMS automatic dependency files get the extension .D rather than .MMS

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-17 16:06:31 +02:00
Richard Levitte
932eaf0085 Add a developer target 'build_generated' to rebuild mandatory headers
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-14 22:11:38 +02:00
Richard Levitte
7cae38642e Build file templates: make sure to depend on generated header files
As well as properly generating those that are made from .in files.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-14 22:11:38 +02:00
Ben Laurie
a1bce642c9 Omit corpora from tarball.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-06-10 13:00:31 +01:00
Richard Levitte
0ad1d94df4 Add developer targets for each subdirectory we have something to build in
Previous build scheme allowed building just the stuff in one
subdirectory, like this:

    make -C crypto/aes

Because the unified only has a top-level Makefile, this is not
possible with it.  This change adds a replacement where each directory
we have something to build in becomes a target in its own right,
allowing building something like this:

    make crypto/aes

The exception is the directory test, because we already have such a
target.

Reviewed-by: Stephen Henson <steve@openssl.org>
2016-06-04 20:33:46 +02:00
Rich Salz
b8a9af6881 Remove/rename some old files.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-06-01 11:29:57 -04:00
Richard Levitte
cbece22079 Allow space in PERL spec (unix only)
Someone wants to configure like this:

    PERL="/usr/bin/env perl" ./config

The end goal is to get that in the #! line of CA.pl and a few other
scripts.  That works well already, but in the Makefile, there were a
few lines looking like this:

    PERL=$(PERL) $(PERL) whatever.pl ...

Those need some quoting.

RT#4311

Reviewed-by: Matt Caswell <matt@openssl.org>
2016-05-27 17:38:31 +02:00
Richard Levitte
05a7aee0e2 Communicate Configure generated header files to build files
Add Configure generated header files to $unified_info{generate}.  This
makes sure the build files will pick them up with the rest for the
GENERATED macro, and thereby make sure they get cleaned away by 'make
clean'

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-05-25 00:46:00 +02:00
Richard Levitte
beadb44157 HTML docs on Unix: Add a HTML title
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-05-23 00:45:44 +02:00
Richard Levitte
8f41ff2d53 Add support for RC / WINDRES env variables
RT#2558

Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-05-16 18:03:40 +02:00
Cristian Stoica
1b4d0e3c1e do not remove links found in .git directory
Some setups use links inside .git directory and make clean should not
remove them to avoid breaking git meta-information.

Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>

CLA: none; trivial
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1078)
2016-05-16 17:58:52 +02:00
Andy Polyakov
39199fb3b0 Configurations/unix-Makefile.tmpl: don't count on -E -P.
Some non-Gnu compilers interpret -E -P combination differently.
some prioritize -E over -P, others -P over -E (in which case .i
file is generated and sometimes truncated because of redirection).

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-03 20:57:00 +02:00
Andy Polyakov
cba792a1e9 Android build fixes.
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-05-02 12:49:57 +02:00
Richard Levitte
b7650c6797 Add the adjusted perl scripts to the set of "update" scripts
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-05-01 15:09:20 +02:00
Kirill Marinushkin
e6f2bb6604 Fixed scripts order for generate_crypto_objects target
Script obj_dat.pl depends on file obj_mac.h generated by script objects.pl

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-29 09:17:09 -04:00
Richard Levitte
8d34daf0ce Build system: add include directories and dependencies for generators
In the case of generating a file like this:

    GENERATE[foo.S]=mkfoo.pl arg1 arg2

the 'mkfoo.pl' generator itself might need to include other files,
such as perl modules within our source tree.  We can reuse already
existing syntax for it, like this:

    INCLUDE[mkfoo.pl]=module/path

or:

    DEPEND[mkfoo.pl]=modules/mymodule.pm

This change implements the support for such constructs, and for the
DEPEND statement, for any value that indicates a perl module (.pm
file), it will automatically infer an INCLUDE statement for its
directory, just like it does for C header files, so you won't have do
write this:

    DEPEND[mkfoo.pl]=modules/mymodule.pm
    INCLUDE[mkfoo.pl]=modules

Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-04-25 18:06:06 +02:00
Richard Levitte
1b741653ce Build: Make 'test' depend on 'tests'
Because we have a directory 'test', the target 'test' may be confusing
to make.  However, if we make it depend on 'tests', which doesn't
exist, make should never fail to run the actions.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-04-19 20:56:35 +02:00
Richard Levitte
df6533795b Fix installation for no-stdio and no-autoalginit
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-14 16:41:03 +01:00
Matt Caswell
d90a6beb0e Fix no-stdio and no-autoalginit
no-stdio does not work with the apps. Since the tests also need the apps
it doesn't support that either. Therefore we disable building of both.

no-autoalginit is not compatible with the apps because it requires explicit
loading of the algorithms, and the apps don't do that. Therefore we disable
building the apps for this option. Similarly the tests depend on the apps
so we also disable the tests. Finally the whole point about no-autoalginit
is to avoid excessive executable sizes when doing static linking. Therefore
we disable "shared" if this option is selected.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-14 16:41:03 +01:00
Richard Levitte
da430a5555 Fix the handling of --with-zlib-include
The handling was Unix centric, already in Configure.  Change that to
just collect the value and let the build file templates figure out
what to do with it.

Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-13 11:36:46 +02:00
Emilia Kasper
53ff6ac159 Remove redundant symlink
We used to symlink generate_ssl_tests.pl to the build directory.
Now that the build scripts look for sources in both directories, this
is no longer necessary (see commit
fbd361eaf8).

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-07 14:17:24 +02:00
Emilia Kasper
453dfd8d5e New SSL test framework
Currently, SSL tests are configured via command-line switches to
ssltest.c. This results in a lot of duplication between ssltest.c and
apps, and a complex setup. ssltest.c is also simply old and needs
maintenance.

Instead, we already have a way to configure SSL servers and clients, so
we leverage that. SSL tests can now be configured from a configuration
file. Test servers and clients are configured using the standard
ssl_conf module. Additional test settings are configured via a test
configuration.

Moreover, since the CONF language involves unnecessary boilerplate, the
test conf itself is generated from a shorter Perl syntax.

The generated testcase files are checked in to the repo to make
it easier to verify that the intended test cases are in fact run; and to
simplify debugging failures.

To demonstrate the approach, min/max protocol tests are converted to the
new format. This change also fixes MinProtocol and MaxProtocol
handling. It was previously requested that an SSL_CTX have both the
server and client flags set for these commands; this clearly can never work.

Guide to this PR:
 - test/ssl_test.c - test framework
 - test/ssl_test_ctx.* - test configuration structure
 - test/handshake_helper.* - new SSL test handshaking code
 - test/ssl-tests/ - test configurations
 - test/generate_ssl_tests.pl - script for generating CONF-style test
   configurations from perl inputs

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-05 13:44:46 +02:00
Richard Levitte
68cd4e3f99 Makefile et al template: only modify static library with new object files
Previously, we updated the static libraries (libcrypto.a on Unix,
libcrypto.lib on Windows) with all the object files, regardless of if
they were rebuilt or not.  With this change, we only update them with
the object files were rebuilt.

NOTE: this does not apply on VMS, as the expansion of $? may be too
large for a command line.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-04-04 00:24:58 +02:00
Richard Levitte
e3d8185880 make depend: Check that find returned a non-empty string rather than an empty
The logic to find out of there are any .d files newer than Makefile is
sound.  Checking the result was less so.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-02 20:10:03 +02:00
Coty Sutherland
2d5a1cfab8 Correcting typo that causes make install fail
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-02 17:20:55 +02:00
Richard Levitte
5902821d81 Make the use of perl more consistent
- In Configure, register the perl interpreter used to run Configure,
  so that's the one being used throughout instead of something else
  that Configure happens to find.  This is helpful for using a perl
  version that's not necessarely first in $PATH:

    /opt/perl/5.22.1/bin/perl ./Configure

- Make apps/tsget a generated file, just like apps/CA.pl, so the
  perl interpreter registered by Configure becomes the hashbang path
  instead of a hardcoded /usr/bin/perl

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-04-01 07:24:04 +02:00
Richard Levitte
47a11172f1 'make test' depends of having util/shlib-wrap.sh symlinked in build dir
Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-30 04:33:48 +02:00
Richard Levitte
2b364f615b In for loop values, introduce a dummy to protect against empty list
In constructions such as 'for x in $(MAKEVAR); do ...', there's the
possibility that $(MAKEVAR) is en empty value.  Some shells don't like
that, so introduce a dummy value that gets discarded:

    for x in dummy $(MAKEVAR); do
        if [ "$$x" = "dummy" ]; then continue; fi

Closes RT#4459

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-21 16:11:12 +01:00
Richard Levitte
f3e5948af6 Have makedepend output to stdout and redirect it
This gives us better control of what files are produced.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-20 23:03:10 +01:00
Richard Levitte
674d5858df If the asm file to be compiled isn't generated, leave the ext alone
Closes RT#4447

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-03-19 22:21:14 +01:00
Richard Levitte
9a9f8ee788 Don't let 'generate' target depend on generated files, act directly instead
One of the 'generate' targets depended on $(SRCDIR)/apps/progs.h,
which depended on...  nothing.  This meant it never got regenerated
once it existed, regardless of need.  Of course, we could have it
depend on all the files checked to generate it, but they also depend
on progs.h, so we'd end up getting cricular dependencies, which makes
make unhappy.

Furthermore, and this applies for the other generated files, having
them as targets means that they may be regenerated on the fly in some
cases, and since they get written to the source tree, this isn't such
a good idea if that tree is read-only (which is a possible situation
in an out-of-tree build).

So, we move all the actions to the 'generate' targets themselves, thus
making sure they get regenerated in a controlled manner and regardless
of dependencies.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-03-19 22:19:12 +01:00
Viktor Dukhovni
ffc8d605e8 Revert "Generate apps/progs.h on the fly"
This reverts commit 04e2a52737.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-19 13:29:35 -04:00
Richard Levitte
5287761bfc Replace sed command with perl
Some implementations of sed require a newline before an ending '}'.
The easier method is to replace that sed command with the
corresponding perl command.

Closes RT#4448

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-19 11:18:56 +01:00
Richard Levitte
243a98d4a0 Clear the exit code from 'find' in 'make depend'
Depending on what has been built so far, all .d files may not be
present and 'find' will exit with non-zero exit code.  This isn't a
bother for us but may break make, so clear the exit code with an added
'exit 0'.

Closes RT#4444

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-19 11:17:42 +01:00
Richard Levitte
ac89799c3e Shut find up about files not found
Some of the files in $(DEPS) might not exist.  We don't need to know.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-19 02:40:02 +01:00
Richard Levitte
769777b0a2 Use the dependencies received in generatesrc()
generatesrc() did already receive dependency information, but never
used it, and never really needed to...  until now.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-19 01:49:31 +01:00
Richard Levitte
04e2a52737 Generate apps/progs.h on the fly
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-19 01:49:31 +01:00
Richard Levitte
a6adf099cb Better 'make depend' mechanism
Instead of relying on the '-nt' test operator, which doesn't exist
everywhere, use find's '-newer' to find out if any of the known .d
files is newer than Makefile.

Closes RT#4444

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-18 20:55:10 +01:00
Richard Levitte
a717738b45 Don't define OPENSSL_ENGINES in test recipes, do it in Makefiles instead
In most builds, we can assume that engines live in the build tree
subdirectory "engines".  This was hard coded into the tests that use
the engine ossltest.

However, that hard coding is tedious, it would need to be done in
every test recipe, and it's an incorrect assumption in some cases.

This change has us play it safe and let the build files tell the
testing framework where the engines are.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-03-17 10:10:59 +01:00
Richard Levitte
757c416c4d unix-Makefile template: use $(PERL) everywhere
There was one spot that had hard-coded 'perl'

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-16 23:59:20 +01:00
Matt Caswell
c1ea997aa8 We should use $SRCDIR in Makefiles
Normally we always refer to source files relative to $SRCDIR in Makefiles.
However the reference to unix-Makefile.tmpl was using a fully expanded
absolute path. This can cause problems for Mingw.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-16 13:35:18 +01:00
Richard Levitte
4def90c5de Make the perl dependency post-processor into just one line
Make doesn't always treat multiline quoted strings as nicely as one
would wish.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-15 23:49:22 +01:00
Richard Levitte
29b28eee3e Not all shells understand !
In unix-Makefile.tmpl, this construction has been used a few times

	if ! something; then ...

It seems, though, that some shells do not understand !, so these need
to be changed.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-15 22:28:16 +01:00
Richard Levitte
4c1cf7e440 Collect the names of generated files and clean them away at target clean:
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-13 00:03:48 +01:00
Richard Levitte
8a0a3d293c Use single quotes rather than double quotes when needed
When passing down values to Makefile.shared, do so with single quotes
as much as possible to avoid having the shell create a mess of quotes.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-13 00:02:55 +01:00
Richard Levitte
bbd9a50fa8 Harmonize Unix Makefile template with Windows dito
The variable SHARED_CFLAGS and SHARD_LDFLAGS were used in the Unix
template because they normally contain options used when building
"shared".  The Windows template, on the other hand, uses LIB_CFLAGS,
to express the intended use of those flags rather than their content.
The Windows template still used SHARED_LDFLAGS, which seems
inconsistent.

To harmonize the two, any SHARED_CFLAGS gets renamed to LIB_CFLAGS and
SHARED_LDFLAGS to LIB_LDFLAGS.  That makes the intent consistent along
with BIN_{C,LD}FLAGS and DSO_{C,LD}FLAGS.

Finally, make sure to pass down $(LIB_CFLAGS) or $(DSO_CFLAGS) along
with $(CFLAGS) when using Makefile.shared.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-13 00:02:55 +01:00
Richard Levitte
ef75444d08 Avoid sed for dependency post-processing
It turns out that different sed implementations treat -i differently
to cause issues.  make it simpler by avoiding it entirely and give
perl the trust to be consistent enough.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-12 01:15:12 +01:00
Richard Levitte
bb26842d1c Some sed implementations are not greedy enough, use perl instead
The issue is demonstrated as follows:

  On Linux:

    $ echo ': foo.h /usr/include/stddef.h bar.h' | sed -e 's/ \/\(\\.\|[^ ]\)*//g'
    : foo.h bar.h

  On MacOS X:

    $ echo ': foo.h /usr/include/stddef.h bar.h' | sed -e 's/ \/\(\\.\|[^ ]\)*//g'
    : foo.husr/include/stddef.h bar.h

Perl is more consistent:

  On Linux:

    $ echo ': foo.h /usr/include/stddef.h bar.h' | perl -pe 's/ \/(\\.|[^ ])*//g;'
    : foo.h bar.h

  On MacOS X:

    $ echo ': foo.h /usr/include/stddef.h bar.h' | perl -pe 's/ \/(\\.|[^ ])*//g;'
    : foo.h bar.h

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-11 17:41:43 +01:00
Andy Polyakov
0218fc3778 Configurations/unix-Makefile.tmpl: don't leave empty .s files behind.
If pre-processor failed, an empty .s file could be left behind,
which could get successfully compiled if one simply re-ran make
and cause linking failures. Not anymore. Remove even intermediate .S
in case of pre-processor failure.

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-11 15:29:49 +01:00
Richard Levitte
987dbc7fbf Harmonise the two methods to generate dependency files
One of them didn't clean away .d.tmp files properly.
The other would overwrite the .d files unconditionally, thereby
causing a possibly unnecessary dependency rebuild, which touches the
date of Makefile, which causes a possibly unnecessary rebuild of
buildinf.h and everything that depends on that.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-11 11:19:50 +01:00
Richard Levitte
fb044341e6 In the recipe using "makedepend", make sure the object file extension is there
Reviewed-by: Stephen Henson <steve@openssl.org>
2016-03-10 20:13:01 +01:00
Richard Levitte
d46057277f Pass down inclusion directories to source file generators
The source file generators sometimes use $(CC) to post-process
generated source, and getting the inclusion directories may be
necessary at times, so we pass them down.

RT#4406

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-10 10:02:29 +01:00
Richard Levitte
29eed3ddb8 Adapt unix Makefile template to 'no-makedepend'
This change is a bit more complex, as it involves several recipe
variants.

Also, remove the $(CROSS_COMPILE) prefix for the makedepend program.
When we use the program "makedepend", this doesn't serve anything,
and when we use the compiler, this value isn't even used.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-09 01:57:52 +01:00
Richard Levitte
8458f1bfab Redo the Unix source code generator
For assembler, we want the final target to be foo.s (lowercase s).
However, the build.info may have lines like this (note upper case S):

    GENERATE[foo.S]=foo.pl

This indicates that foo.s (lowercase s) is still to be produced, but
that producing it will take an extra step via $(CC) -E.  Therefore,
the following variants (simplified for display) can be generated:

    GENERATE[foo.S]=foo.pl  =>  foo.s: foo.pl
                                	$(PERL) $foo.pl $@.S; \
                                	$(CC) $(CFLAGS) -E -P $@.S > $@ && \
                                	rm -f $@.S

    GENERATE[foo.s]=foo.pl  =>  foo.s: foo.pl
                                	$(PERL) $foo.pl $@

    GENERATE[foo.S]=foo.m4  =>  foo.s: foo.m4
                                	m4 -B 8192 $foo.m4 > $@.S; \
                                	$(CC) $(CFLAGS) -E -P $@.S > $@ && \
                                	rm -f $@.S

    GENERATE[foo.s]=foo.m4  =>  foo.s: foo.m4
                                	m4 -B 8192 $foo.m4 > $@

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-09 00:15:56 +01:00
Richard Levitte
54bb8f74bd Fix configurations such as 'dist' and tar building
For config targets such as 'dist', which doesn't have a BASE template,
we still need to have a default build scheme.

Additionally, the unified Makefile template's target 'tar' wasn't
quite as flexible as the unixmake one.

Finally, .travis-create-release.sh can be somewhat simplified now that
it builds with the unified build scheme.

Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-08 12:32:00 +01:00
Richard Levitte
66ddf178b4 Unified - Adapt the Unix and VMS templates to support GENERATE
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-07 18:25:56 +01:00
Richard Levitte
c8cca980dc Correction, $disabled{shared} rather than $config{no_shared}
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-04 05:43:15 +01:00
Richard Levitte
b894054e3f Remove overzealous echoing
This construct in a Makefile is a bit overzealous:

	@echo FOO
	@FOO

Cleaned up.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-03 17:52:26 +01:00
Richard Levitte
2952b9b811 Don't copy from %target to %config so much, see %config as a complement
We copied $target{cflags}, $target{defines} and a few more to %config,
just to add to the entries.  Avoid doing so, and let the build templates
deal with combining the two.

There are a few cases where we still fiddle with %target, but that's
acceptable.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-02 19:15:42 +01:00
Richard Levitte
940a09bad4 Minimize copied config settings
$target{lflags} and $target{plib_flag} were copied to %config for no
good reason.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-02 19:15:42 +01:00
Richard Levitte
2e0956ba6d Unified - have configdata.pm depend on a few more things
Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-01 06:39:16 +01:00
Richard Levitte
340da949cc Make generation of dependency files more efficient when possible
When building with GNU C, clang or VMS C, it's more efficient to
generate dependency file and object file in one call rather than two.
Have the dependency output in a temporary file and compare it with the
previous one if available to see if replacement is waranted, thereby
avoiding unnecessary reconstruction of Makefile / descrip.mms.

Github issue #750

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-28 01:16:44 +01:00
Rich Salz
6ab364149d Remove some old files.
I read the PROBLEMS, and they're outdated; nothing I'd put in the
online FAQ, for example.  Test-builds work without using these files.
Had to remove the rehash.time stuff from Makefile.in

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-27 13:39:46 -05:00
Rob Percival
0cea8832df Public API for Certificate Transparency
Reviewed-by: Ben Laurie <ben@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-26 14:57:29 -05:00
Richard Levitte
28a55a873d Make it possible to build even if dependency files can't be generated
If the local system doesn't have GNU C or clang, and not even
makedepend, the build will stop because the call of 'makedepend'
fails.  This changes so the build won't stop because of such failure.
The result will be empty .d files, and that's ok.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-25 14:48:52 +01:00
Richard Levitte
84af1bae68 Clean away $config{no_shared} since we have $disabled{shared}
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-22 16:36:58 +01:00
Richard Levitte
f8d9d6e48b Check that any dependency file is newer than Makefile before concatenating
On slower file systems, this makes a huge difference

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-21 16:26:06 +01:00
Richard Levitte
ea80a25e81 Avoid GNU make re-exec when adding dependencies to Makefile
GNU make will re-exec if (it thinks that) the Makefile has changed.
Just having the target Makefile seems to make it think it has, so we
end up in a look where GNU make re-execs for ever.

The fix is easy, just remove the Makefile target and have the depend
target run the recipe on its own instead of depending on Makefile.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-21 00:33:54 +01:00
Ben Laurie
834aae2a99 Remove OBJ_EXT and friends.
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-20 21:07:29 +00:00
Ben Laurie
58f2b0ae58 Missing extension on dependency, .d file is not always made (e.g. when input
is a .s).

Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-02-20 16:56:44 +00:00
Richard Levitte
45502bfe19 Always build library object files with shared library cflags
This takes us away from the idea that we know exactly how our static
libraries are going to get used.  Instead, we make them available to
build shareable things with, be it other shared libraries or DSOs.

On the other hand, we also have greater control of when the shared
library cflags.  They will never be used with object files meant got
binaries, such as apps/openssl or test/test*.

With unified, we take this a bit further and prepare for having to
deal with extra cflags specifically to be used with DSOs (dynamic
engines), libraries and binaries (applications).

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-20 16:51:31 +01:00
Richard Levitte
874efa9f81 Unified 'make depend' has to cleanup after itself
It failed to remove lingering Makefile.new

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-19 23:34:25 +01:00
Richard Levitte
ce5ed82f82 Fix Configurations/unix-Makefile.tmpl
It was turning off output again in two place where it should have
turned it on.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-19 22:39:08 +01:00
Richard Levitte
0fb3b62902 Make sure the linked programs have the correct extension
Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:52:16 +01:00
Richard Levitte
f99f91f121 Misc small fixes.
Better libclean that removes the exact files that have been built,
nothing more and nothing less.

Corrected typo

A couple of editorial changes.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:52:15 +01:00
Richard Levitte
98e5534e65 Try removing installation directories after having uninstalled files
Of course, if there are remaining files in a directory, it won't be removed.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:52:15 +01:00
Richard Levitte
5386287cfc Small rename fest in unified, obj2dynlib -> obj2dso
Since we're using the acronym DSO everywhere else and that's a common
name for that kind of object, we might as well do so here as well.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:52:15 +01:00
Richard Levitte
c8c2b77900 Remake the installation of shared libraries in unix-Makefile.tmpl
Instead of having the installation recipe rely on special knowledge,
feed it with information, including what shared library files belong
together.  For Cygwin and Mingw, that's the .dll and its import
library .dll.a.  For Unixen, it's the shared library file name with SO
version and the one without.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:52:15 +01:00
Richard Levitte
e048fd5171 Big rename fest in makefile.shared: link_a / link_o -> link_shlib / link_dso
Originally, the Makefile.shared targets described what they used as
input for a shared object, be it a shared library or a DSO.  It turned
out, however, that the link_o targets were used exclusively for
engines and the link_a targets were for libcrypto and libssl.

This rename fest turns and indication on the kind of input the targets
get to the intention with using them.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:51:23 +01:00
Richard Levitte
f5c174ff93 Centralise the shared library / dso name info in unix-Makefile.tmpl
Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:51:23 +01:00
Richard Levitte
e987f9f271 Let Configure figure out the diverse shared library and DSO extensions
Then it can pass around the information where it belongs.  The
Makefile templates pick it up along with other target data, the
DSO module gets to pick up the information through
crypto/include/internal/dso_conf.h

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:51:23 +01:00
Richard Levitte
f0c93a8593 Unified - don't install the ossltest engine
This is done with a simple file name comparison.  We could think of
something more elegant in the future.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:12:33 +01:00
Richard Levitte
8be7bdb5c6 Unified - do a better job when uninstalling
Some directories weren't removed.

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-19 11:12:33 +01:00
Richard Levitte
27f42b4679 Don't use config.timestamp, we already have configdata.pm
The benefit with using configdata.pm is that Configure writes it for
us.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-02-19 02:30:51 +01:00
Richard Levitte
c058fcd798 Automatic 'make depend' for the unified build scheme
This isn't the fully featured combination of compiler generated
dependency files and Makefile include directives, but a cheaper
variant of the same.

The dependency files are generated automatically, but then we have the
usual "depend" target.  However, we depend on it in the bigger phony
targets that are the most likely to be used.  That make this feature
automatic enough.

A side effect is that we can't use the build file's timestamp to check
if reconfiguring might be in order.  In its place, we use a flag file
that depends on Configure and the build file template and depend on it
in spots where it makes sense to check for the need to reconfigure.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-18 23:48:52 +01:00
Richard Levitte
f325fba50c Set EXE_EXT environment variable when testing
When cross compiling, we may end up with someting like apps/openssl.exe
and a number of test/*.exe.  However, util/shlib_wrap.sh doesn't know
what the executable extension should be, if any, so we need to make
sure it has access to that information when testing, since
OpenSSL::Test uses that script to execute all programs.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-18 23:45:44 +01:00
Richard Levitte
ce192ebed0 Remove all special make depend flags, as well as OPENSSL_DOING_MAKEDEPEND
All those flags existed because we had all the dependencies versioned
in the repository, and wanted to have it be consistent, no matter what
the local configuration was.  Now that the dependencies are gone from
the versioned Makefile.ins, it makes much more sense to use the exact
same flags as when compiling the object files.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-18 23:43:09 +01:00
Richard Levitte
88297284ad Don't treat .d (depend) files separately from object files
.d (.MMS in the VMS world) files with just dependencies are built from
exactly the same conditions as the object files.  Therefore, the rules
for them can be built at the same time as the rules for the
corresponding object files.

This removes the requirement for a src2dep function in the build file
templates, and for common.tmpl to call it.  In the end, the existence
of depend files is entirely up to the build file.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-18 23:42:09 +01:00