[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Makefiles and dependencies
From: |
Nicola Pero |
Subject: |
Re: Makefiles and dependencies |
Date: |
Sat, 18 Jan 2003 00:12:10 +0000 (GMT) |
> Hi,
>
> How difficult it would be to implement something like dependencies in
> makefiles?
>
> Concrete example: In steptalk I have GDL2 module that depends on the GDL2
> library/frameworks. I would like it to be built automaticaly, when GDL2 is
> available, othervise not.
>
> Can this dependency checking be implemented without configure scripts?
>
> GNUstep Framework dependency should be enough. We can get a list of all
> available frameworks (we know all dirs where frameworks are stored). In
> gnumakefile I should be able to write:
>
> BUNDLE_NAME = MyBundle (similar for other targets)
> MyBundle_REQUIRED_FRAMEWORKS = SomeFramework
>
> And we should have:
> MyBundle_IS_OPTIONAL = YES
> to ignore building the bundle when dependencies are not met, and:
> MyBundle_IS_OPTIONAL = NO
> and when dependencies are not met, make will fail.
>
> Instead of having such feature for all targets, it is sufficient to restrict
> it to subprojects (aggregate.make).
>
> Some dependency list (as a cache) can be built at first make.
>
> Just a brief idea. What do you think about that?
I think it's worth thinking about this idea. :-)
In this specific case, you don't need it, and can easily do as follows:
include $(GNUSTEP_MAKEFILES)/common.make
BUNDLE_NAME = xxx
xxx_OBJC_FILES = ddd.m
# Include gdl2.make IF there
-include $(GNUSTEP_MAKEFILES)/Auxiliary/gdl2.make
# If gdl2.make was included, compile the bundle; else, do nothing
ifneq ($(GDL2_VERSION),)
include $(GNUSTEP_MAKEFILES)/bundle.make
else
include $(GNUSTEP_MAKEFILES)/rules.make
endif
But in general, it's a very interesting idea. Thanks!
To implement it so that it runs quickly, maybe we would need to keep a
catalog somewhere (one per domain), in the form of a file which can be
included in a makefile, of all libraries/frameworks installed (in that
domain). Then you could easily check if a library/framework was available
- the file would be included by the system, and you'd have some variables
defined by the file to check.
Periodically you would need to run an 'update' script to update these
catalogs. Not sure if it's worth it.