Coder Social home page Coder Social logo

Comments (4)

aostruszka avatar aostruszka commented on May 20, 2024

Hello Chris
First of all thank you for trying use this project.
If I understand you you'd have something like:

project/
  lib_a/
  lib_b/
  inc/
  src/

and files in src are dependent on headers that are supposed to be installed by the "make install" from lib_a and lib_b. Obviously you have to tell make the dependencies somehow - either manually or by relying on the built in rules. In your case I would first judge whether the "interface" of those libraries changes that often that I need to have that functionality of rebuilding everything when some internals changes. In other words one possible "solution" is just some "make prep" which just installs the headers in inc after which you forget about that since the interface does not change.

However if you do want the headers updated when lib_a or lib_b internals changes and subsequently everything in src recompiled then you need to tell make that inc/header_a.h is a copy of lib_a/header_a.h (or generated by some rule in lib_a). If this is just a copy then you'd need to add an order dependency on that include (currently there is no support for specifying of order only dependencies in this makefile system - you'd have to do that via normal make syntax) and if this include is generated then in lib_a you'd add rule for doing that and record this header dependency for files in src.

I know that this does not help you much. If you could come up with some minimal example then I might be more helpful and maybe some improvement could be identified that will be useful for your case.

Regards
Andrzej

from nonrec-make.

chrisarguin avatar chrisarguin commented on May 20, 2024

Your understanding is basically correct. I simplified the case a little bit; there are also other files that are used as part of the auto-generation process. Currently we have a structure like this:
project
common
toolkit1
toolkit2
process
build
Where "common" "toolkit1" "toolkit2" and "process" will result in "libcommon.a", "libtoolkit1.a", "libtooklit2.a", and "process.exe" (possibly also "libprocess.a" depending on Makefile). Everything gets installed into the "build" directory.

We also use something similar to CORBA/IDL or SNMP MIBs, where a set of files describing interfaces are used to auto-generate .c/.h files. That tool also generates dependency files.

When you do a make in any directory, it does multiple passes much like you describe, installing all interface description files, generating the headers from those, installing all the headers, building all the libraries, installing all the libraries, building all the executables, and finally installing those executables.

I have a "makedepends" script that runs GCC to generate the dependencies, and then assumes that any missing dependencies are in the appropriate directory under the "build" directory. So I can fix up the dependencies in that manner; the thing that is causing me problems is I can't figure out how to make the dependencies files get generated. Your system generates them as a side-effect of compilation, which is certainly more efficient when possible, but I need them generated prior to compilation.

It may just be that I add an explicit "make depends" step that does this, but I was trying to make things as automatic as possible.

from nonrec-make.

aostruszka avatar aostruszka commented on May 20, 2024

I'm still not sure if I understand what are you trying to achieve - it seems to me that you have already some working system and you think about switching to something else. If it is so then maybe some assumptions made for your present system don't need to be kept.

But to answer your concrete question: I have no other idea than just telling make explicitly what are the dependencies.
When building in project make needs to know that libtoolkit1.a is supposed to be in build and in order for it to be there make needs to copy it from some other place.
This is not something that will be eased by this system. If I were to use this system for your kind of project then instead of "making copies of the outputs in build" I would simply build them in their own places and just add to global include/libs flags correct locations.

From your description it seems to me that your project can have dependency (or "order" dependency) on some "phony" file(s) in build dir and these dependencies can have rules like (assuming that toolkit-all does the part of job related to toolkit1):

$(TOP)/build/.libtoolkit1 : toolkit1-all
    touch $@

and your project can have dependencies on $(TOP)/build/.libtoolkit1. This dependency will force building toolkit1 if corresponding "file-tag" is not present in build dir.

You might also want to take a look at this attempt. Maybe this will give you some hint?

Best regards
Andrzej

from nonrec-make.

aostruszka avatar aostruszka commented on May 20, 2024

Ohh, and another thought. Since you already have script generating correct dependencies maybe all you need to do is just:

$(TOP)/build/dependencies.out:
    makedependencies -o $@

include $(TOP)/build/dependencies.out

Note that there is no - in front of include. So if these dependencies are missing make will try to find a rule to build them and since we provide one everything should be OK. Note also that this
script should provide dependencies for the 'dependencies.out' too - otherwise it will be rebuilt every time.

from nonrec-make.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.