[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNUmakefile covering sources in different directories
From: |
Nicola Pero |
Subject: |
Re: GNUmakefile covering sources in different directories |
Date: |
Wed, 10 Dec 2003 11:15:22 +0000 (GMT) |
> >> OmniFoundation/GNUMakefile:
> >> LIBRARY_NAME = OmniFoundation
> >> LIBRARY_SUBPROJECTS = OpenStepExtensions FooDirectory
> >
> > B*llsh*t ... it should read, eg.
> >
> > LIBRARY_NAME = OmniFoundation
> > OmniFoundation_SUBPROJECTS = <subdirectory>
>
> I thought, that would mean, that the subprojects are independant. I
> mean, the subprojects need a project type, e. g. library. But they
> shouldn't have a project type, just linked into the main project.
> And how do I link the object files to the main project afterwards?
To understand the issue, you need to make a clear difference between
'subprojects' and 'aggregate projects'.
subprojects are declared using xxx_SUBPROJECTS = ...
aggregate projects are declared using SUBPROJECTS = ...
(please take a couple of seconds to note the difference). It is
unfortunate that aggregate projects are declared using SUBPROJECTS = ...,
which is confusingly similar to the variable used for subprojects. This
is definitely confusing and is probably the cause of your confusion. I
apologize for the bad naming, but it's historical.
Anyway, in this case Chris is explaining you about subprojects
(OmniFoundation_SUBPROJECTS = <list of subdirectories>), which is not the
same thing as aggregate projects (SUBPROJECTS = <list of subdirectories>).
Please note that subprojects are subprojects "of something". As a matter
of fact, you declare them as for example in
Renaissance_SUBPROJECTS = AutoLayout Markup TagLibrary
So, AutoLayout, Markup and TagLibrary are "subprojects of Renaissance".
(in the case of aggregate projects, aggregate projects are not bound to
anything. Eg,
SUBPROJECTS = Source Documentation Tools
you see these are independent things, not belonging to anything, in fact,
aggregate projects are just independent projects hold in subdirectories,
while subprojects are parts of the a project hold in subdirectories).
In the case of subprojects, this means just that part of the files to
compile are held in the subdirectories. Inside each subdirectory, you
should have a GNUmakefile for a project of type 'subproject'. For
example, in the AutoLayout directory of Renaissance, you could have
something like -
include $(GNUSTEP_MAKEFILES)/common.make
SUBPROJECT_NAME = libgnustep-autolayout
libgnustep-autolayout_OBJC_FILES = \
GSAutoLayoutDefaults.m \
GSAutoLayoutManager.m \
GSAutoLayoutStandardManager.m \
GSAutoLayoutProportionalManager.m \
GSHBox.m \
GSVBox.m \
GSHSpace.m \
GSVSpace.m \
NSViewSize.m
include $(GNUSTEP_MAKEFILES)/subproject.make
When you now type 'make' in the top directory (which is be a standard
project, such as a library in Renaissance's case), that will go into every
subproject's directory, compile the files there, and then automatically
link them into the main project's object file (you can do a similar thing
with headers, see eg Renaissance).
So, subprojects are a way to spread the parts of a project in
subdirectories.
An aggregate project (remember, this is defined by set up by using
SUBPROJECTS = ...) is different - in that case, the subdirectories contain
standalone / independent projects, each with its own well-defined type,
which are compiled independentely. Aggregate projects effectively just
loop on the subdirectories and builds whatever is in there. In this case,
you need to add SUBPROJECTS = ... to the top-level GNUmakefile, and
include aggregate.make. The subdirs can hold any project type you wish.
Subprojects, which is what you are interested in in this case, instead
mean that a project has got some (or all) source files spread over a few
subdirectories. The files are gathered, and linked into the main project
object file. In this case, you need to add xxx_SUBPROJECTS = ... to the
top-level GNUmakefile. The subdirs must hold stuff compiled using
subproject.make.
Re: GNUmakefile covering sources in different directories, Jason Clouse, 2003/12/10
Re: GNUmakefile covering sources in different directories, Philip Mötteli, 2003/12/10