Fix mk1mf.pl rule generation for asm files

Before this change, the mk1mf.pl script only emitted incorrect rules for a
number of asm files, due to a combination of incomplete/incorrect pattern
matching (in the foreach block at line 1200 in the original) and missing
fix_asm() calls in 'copy' mode (line 909 in the original).

In the original, rules were emitted for files which appeared in the
lower-level Makefile variable definitions, regardless of the values defined in
the top-level Makefile. Now rules are emitted only for the top-level Makefile
values.

fix_asm() also now correctly handles the case where the asm variable is empty,
rather than causing a failure.

I noticed the problem during the course of my build system refactoring
experiments, while examining the makefile generated by GitConfigure in a clean
branch against one generated in my experimental branch. I used the same method
to verify that this change works as expected.

Signed-off-by: Mike Bland <mbland@acm.org>
Remove spurious extra target from tools/Makefile

Signed-off-by: Mike Bland <mbland@acm.org>
Add .d files to 'make clean' targets

This was automatically applied by AddDependencyFilesToCleanTargets() in:
https://code.google.com/p/mike-bland/source/browse/openssl/update_makefiles.py

Signed-off-by: Mike Bland <mbland@acm.org>
Configure dependency-generating compiler flags

This is in anticipation of removing support for makedepend, as per:

http://marc.info/?t=140420825100001&r=1&w=2
https://groups.google.com/forum/#!topic/mailing.openssl.dev/m9XDCpmzWAg

Signed-off-by: Mike Bland <mbland@acm.org>
Create process_makefile() function

This preserves existing behavior, but anticipates the addition of a
configure.mk.org file that will contain common build variables that will be
included in GNU- and BSD-specific Makefiles. Consequently, this code will be
updated again to accommodate configure.mk once it appears.

Signed-off-by: Mike Bland <mbland@acm.org>
Extract import_top_level_vars() function

This preserves existing behavior, and is in preparation for importing
variables from a top-level configure.mk file as well.

Signed-off-by: Mike Bland <mbland@acm.org>
Generate configure.mk during Configure

configure.mk.org contains the build variables shared betweeen GNU- and
BSD-specific Makefiles that are set by Configure. Many are defined according
to the value of BUILDENV in Makefile.org.

Signed-off-by: Mike Bland <mbland@acm.org>
Process configure.mk for top-level 'make files'

Placing configure.mk first ensures that its values are processed first. At
this stage in the Makefile refactoring experiment, the differences in
the resulting MINFO file are all at the top-level, and a result of the fact
that configure.mk defines all of the following variables as they appear in the
existing BUILDENV variable:

- ASFLAG ends in '-c'.
- FIPS_EX_OBJ is expanded as part of BUILDENV, BUILD_CMD, BUILD_ONE_CMD and
  RECURSIVE_BUILD_CMD.
- LIBRPATH and MAKEOVERRIDES are defined.

Signed-off-by: Mike Bland <mbland@acm.org>
Parse configure.mk and use it to replace BUILDENV

The only differences in the resulting output are due to the expansions
explained in the earlier 'make files' commit.

Signed-off-by: Mike Bland <mbland@acm.org>
Remove $(TOP) refs from top-level Makefiles

These refs are unnecessary in the top-level Makefile and cause several targets
to break when TOP is stripped out, notably during 'make links', called by
Configure.

Signed-off-by: Mike Bland <mbland@acm.org>
Add TOP as an argument to files.pl

TOP will eventually be stripped from the Makefiles in an upcoming commit, so
it needs to be passed on the command line in order for the RELATIVE_DIRECTORY
calculation to work correctly.

This was automatically applied by AddTopToFilesTarget() in:
https://code.google.com/p/mike-bland/source/browse/openssl/update_makefiles.py

Signed-off-by: Mike Bland <mbland@acm.org>
Import top-level variables from configure.mk

This preserves existing behavior, but anticipates a future change where
variables defined in configure.mk are removed from other Makefiles.

Signed-off-by: Mike Bland <mbland@acm.org>
Remove HERE variable

It was only used in the top-level Makefile, and wasn't necessary.

Signed-off-by: Mike Bland <mbland@acm.org>
Create {GNU,BSD}makefiles

These files include the top-level configure.mk file, the Makefile in the
same directory, and the .d (dependency info) files corresponding to the
SRC variable in each Makefile except at the top level.

This was automatically applied by CreateGnuMakefile() and CreateBsdMakefile()
in:
https://code.google.com/p/mike-bland/source/browse/openssl/update_makefiles.py
Strip out Makefile vars present in configure.mk

Also strips out MAKEDEPEND, since the {GNU,BSD}makefiles now include the
compiler-generated .d files; and TOP, since that's defined in the
{GNU,BSD}makefiles.

This was automatically applied by RemoveConfigureVars() in:
https://code.google.com/p/mike-bland/source/browse/openssl/update_makefiles.py
Makefile.{org,fips} cleanup

This extracts VERSION and comments from both Makefiles after the earlier
automated commit to strip configure.mk vars from the Makefiles.
Remove makedepend sections from Makefiles

makedepend doesn't appear to be very reliable after all:
http://marc.info/?l=openssl-dev&m=140420807716037&w=2
https://groups.google.com/d/topic/mailing.openssl.dev/m9XDCpmzWAg/discussion

Configure now sets compiler flags that will automatically generate .d files
with (accurate) dependency information, and the {GNU,BSD}makefiles now read
those files automatically.

This was automatically applied by RemoveOldMakeDependOutput() in:
https://code.google.com/p/mike-bland/source/browse/openssl/update_makefiles.py
Eliminate 'make depend' targets and MAKEDEPPROG

This was automatically applied by RemoveDependTarget() in:
https://code.google.com/p/mike-bland/source/browse/openssl/update_makefiles.py
Remove 'make depend' advice from Configure
Cat configure.mk and Makefile.shared, strip vars

The recursive make based on Makefile.shared is not worth eliminating, as it's
being used very differently than a typical Makefile: It's being used purely as
a linking tool. Consequently, it has no impact on the dependency graph for the
targets which invoke it.

With the {GNU,BSD}makefile + configure.mk scheme, this change provides an
effective way of ensuring that the configure.mk variables are set without
having to figure out how to negotiate between the different make flavors,
since both flavors accept a Makefile definition streamed into standard input.

This was (mostly) automatically applied by CatConfigureAndMakefileShared() in:
https://code.google.com/p/mike-bland/source/browse/openssl/update_makefiles.py