On Tue, Jul 01, 2014 at 02:10:31PM -0400, Mike Bland wrote:
> I was wondering why 'make depend' output was saved in the Makefiles.
> So I guess adding the .d files to the repository and using include
> statements in the Makefiles is a reasonable possibility? (That's the
> angle I'm taking with my experiment, though I hadn't thought to add
> the .d's to the repo.)

The problem with using include statements in Makefiles is that's not
particularly portable.  So what I do in e2fsprogs is to modify the
Makefile.in files directly (since I use autoconf, but NOT automake or
libtool):

.depend: Makefile $(SRCS) $(top_srcdir)/depfix.sed $(top_srcdir)/wordwrap.pl
        if test -n "$(SRCS)" ; then \
                $(CC) -M $(ALL_CFLAGS) $(DEPEND_CFLAGS) $(SRCS) | \
                        $(SED) -f $(top_srcdir)/depfix.sed \
                            -e 's; $(srcdir)/; $$(srcdir)/;g' \
                            -e 's; $(top_srcdir)/; $$(top_srcdir)/;g' \
                            -e 's; $(top_builddir)/; $$(top_builddir)/;g' \
                            -e 's; \./; ;g' \
                            -e '/^#/d' \
                            -e '/^ *\\$$/d' | \
                        $(PERL) $(top_srcdir)/wordwrap.pl > .depend; \
        else :; fi

depend:: .depend
        if test -n "$(SRCS)" ; then \
                sed -e '/^# +++ Dependency line eater +++/,$$d' \
                        < $(srcdir)/Makefile.in | cat - .depend \
                        > $(srcdir)/Makefile.in.new; \
        if cmp -s $(srcdir)/Makefile.in $(srcdir)/Makefile.in.new ; then \
                $(RM) $(srcdir)/Makefile.in.new ; \
        else \
                $(MV) $(srcdir)/Makefile.in $(srcdir)/Makefile.in.old; \
                $(MV) $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in; \
        fi ; else :; fi

... and where depfix.sed is a sed script that strips out the system
header files, so that the resulting dependencies are portable across
different OS's.  So this matches OpenSSL's requirements, I think.  Gcc
is required to update the dependencies, but it's not required for
people who are building on systems that have old-style makes,
including ones that go as far back as Solaris 2.x, AIX, etc.  (This is
a modified and updated version of something that I had originally
created for MIT Kerberos, which had a very wide portability
requirement, including creating NMAKE compatible files for a very old
version of Visual Studio, as well as makefiles that would work with
Apple's MPW.  :-)

                                        - Ted
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to