Re: [bakefile-devel] Subprojetc question.

"Hans Van Leemputten" <[email protected]> Fri, 6 Feb 2004 23:02:27 +0100
Newsgroups gmane.text.documancer.user
Message-ID <019901c3ecfc$e8c42bf0$0601a8c0@starwars>
Hi,

----- Original Message -----
From: "Vaclav Slavik" <[email protected]>
To: <[email protected]>
Sent: Thursday, February 05, 2004 9:17 PM
Subject: Re: [bakefile-devel] Subprojetc question.


> Hans Van Leemputten wrote:
> > Before mailing here I already reported a bakefile bug on the
> > wxWindows SF page, should I duplicate it on the bakefile SF page as
> > it is not specific to wxWin?
>
> Yes, please. BTW, I think it's not specific to Watcom...

Done, and indeed it is not only Watcom that has this problem.

> > No I understand (well I think I do) what subproject is for and what
> > the bakefile exe,lib,dll rule is for. The first version of my
> > bakefile did it the way you suggest above, but there are some
> > problems doing it this way:=20
> > - The guidelib and demo dsp file will
> > both be in the demo directory.=20
>
> On the contrary, if you use a subproject, there will be two makefiles.=20
> That's the very point of subprojects.

Huh? I guess you misunderstood me... as the bakefile(s) referred to here and
other snipped points was using the <lib> <exe> rule (in one bakefile or with a
include statement) and it did *not* use <subproject> feature...

<snip>

As we seem to misunderstand each other let me try to do this in another way...
with a sample situation, take the following directory tree.

--AProject
    |--Lib1
    |    |--src
    |    |--include
    |    \--Samples
    |         |--Demo1
    |         \--Demo2
    |--Lib2
    |    |--src
    |    |--include
    |    \--Samples
    |         |--Demo1
    |         \--Demo2
    |--Libs
    \--TheApp

- AProject/Lib1 should have a set of makefile/project files to build the lib
and the lib should be copied in the libs directory. AProject/Lib1/Samples/Demo1
and AProject/Lib1/Samples/Demo2 samples should have each a set of
makefiles/project files that depend on the lib1 (so needs to be build if not
done yet) and produce a exe.
- For AProject/Lib2 (and samples) the same applies as for AProject/Lib1but uses
other options (for example has only debug/release settings while AProject/Lib1
has the same + some extra).
- AProject/TheApp uses/depend both AProject/Lib1 and AProject/Lib2 using the
same set options as where used by AProject/Lib1. Meaning that AProject/Lib1 and
AProject/Lib2  should be build with the makefile/project file in the
AProject/Lib1 or AProject/Lib2 directory.

Now how would you write bakefiles for this extended-sample?

> > Aha ok. I did some googling around and found-out the following that
> > may help: - The borland make file could use PUSHD and POPD command
> > to change directory. Unfortunately this will only work on NT based
> > systems.
>
> =2E..and so I cannot use it.

You could... that is if you do something like (maybe overkill...)

!if "$(OS)" == "Windows_NT"
_PUSHCD = PUSHD
_POPCD = POPD
!endif
!ifndef _PUSHCD
_PUSHCD = cd
!endif
!ifndef _POPCD
_POPCD = cd
!endif

guidelib:
    $(_PUSHCD) ..\..
    $(MAKE) -f makefile.bcc $(MAKEARGS) all
    $(_POPCD) ..\..


> > - Another dirty workaround would be to output a batch file that
> > does the following (note: not very well tested!)
> >
> > guidelib:
> >     @echo cd ..\.. > %temp%\$<.bat
> >     @echo $(MAKE) -f makefile.bcc $(MAKEARGS) all >> %temp%\$<.bat
> >     call %temp%\$<.bat
> >     @del %temp%\$<.bat
>
> You're right, it _is_ dirty ;) It could work as last resolt, but let=20
> me repeat once again that <subproject> should be used with=20
> subdirectories only.

Ok, very limiting but ok. I clearly don't agrea with this but I'm not going to
push my luck so I'll stop talking about it ;-)

> > BTW. Would it be possible to also foresee a clean rule for the
> > subprojects? I was thinking of a cleanall or veryclean rule... just
> > so there is a way to do clean action for all subprojects as well.
>
> "make clean" does that.

No it does not! The clean rule will _only_ clean the things build by the called
makefile, it will not go to the subproject directorys and clean them as well.
For example take the makefile in the samples directory of wxWindows, I could do
"make -f makefile.bcc all" to build all things, but there is no way to "make -f
makefile.bcc cleanall" that cleans all the known subprojects... It would really
be a pain to go into all sample directories and do a clean in them one by
one...

Kind regards,
Hans.





-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn